Database Reference
In-Depth Information
SELECT DISTINCT FirstName, LastName, CourseName
FROM STUDENT S, STUDENT_CLASS T, CLASS C, COURSE R
WHERE S.StudentID = T.StudentID AND
T.ClassID = C.ClassID AND
C.CourseID = R.CourseID
Since the tables STUDENT and COURSE are not directly linked, two additional
tables STUDENT_CLASS and CLASS are used to link the table STUDENT to the
table COURSE. Highlight the code and click Run . he result of the query is shown in
Figure 6.56.
8. Example 7: Select the semesters and classes by using a left outer join to see if any of the
semesters ofer no class. Enter the following query:
SELECT Semester, ClassID
FROM SEMESTER S LEFT OUTER JOIN CLASS C ON
S.SemesterID = C.SemesterID
Highlight the code and click Run . he result of the query is shown in Figure 6.57. You
can see in Figure 6.57 that no class is ofered during the summer.
Figure 6.56
Use inner join to select data from multiple tables.
Search WWH ::




Custom Search