SQL 练习1

  • 查询" 01 "课程比" 02 "课程成绩高的学生的信息及课程分数
SELECT sname,sage,class1,class2 from Student,
	(SELECT t1.sid,t1.class1,t2.class2 from 
		(select sid,cid,score as class1 from sc WHERE cid = '01') as t1,
		(select sid,cid,score as class2 from sc WHERE cid = '02') as t2
	WHERE t1.sid = t2.sid AND t1.class1 >t2.class2) as s WHERE Student.SId = s.sid


  • 查询结果
    image
posted @ 2021-08-18 13:43  弩哥++  阅读(31)  评论(0编辑  收藏  举报