Sql - RIGHT and FULL JOIN
Code Life
By Pierre Marsaa
RIGHT JOIN: the mirror image
RIGHT JOIN is the mirror of LEFT JOIN: it keeps every row of the right table (the one after JOIN).
RIGHT JOIN: all of table 2, plus the matching rows of table 1 - source
↗️
Loading editor...
↶
↷
Every Codémon is there, and Plantachu has NULL as trainer. This is exactly the result of FROM codemon c LEFT JOIN trainers t from the previous chapter — the same question asked from the other side.
Many people never write RIGHT JOIN
Since you can always swap the two tables and use LEFT JOIN, most developers only use LEFT JOIN and read queries from left to right. Know RIGHT JOIN exists, but don't feel obliged to use it.
Verify