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
谢谢大家的阅读,阅读后记得关注一下呦!