这篇文章给大家介绍SQL中Join如何使用,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。
1、INNER JOIN(内连接)
SELECT FROM Table_A AINNER JOIN Table_B BON A.Key = B.Key
2、LEFT JOIN(左连接)
SELECT FROM Table_A ALEFT JOIN Table_B BON A.Key = B.Key
3、RIGHT JOIN(右连接)
SELECT FROM Table_A ARIGHT JOIN Table_B BON A.Key = B.Key
4、OUTER JOIN(外连接)
SELECT FROM Table_A AFULL OUTER JOIN Table_B BON A.Key = B.Key
5、LEFT JOIN EXCLUDING INNER JOIN(左连接-内连接)
SELECT FROM Table_A ALEFT JOIN Table_B BON A.Key = B.KeyWHERE B.Key IS NULL
6.RIGHT JOIN EXCLUDING INNER JOIN(右连接-内连接)
SELECT FROM Table_A ARIGHT JOIN Table_B BON A.Key = B.KeyWHERE A.Key IS NULL
7、OUTER JOIN EXCLUDING INNER JOIN(外连接-内连接)
SELECT FROM Table_A AFULL OUTER JOIN Table_B BON A.Key = B.KeyWHERE A.Key IS NULL OR B.Key IS NULL
关于SQL中Join如何使用就分享到这里了,希望以上内容可以对大家有一定的帮助,可以学到更多知识。如果觉得文章不错,可以把它分享出去让更多的人看到。