Escolar Documentos
Profissional Documentos
Cultura Documentos
The INNER JOIN operator combines every row in one table with every row in
the other table where the data in the two rows satisfies the ON condition. In this
example, the first parent row is combined with the first three child rows to pro-
duce a result set consisting of three rows.
parent. parent. child. child.
parent_key data_1 child_key parent_key
========== ======= ========= ==========
1 x 4 1 -- parent and child
1 x 5 1 -- parent and child
1 x 6 1 -- parent and child
The second and third parent rows dont appear in the final result set because
they cant be combined with any child rows and still satisfy the ON condition;
more specifically, parent.parent_key = 2 and 3 dont match any child.parent_key
values. The same is true of the fourth child row: It cant be matched with any
parent row because child.parent_key = NULL doesnt match any parent.par-
ent_key value. In other words, childless parent rows and orphaned child rows
arent included in the INNER JOIN using a foreign key relationship in the ON
condition.