Returns all rows from the right table and matching rows from the left; NULLs fill unmatched left-side columns.
Returns all rows from the right table and matched rows from the left; non-matching left rows produce NULLs. Less commonly used than LEFT JOIN since you can usually reverse the table order. Best reserved for queries where the right table defines the canonical set.
| Database System | Support Status | Since Version | Notes |
|---|---|---|---|
| MySQL | ✓ Supported | all | OUTER keyword is optional. |
| PostgreSQL | ✓ Supported | all | OUTER keyword is optional. |
| SQL Server | ✓ Supported | all | OUTER keyword is optional. |
| Oracle | ✓ Supported | all | OUTER keyword is optional. Legacy syntax: WHERE a.id(+) = b.a_id |
| SQLite | ✓ Supported | 3.39.0 | RIGHT JOIN added in SQLite 3.39.0 (July 2022). Rewrite as LEFT JOIN with tables swapped for older versions. |
RIGHT JOIN is the mirror of LEFT JOIN. Since it can always be rewritten as a LEFT JOIN with tables swapped, it is less commonly used.
OUTER keyword is optional.
OUTER keyword is optional.
OUTER keyword is optional.
OUTER keyword is optional. Legacy syntax: WHERE a.id(+) = b.a_id
RIGHT JOIN added in SQLite 3.39.0 (July 2022). Rewrite as LEFT JOIN with tables swapped for older versions.