/* who are the students that are not taking any classes */ /* One way is to left join and check for nulls-------------- */ select student.* from student left join class on student.ssn = class.stu_ssn where class.course_id is null ; /* Another way is to use NOT IN (subquery)----------------- */ select * from student where ssn NOT IN ( select stu_ssn from class ); /* you can add DISTINCT */ /* Yet another way is to use NOT EXISTS (correclated subquery)----- */ select * from student where not exists ( select stu_ssn from class where student.ssn = class.stu_ssn ); /* And in ORACLE you can also use MINUS------------------- */ select * from student where ssn in (select ssn from student minus select stu_ssn from class);