MySQL语句机读顺序
人工书写SQL语句顺序:
机器读取顺序:
有限读取from子句
JOIN语句总结
1、内连接——INNER JOIN
SELECT <select_list> FROM TableA A INNER JOIN TableB B ON A.key = B.key
2、左连接——LEFT JOIN
SELECT <select_list> FROM TableA A LEFT JOIN TableB B ON A.key = B.key
3、右连接——RIGHT JOIN
SELECT <select_list> FROM TableA A RIGHT JOIN TableB B ON A.key = B.key
4、A独有
SELECT <select_list> FROM TableA A LEFT JOIN TableB B ON A.key = B.key WHERE B.key IS NULL
5、B独有
SELECT <select_list> FROM TableA A RIGHT JOIN TableB B ON A.key = B.key WHERE A.key IS NULL
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