mysql join&union

0.表数据

1.innerJoin(取交集)

图:

 

 sql: select * from A inner join B on A.name=b.name;

结果:

 

 2.leftJoin

图:

 

sql: select * from A left join B on a.name=b.name;

结果:

 

 2.rightJoin

图:

 

 sql:select * from A right join B on a.name=b.name;

结果:

 

3.fullJoin (笛卡尔积)  mysql版本:

 描述:

笛卡尔乘积_百度百科 (baidu.com)

 

sql:select * from A full join B;

结果:

 

 

4.union(distinct)

 

 

 

 

5.unionAll

 Note:

win10 64bit mysql 5.7.32

 

posted @ 2021-01-11 21:39  BigWrite  阅读(68)  评论(0编辑  收藏  举报