当前位置: 移动技术网 > IT编程>数据库>Mysql > 50个SQL语句(MySQL版) 问题一

50个SQL语句(MySQL版) 问题一

2020年05月01日  | 移动技术网IT编程  | 我要评论

--------------------------表结构--------------------------

student(stuid,stuname,stuage,stusex) 学生表

teacher(tid,tname) 教师表

course(cid,cname,c_tid) 课程表

sc(sid,s_cid,score) 成绩表

----------------------------------------------------------

问题一:查询“001”课程比“002”课程成绩高的所有学生的学号

select a.sid from sc a,sc b
where a.sid=b.sid
and a.s_cid='001'
and b.s_cid='002'
and a.score>b.score;

答案仅供参考,不一定完全正确,若发现错误或有更好的,欢迎评论,互相交流,一起成长!!!

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网