在
MySQL 中,
左连接(LEFT JOIN)是一种外连接,它返回
左表中所有的行,而右表中匹配的行将被返回。如果右表中没有匹配的行,则结果集中将包含 NULL 值。

以下是一个
左连接查询的示例:
```
SELEC
t *
FROM table1
LEFT JOIN table2
ON table1.column = table2.column;
```
这个
查询将返回 `table1` 中所有的行,以及与 `table2` 中匹配的行。如果 `table2` 中没有匹配的行,则结果集中将包含 NULL 值。
左连接查询通常用于在一个表中找到与另一个表中相关的数据。例如,假设您有一个 `customers` 表格和一个 `orders` 表格,您想要列出每个客户及其订单的信息。您可以使用一个
左连接查询来完成此操作:
```
SELEC
t customers.customer_id, customers.name, orders.order_id, orders.order_date
FROM customers
LEFT JOIN orders
ON customers.customer_id = orders.customer_id;
```