MySQL_七种Join理论

1.左连接

SELECT <select_list> FROM TableA A LEFT JOIN TableB B on A.Key=B.Key

2.左连接

SELECT <select_list> FROM TableA A RIGHT JOIN TableB B on A.Key=B.Key  

3.左连接并去掉公共部分

SELECT <select_list> FROM TableA A LEFT JOIN TableB B on A.Key=B.Key WHERE B.Key IS NULL

4.右连接并去掉公共部分

SELECT <select_list> FROM TableA A RIGHT JOIN TableB B on A.Key=B.Key WHERE A.Key IS NULL

5.内链接

SELECT <select_list> FROM TableA A INNERJOIN TableB B on A.Key=B.Key

6.全连接

SELECT <select_list> FROM TableA A FULL OUTER JOIN TableB B on A.Key=B.Key

7.各自独有

SELECT <select_list> FROM TableA A FULL OUTER JOIN TableB B on A.Key=B.Key WHERE A.Key IS NULL OR B.Key IS NULL

posted @ 2019-09-02 20:30  创作我的创作  阅读(297)  评论(0编辑  收藏  举报