Entity "Student"
|
Entity "Course"
|
Relationship "Enroll"
|
For example, "find the last names of students in Q200". This query contains three sub-queries:
Select section_nr from course where course_nr = Q200.
The answer is section_nr = 45.
Select ID from enroll where section_nr = 45.
The answer is ID = 456.
Select last_name from student where ID = 456.
The answer is last_name = Brown.
This can be expressed in one query:
Select last_name from student, enroll, course where
course_nr = Q200 AND
course.section_nr = enroll.section_nr AND
enroll.ID = student.ID