right join versus left join

后端 未结 3 1082
栀梦
栀梦 2021-01-22 22:44

In this case, a left join is the same as a right join?

mysql> 
mysql> 
mysql> use usenet;show tables;describe ARTICLE;describe NEWSGROUP;
Database chang         


        
3条回答
  •  失恋的感觉
    2021-01-22 23:13

    With your current data, yes they are the same. However as NEWSGROUP_ID is nullable then they could be different as the data changes.

    Personally I always use LEFT JOINs if possible (from primary table to child table), in fact I have only needed to use a RIGHT JOIN a couple of times in over 6 years of SQL development!

提交回复
热议问题