SQL join 用于把,来自两个或多个表的行结合起来。
下图展示了 LEFT JOIN、RIGHT JOIN、INNER JOIN、OUTER JOIN 相关的 7 种用法。。
1、SELECT <select_list> FROM TableA A LEFT JOIN TableB B ON A.Key = B.Key
2、SELECT <select_list> FROM TableA A LEFT JOIN TableB B ON A.Key = B.Key WHERE B.KeY IS NULL
3、SELECT <select_list> FROM TableA A RIGHT JOIN TableB B ON A.Key = B.Key
4、SELECT <select_list> FROM TableA A RIGHT JOIN TableB B ON A.Key = B,Key WHERE A.Key IS NULL
5、SEL