RIGHT JOIN (or RIGHT OUTER JOIN) renders ALL records from the table on the right side (Table 2) and corresponding records of the table on the left side (Table 1). In a RIGHT JOIN, records that do not have corresponding data from the left table will show ‘NULL’ values from columns/fields selected from the left table.
NOTE: RIGHT JOIN is very similar to LEFT JOIN. The difference has to do with the table positioning in relation to the query. The ‘left’ table is always the table referred to in the FROM clause. The ‘right’ table is the table used after the JOIN clause and the matching column in each table is what binds the tables together.
SELECT table_1.field1, table_1.field2, table_2.field1, table_2.fieldn....
RIGHT JOIN table_2
ON table_1.matching_field = table2.matching_field;
Notice how the result set only outputs three rows. There are only three rows because the use case only applies to three customer results from the ‘Customers’ table.