Right outer join
In the syntax of a right outer join, the dominant table of the outer join appears to the right of the keyword that begins the outer join. A right outer join returns all of the rows for which the join condition is true and, in addition, returns all other rows from the dominant table and displays the corresponding values from the subservient table as NULL.
The following query is an example of a right outer join
on the customer and orders tables.
Figure 1. Query
SELECT c.customer_num, c.fname, c.lname, o.order_num,
o.order_date, o.customer_num
FROM customer c RIGHT OUTER JOIN orders o
ON (c.customer_num = o.customer_num);
The query returns all rows from the dominant table orders and,
as necessary, displays the corresponding values from the subservient
table customer as NULL.
Figure 2. Query result
customer_num fname lname order_num order_date customer_num
104 Anthony Wiggins 1001 05/30/1998 104
101 Ludwig Pauli 1002 05/30/1998 101
104 Anthony Wiggins 1003 05/30/1998 104
<NULL> <NULL> <NULL> 1004 06/05/1998 106