SQL RIGHT JOIN (original) (raw)

Last Updated : 5 May, 2026

In SQL, the RIGHT JOIN (also called RIGHT OUTER JOIN) is used to combine rows from two tables based on a related column. It returns all records from the right table and only the matching records from the left table. If there is no match in the left table, the result will show NULL values for the left table’s columns.

8

Right Join

**Syntax:

SELECT column_name(s)
FROM tableA
RIGHT JOIN tableB
ON tableA.column_name = tableB.column_name;

**Examples of SQL RIGHT JOIN

In this example, we will consider two tables employee table containing details of the employees working in the particular department the and department table containing the details of the department

emp

Employee Table:

Depart

Department Table:

**Query:

SELECT
e.emp_no,
e.emp_name,
d.d_name,
d.location
FROM employee e
RIGHT JOIN dept d
ON e.dept_no = d.dept_no;

**Output:

Null

Output after using Right Join

Applications of SQL RIGHT JOIN