高级查询 --连接查询 select * from 表1,表2 ————形成笛卡尔积 select * from 表1,表2 where 表1.主键=表2.外键 ————主外键位置可以互换 --join on 内连接 格式: select * from 表1 join 外键 on 表1.主键 = 表2.外键 --查哪位学生的哪一门课考了多少分 select student.sname,course.cname,score.degree from student join score on sc…
高级查询: 一.多表链接 1,普通查询 select * from 表名,表名 where 表名.列名 = 表名.列名 2,join链接 select * from 表名 join 表名 on 表名.列名 = 表名.列名 二.多表联合 select * from 表名 where 列名='内容' union select * from 表名 where 列名='内容' 三.子查询(无关子查询) select * from 表名 where 列名 = (select 列名 from 表名 wher…