Home  >  Article  >  Database  >  What is the syntax of mysql left outer join query

What is the syntax of mysql left outer join query

王林
王林forward
2023-05-27 09:40:06880browse

1. Join the left table as the main table, display all the data in the main table, and query the data in the right table according to the conditions. If the condition is met, it is displayed; if not, it is null.

2. It can be understood as ensuring that all data in the left table is displayed based on internal connections.

Syntax

select 字段 from a left [outer] join b on 条件

Example

Use left join to query the class table and student table

Here As is used to alias the table in order to write a simple

select * from students as s right join classes as c on s.cls_id = c.id;

The above is the detailed content of What is the syntax of mysql left outer join query. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete
Previous article:How to set time in MySQLNext article:How to set time in MySQL