In: Computer Science
1)
SELECT DISTINCT S.Sname FROM Student S, Class C, Enrolled E, Faculty F WHERE S.snum = E.snum AND E.cname = C.name AND C.fid = F.fid AND F.fhame = ‘I.Teach’ AND S.level = ‘JR’
2)
SELECT MAX(S.age) FROM Student S WHERE (S.major = ‘History’) OR S.num IN (SELECT E.snum FROM Class C, Enrolled E, Faculty F WHERE E.cname - C.name AND C.fid = F.fid AND F.fname = ‘I.Teach’ )
3)
SELECT C.name FROM Class C WHERE C.room = ‘R128’ OR C.name IN (SELECT E.cname FROM Enrolled E GROUP BY E.cname HAVING COUNT (*) >= 5)
4)
SELECT DISTINCT S.sname FROM Student S WHERE S.snum IN (SELECT E1.snum FROM Enrolled El, Enrolled E2, Class Cl, Class C2 WHERE E1.snum = E2.snum AND E1.cname <> E2.cname AND E1.cname = C1.name AND E2.cname = C2.name AND Cl.meets_at = C2.meets_at)
5)
SELECT DISTINCT F.fname FROM Faculty F WHERE NOT EXISTS (( SELECT *FROM Class C )EXCEPT(SELECT C1.room FROM Class C1 WHERE C1.fid = F.fid ))
6)
SELECT DISTINCT F.fname FROM Faculty F WHERE 5 > (SELECT COUNT (E.snum)FROM Class C, Enrolled E WHERE C.name = E.cname AND C.fid = F.fid)
7)
SELECT S.level, AVG(S.age) FROM Student S GROUP BY S.level