sql关联表查询语句
人气:217 ℃/2023-07-23 15:12:58
一、外连接
1.左连接 left join 或 left outer join
SQL语句:select * from student left join score on student.Num=score.Stu_id;
2.右连接 right join 或 right outer join
SQL语句:select * from student right join score on student.Num=score.Stu_id;
3.完全外连接 full join 或 full outer join
SQL语句:select * from student full join score on student.Num=score.Stu_id;
通过上面这三种方法就可以把不同的表连接到一起,变成一张大表,之后的查询操作就简单一些了。
而对于select * from student,score;则尽量不使用此语句,产生的结果过于繁琐。
二、内连接
join 或 inner join
SQL语句:select * from student inner join score on student.Num=score.Stu_id;
此时的语句就相当于:select * from student,score where student.ID=course.ID;
三、交叉连接
cross join,没有where指定查询条件的子句的交叉联接将产生两表的笛卡尔积。
SQL语句:select * from student cross join score;
- 03-25
娱乐《最后的战役之联合之城》这款游戏的结局是什么意思
- 06-06
美食牛排原切和整切啥意思
- 02-14
综合什么叫房水循环
- 08-28
教育何彼秾矣华如桃李是什么意思
- 02-25
综合科比的数据统计
- 08-16
综合大话西游2紫霞仙住哪里
- 08-06
美食韩式剁椒牛肉做法
- 08-13
综合怎么做焖饼
推荐
- 1石狮到桂林 到哪乘汽车 动车 飞机448
- 2柯明达扮演者499
- 3Fri什么意思453
- 4我的世界神奇宝贝沙基拉斯怎么进化441
- 5刘德华原名叫什么名字159
- 6白月光结局什么意思276
- 7孞读什么471
- 8电子鼓和原声鼓有什么区别265
宠物
- 1斑马鱼尾巴烂怎么办439
- 2野生小丑鱼吃什么食物214
- 3望天眼的外形特点 它有着一双独特眼睛157
- 4比熊鼻子干热怎么回事117
- 5狗狗有糖尿病怎么办 给予胰岛素就可以治愈388
- 6松狮犬凶不凶几个月能看出来321
- 7黑煤球猫是什么品种349
- 8狗狗认主的表现212