Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The use of left join keyword in mysql

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about the use of the left join keyword in mysql, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Left join keyword

The LEFT JOIN keyword returns all rows from the left table (table_name1), even if there are no matching rows in the right table (table_name2).

LEFT JOIN keyword syntax

SELECT column_name (s) FROM table_name1 LEFT JOIN table_name2 ON table_name1.column_name=table_name2.column_name

Note: in some databases, LEFT JOIN is called LEFT OUTER JOIN.

Let's look at a picture:

Note: the LEFT JOIN keyword returns all rows from the left table, even if there is no match in the right table (access_log).

Example:

SELECT Persons.LastName, Persons.FirstName, Orders.OrderNoFROM PersonsLEFT JOIN OrdersON Persons.Id_P=Orders.Id_PORDER BY Persons.LastName and above are the use of the left join keyword in mysql. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report