Right Join
RIGHT JOIN keeps all rows from the right table. It is LEFT JOIN with the tables swapped. Most teams write LEFT JOIN only, and put the ‘must keep’ table on the left.
Know the name for MCQs. In code, prefer LEFT JOIN for readability.
Trap — mixing LEFT and RIGHT in one query until nobody can draw it.
On the example next to this theory — Right Join — jOIN combines rows using a match condition between tables.
students.id
=
marks.student_id
│
▼
one result rowExam tip
RIGHT JOIN = LEFT JOIN with tables swapped. Prefer LEFT.