+ 2
Left Join and Right Join Difference
What is the difference between LEFT JOIN and RIGHT JOIN in SQL? Please give me an example or anything related to this. Thanks!
2 ответов
+ 3
select m.name, f.name from men m left join women f on m.spouse=f.id
In this case you get all the married men with their wifes as well as all unmarried men. Change to right join you get all the couples and all the unmarried women.
That being set, you never need right joins. You can simply switch the tables in your statement. That is good for readability.
0
Now I know, noted this.Thanks!