Notice that we have lost the street and city information about Smith, since the tuple describing Smith is absent from the ft-works relation; similarly, we have lost the branch name and salary information about Gates, since the tuple describing Gates is absent from the employee relation.
We can use the outer-join operation to avoid this loss of information. There are actually three forms of the operation: left outer join, denoted ; right outer join, denoted ; and full outer join, denoted . All three forms of outer join compute the join, and add extra tuples to the result of the join. The results of the expressions appear in Figures 3.33, 3.34, and 3.35, respectively.
) takes all tuples in the left relation that did not match with
The left outer join (
any tuple in the right relation, pads the tuples with null values for all other attributes from the right relation, and adds them to the result of the natural join
The right outer join ( ) is symmetric with the left outer join: It pads tuples from the right relation that did not match any from the left relation with nulls and adds them to the result of the natural join.
The full outer join( ) does both of those operations, padding tuples from the left relation that did not match any from the right relation, as well as tuples from the right relation that did not match any from the left relation, and adding them to the result of the join. Figure 3.35 shows the result of a full outer join.