SQL 是用于访问和处理数据库的标准的计算机语言。表关联查询会经常用到,以下是 7 种关联查询区分:
Inner JOIN
SELECT
< select_list >
FROM
Table_A A
INNER JOIN Table_B B ON A.KEY = B.KEY
Left JOIN
SELECT
< select_list >
FROM
Table_A A
LEFT JOIN Table_B B ON A.KEY = B.KEY
Right JOIN
SELECT
< select_list >
FROM
Table_A A
RIGHT JOIN Table_B B ON A.KEY = B.KEY
Outer JOIN
SELECT
< select_list >
FROM
Table_A A
FULL OUTER JOIN Table_B B ON A.KEY = B.KEY
Left Excluding JOIN
SELECT
< select_list >
FROM
Table_A A
LEFT JOIN Table_B B ON A.KEY = B.KEY
WHERE
B.KEY IS NULL
Right Excluding JOIN
SELECT
< select_list >
FROM
Table_A A
RIGHT JOIN Table_B B ON A.KEY = B.KEY
WHERE
A.KEY IS NULL
Outer Excluding JOIN
SELECT
< select_list >
FROM
Table_A A
FULL OUTER JOIN Table_B B ON A.KEY = B.KEY
WHERE
A.KEY IS NULL
OR B.KEY IS NULL