Consider the following relations Studentssn name address maj
Consider the following relations:
Student(ssn, name, address, major)
Course (code, title)
Registered (ssn, code)
ssn and code are underlined
a) List the information of the students majoring in \'CS\'
b) List the codes of courses for which at least one student is registered (registered courses)
c) List the titles of registered courses
d) List the codes of courses for which no student is registered
Solution
a) select s.ssn,s.name,s.address from Student s where s.major=\"CS\";
b) select DISTINCT r.code from Registered r
c) select c.title from Course c, Registered r where c.code=r.code
d) select c.code from Course c, Registered r where c/r
