What is Right Join in SQL?

Right Join is used to retrieve rows which are common between the tables and all rows of a Right-hand side table. It returns all the rows from the right-hand side table even though there are no matches in the left-hand side table.

In SQL, a RIGHT JOIN is a type of JOIN operation that returns all rows from the right table (table2), and the matched rows from the left table (table1). The result set will contain NULL values in the columns from the left table for rows where no match is found.

The basic syntax for a RIGHT JOIN is as follows:

SELECT *
FROM table1
RIGHT JOIN table2 ON table1.column_name = table2.column_name;

Here, table1 is the left table, table2 is the right table, and column_name is the column used for matching rows between the two tables.

In summary, a RIGHT JOIN includes all records from the right table and the matching records from the left table. If there is no match, NULL values will be displayed for columns from the left table in the result set.