Left join(左连接/左外连接):一种 SQL 连接方式,以左表为主,返回左表的所有行;当右表没有匹配行时,右表列以 NULL 补齐。常用于“保留主表数据,同时尽可能带上从表信息”。
/ˌlɛft ˈdʒɔɪn/
Use a left join to keep all customers even if they have no orders.
使用左连接可以保留所有客户,即使他们没有订单。
The analyst wrote a query that left-joined the sales table to the customer table so that inactive customers still appeared in the monthly report.
分析师写了一个查询,把销售表左连接到客户表,从而让不活跃客户也能出现在月度报告里。
“Left join”由 left(左侧) + join(连接)构成,源自关系数据库与关系代数中的“外连接(outer join)”概念;“left”强调以连接表达式左边的表为基准保留全部记录,因此也常写作 LEFT OUTER JOIN(其中 OUTER 常可省略)。