多表连接

a_pei 2010-05-15 10:36:58
student表中有字段:sno.ssex,class,sname,sbirthday
course表中有字段:cno,cname,tno
score表中有字段:sno,cno,degree
teacher表中有字段:tno,tname,tsex,trof,tbirthday,depart

查询选修“3-105”课程的成绩高于“109”号同学成绩的所有同学的记录
...全文
94 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
chuanzhang5687 2010-08-13
  • 打赏
  • 举报
回复
select * from student inner join score on student.sno=score.sno
where cno='3-105'and
degree>(select degree from score where sno=109 and cno='3-105')
sql_lover 2010-05-15
  • 打赏
  • 举报
回复

--需求实现
SELECT a.*,b.degree FROM student a, INNER JOIN score b ON a.sno=b.sno inner join course c ON b.cno=c.cno
WHERE b.degree >109 AND c.cno = '3-105'
guoying_ 2010-05-15
  • 打赏
  • 举报
回复
顶起。。。
abcdef1111111 2010-05-15
  • 打赏
  • 举报
回复

select s.sno,s.sex.s.class.s.sname,s.sbirthday
from student s,course c,score sc
where c.cname='3-105' and sc.degree> (select sc.degree from sc,s,c where s.sno=sc.sno and sno='109' and c.cno=s.cno and c.cname='3-105')

我没环境测试,楼主可以试试
  • 打赏
  • 举报
回复
缺少字段说明啊,让我猜?
abcdef1111111 2010-05-15
  • 打赏
  • 举报
回复
楼主给个例子啊,不给例子怎么知道你要什么样的记录啊
steven_0825 2010-05-15
  • 打赏
  • 举报
回复
select t1.* from stutent t1,course t2,score t3 where t1.sno=t3.sno and t2.cno=t3.cno and t3.cno='3-105' and t3.degree>=105
steven_0825 2010-05-15
  • 打赏
  • 举报
回复
select t1.* from stutent t1,course t2,score t3 where t1.sno=t3.sno and t2.cno=t3.cno and t3.cno='3-105' and t3.degree>=95
自己环境试试

27,580

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 应用实例
社区管理员
  • 应用实例社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧