首页 > 数据库技术 > 详细

SQL中JOIN的使用

时间:2018-02-26 12:21:22      阅读:199      评论:0      收藏:0      [点我收藏+]

根据网络上的一些材料整理得到:

左连接 (left join)
select * from table1 left join tbale2 on table1.id=table2.id
这条sql语句返回结果 table1表中的数据全部返回 table2表中的数据只返回满足where条件的

右链接 (right join)
select * from table1 right join table2 on table1.id=table2.id
这条sql语句返回结果 table2表中的数据全部返回 table1表中的数据只返回满足where条件的

(insert join)
select * from table1 inner join table2 on table1.id = table2.id
这条sql语句返回结果 显示满足条件的数据 并不以谁为主表

 

---------------------------------------------------------------------------------------后续继续补充-------------------------------------------------------------------------

SQL中JOIN的使用

原文:https://www.cnblogs.com/dingcx/p/8472307.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!