MySQL高级--sql语句
- sql执行顺序
sql语句表连接查询(join)
-
-
等值连接:select * from a inner join b on a.id=b.id;
- 左连接:select * from a left join b on a.id=b.id;
-
右连接:select * from a right join b on a.id=b.id;
-
-
- 左连接(变形):select * from a left join b on a.id=b.id where b.id is NULL;
-
有连接(变形):select * from a right join b on a.id=b.id where a.id is NULL;
- 左连接(变形):select * from a left join b on a.id=b.id where b.id is NULL;
-
- 全连接:select * from a FULL OUTER JOIN b on a.id = b.id;
- mysql语句:select * from a left join b where a.id=b.id union select * from a right join b where a.id = b.id;
- 全连接(变形):select * from a FULL OUTER JOIN b on a.id= b.if where a.id is NULL or b.id is NULL;
- 全连接:select * from a FULL OUTER JOIN b on a.id = b.id;
-
-
- mysql语句:select * from a left join b on a.id= b.id where b.id is null union select * from a right join b on a.id= b.id where a.id is null;
-
-