当前位置:网站首页>mysql的七种join连接查询

mysql的七种join连接查询

2022-07-05 04:02:00 ganganlee

mysql join查询是开发中必不可少的知识,以下整理了常见的七种join查询语句,方便学习
在这里插入图片描述
一、内连接

sleect * from a inner join b on a.key = b.ky;

二、左连接

select * from a left join b on a.key = b.key;

三、右连接

select * from a right join b on a.key - b.key;

四、左独占

select * from a left join b on a.key = b.key where b.kry is null;

五、右独占

select * from a right join b on a.key = b.key where a.key is null;

六、全连接

select * from a left join b on a.key = b.key union select * from a right join b on a.key = b.key;

七、全独占

seelct * from a left join a on a.key = b.key where a.key is null union select * from a right join b on a.key = b.key where b.key is null;
原网站

版权声明
本文为[ganganlee]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_44540711/article/details/125567279