Reputation: 3835
What is the SELECT statement that, given a student name, will return his list of course names? I think this may be some of it:
SELECT c.course_name FROM Course c
INNER JOIN Enrollment e ON c.course_id = e.course_id
...
WHERE s.student_name = 'Tom';
Beyond that, I'm clueless.
(This isn't homework, it's just a simplification of a work problem.)
Upvotes: 0
Views: 90
Reputation: 5028
SELECT c.course_name FROM Enrollment e
INNER JOIN Course c ON c.course_id = e.course_id
INNER JOIN Student s ON s.student_id = e.student_id
WHERE s.student_name = 'Tom';
also
SELECT c.course_name
FROM Enrollment e, Course c, Student s
WHERE c.course_id = e.course_id
AND s.student_id = e.student_id
AND s.student_name = 'Tom';
Upvotes: 1