RIGHT JOIN Keyword in SQL Server

 

The SQL 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 table, when there is no match.

Syntax

The syntax of a RIGHT JOIN is as follow:

SELECT table1.column1, table2.column2... FROM table1 RIGHT JOIN table2 ON table1.common_id = table2.common_id

Example:

SELECT  ID, NAME, DATE, AMOUNT
   FROM CUSTOMER
   RIGHT JOIN ORDER
   ON CUSTOMER.ID = ORDER.CUSTOMER_ID


2020-04-21