RIGHT JOIN

In this lesson, we will discuss the RIGHT JOIN keyword.

We'll cover the following

RIGHT JOIN

The RIGHT JOIN keyword returns all records from the right table (table2), and the matched records from the left table (table1). The result is NULL from the left side when there is no match.

Syntax

SELECT table1.column1, table2.column2...

 FROM table1

RIGHT JOIN table2

ON table1.common_field = table2.common_field;

Note: In some databases, RIGHT JOIN is called RIGHT OUTER JOIN.

Example

Let’s say we want to return all orders and any customers that have placed an order:

Get hands-on with 1400+ tech skills courses.