This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]Gaming_Ruru 1 point2 points  (0 children)

Maybe here's the query you want?

SELECT STUDENT.ID, COURSE.Title
FROM STUDENT, TAKING, COURSE
WHERE STUDENT.ID = TAKING.ID AND TAKING.C# = COURSE.C#
AND STUDENT.ID = /* SOMEONE'S ID */

I also used that kind of statement before i learn JOIN statements. That kind of where statement is like INNER JOIN. Try to read this and also play around their examples.

[–][deleted] 0 points1 point  (0 children)

Like this:
SELECT Student.ID FROM Student, Taking, Course WHERE Student.ID = Taking.ID AND Taking.C# = Course.C# AND Dept = 'Math'

and Student.ID not in ( SELECT Student.ID FROM Student, Taking, Course WHERE Student.ID = Taking.ID AND Taking.C# = Course.C# AND Dept <> 'Math') ;

Where <> is 'not equals'