JOIN(7种JOIN)
作者:互联网
JOIN(7种JOIN)
-
INNER JOIN
SELECT FROM TBL1 INNER JOIN TBL2 ON TBL1.KEY = TBL2.KEY
-
LEFT JOIN
SELECT FROM TBL1 LEFT JOIN TBL2 ON TBL1.KEY = TBL2.KEY
-
LEFT JOIN(排除交集)
SELECT FROM TBL1 JOIN TBL2 ON TBL1.KEY = TBL2.KEY WHERE TBL2.KEY IS NULL
-
RIGET JOIN
SELECT FROM TBL1 RIGHT JOIN TBL2 ON TBL1.KEY = TBL2.KEY
-
RIGHT JOIN(排除交集)
SELECT FROM TBL1 RIGHT JOIN TBL2 ON TBL1.KEY =TBL2.KEY WHERE TBL1.KEY IS NULL
-
FULL OUTER JOIN
SELECT FROM TBL1 FULL OUTER JOIN TBL2 ON TBL1.KEY = TBL2.KEY
-
FULL OUTER JOIN(排除交集)
SELECT FROM TBL1 FULL OUTER JOIN TBL2 ON TBL1.KEY = TBL2.KEY WHERE TBL1.KEY IS NULL AND TBL2.KEY IS NULL;
标签:FULL,JOIN,TBL2,KEY,TBL1,SELECT 来源: https://www.cnblogs.com/new228666/p/16463661.html