Database Reference
In-Depth Information
Figure 6.42
Use multiple inner joins.
As shown in Figure 6.43, to display a pair of students who are enrolled in the same class in
the output, you need to do two things. First, you need to get a list of students whose names will
appear irst in the name pair. To do this, you should match the student ids in the STUDENT
table to the student ids in the table STUDENT_CLASS with the alias C1. hen, you need to get
a list of students whose names will appear secondly in the name pair. To do so, you need to match
the student ids in the same STUDENT table to the student ids in the table STUDENT_CLASS
with the alias C2. Two aliases S1 and S2 are used to distinguish the STUDENT table. he join
conditions look like the following:
Figure 6.43
Use self-join to select data.
Search WWH ::




Custom Search