Sobes.tech
Junior

What is a Right Join?

sobes.tech AI

Answer from AI

Right Join (or RIGHT OUTER JOIN) is a type of table join in SQL that returns all rows from the right table and the matching rows from the left table. If there are no matches for a row in the right table from the left table, the fields from the left table will be filled with NULL.

Key features:

  • Preserves all records from the right table.
  • Returns only matching records from the left table.
  • For rows from the right table without matches in the left, the fields from the left table will be NULL.

Visually, it can be represented as (R - right table, L - left table, i - matches):

+---+-----+
| L | R+i |
+---+-----+

Syntax:

SELECT
    column_list
FROM
    left_table
RIGHT JOIN
    right_table ON join_condition;