点击上方“Java面试题精选”,关注公众号
面试刷图,查缺补漏
>>号外:往期面试题,10篇为一个单位归置到本公众号菜单栏->面试题,有必须的欢迎翻阅。
下图展示了 LEFT JOIN、RIGHT JOIN、INNER JOIN、OUTER JOIN 关联的 7 种用法。
详细分解如下:
1.INNER JOIN(内连接)
SELECTFROM
Table_A A INNER JOIN
Table_B B ON A.Key = B.Key
2.LEFT JOIN(左连接)
SELECTFROM
Table_A A LEFT JOIN
Table_B B ON A.Key = B.Key
3.RIGHT JOIN(右连接)
SELECTFROM
Table_A A RIGHT JOIN
Table_B B ON A.Key = B.Key
4.OUTER JOIN(外连接)
SELECTFROM
Table_A A FULL OUTER JOIN
Table_B B ON
A.Key = B.Key
5.LEFT JOIN EXCLUDING INNER JOIN(左连接-内连接)
SELECTFROM
Table_A A LEFT JOIN
Table_B B ON A.Key = B.KeyWHERE B.Key IS
NULL
6.RIGHT JOIN EXCLUDING INNER JOIN(右连接-内连接)
SELECTFROM
Table_A A RIGHT JOIN
Table_B B ON A.Key = B.KeyWHERE A.Key IS
NULL
7.OUTER JOIN EXCLUDING INNER JOIN(外连接-内连接)
SELECTFROM
Table_A A FULL OUTER JOIN
Table_B B ON
A.Key = B.Key WHERE A.Key IS NULL ORB.KeyIS NULL
源自:www.codeproject.com/Articles/33052
近期五期
【57期】面试官问,MySQL建索引必须遵循那些原则呢?
【58期】盘点哪些面试中最常问的MySQL问题,第1弹!
【59期】MySQL索引是怎样加强查找效率的呢?(MySQL面试第二弹)
【60期】事务隔离级别中的可重复读能防幻读吗?(MySQL面试第三弹)
【61期】MySQL行锁和表锁的含义及区别(MySQL面试第四弹)
与其在网上拼命找题? 不如马上关注咱们~
|