乐闻世界logo
搜索文章和话题

What's the Difference Between Left Join and Right Join in SQL?

浏览0
2月5日 23:29

Left Join and Right Join are both types of joins in SQL used to merge two tables. The difference is:

  • Left Join: The result set includes all records from the left table. If there are no matching records in the right table, the fields from the right table will be NULL.
  • Right Join: The result set includes all records from the right table. If there are no matching records in the left table, the fields from the left table will be NULL.

Simply put, a left join retains all records from the left table, even if they have no match in the right table; a right join retains all records from the right table, even if they have no match in the left table.

标签:MySQL