sql join

(inner) join

selects records that have matching values in both tables
表中存在至少一个匹配时返回行,两张表中都有的数据才会显示。

left (outer) join

returns all records from the left table (table1), and the matching records from the right table (table2). The result is 0 records from the right side, if there is no match.
从左表(table1)返回所有的行,即使右表(table2)中没有匹配。如果右表中没有匹配,则该行中的右表字段显示为 NULL。

right (outer) join

returns all records from the right table (table2), and the matching records from the left table (table1). The result is 0 records from the left side, if there is no match.
从右表(table2)返回所有的行,即使左表(table1)中没有匹配。如果左表中没有匹配,则该行中的左表字段显示为 NULL。

full (outer) join

returns all records when there is a match in left (table1) or right (table2) table records.
只要左表(table1)和右表(table2)其中一个表中存在匹配,则返回行.。
FULL OUTER JOIN 关键字结合了 LEFT JOIN 和 RIGHT JOIN 的结果。
“全连接”,两张表中所有数据都显示。

self join

the table is joined with itself.

SELECT column_name(s)
FROM table1 T1, table1 T2
WHERE condition;

SQL 连接(JOIN) | 学SQL (learnsql.cn)icon-default.png?t=N7T8https://learnsql.cn/docs/sql_language/SQL_JOIN/SQL Joins (w3schools.com)icon-default.png?t=N7T8https://www.w3schools.com/SQL/sql_join.asp

  • 12
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值