sql 查询-多个表重叠

来源:百度知道 编辑:UC知道 时间:2024/06/07 16:05:48
11111111111

用life join,right join,inner join 或者嵌套都可以
例如:
select * from score sc where sc.stuid in(select s.id from student s where s.age>10)//
或者
selcct sc.math from score sc join student s on
sc.stuid = s.id join subject sj on sc.sjid=sj.id
group by sc.math,s.id,sj.id
having s.id>10 and count(sj.id)>3
order by s.id,sj.id
即:查询至少上了3门课,并且学号大于10的学生的数学成绩

什么叫重叠,回去翻翻书再问!