2020-06-04
阅读量:
633
MySQL连接有哪些?
内连接:select * from A inner join B on A.Key = B.Key;
左连接:select * from A left join B on A.Key = B.Key;
右连接:select * from A right join B on A.Key = B.Key;
等值连接:select A_name,B_name,B_mobile from A, B where A.A_id = B.B_id
自连接:select p1.user_id, p1.user_name from usertable as p1, usertable as p2 where p1.user_id = p2.user_id and p2.user_id = '10086';
交叉连接:卡迪尔积,没有建立联结关系的表,行数为两表行数相乘
等值连接和内连接查询效果等效,用on建立连接关系,用where进行筛选
mysql 不支持 full join
连接关系图如下图所示:








评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论