有三个基本表STUDENT(Sno,Sname,Ssex,Sage,Sdept),COURSE(Cno,Cname,Cpno,Ccredit),SC(Sno,Cno,Grade),

2024-11-06 17:21:26
推荐回答(2个)
回答1:

查询选修1号课程和3号课程的学生的学号;
SELECT Sno
FROM SC t
WHERE EXISTS (SELECT 1 FROM SC WHERE Cno=2 and t.Sno = Sno)

询年龄在20到35岁之间的学生的学号,姓名,系别
SELECT Sno, Sname, Sdept
FROM STUDENT
WHERE Sage between 20 and 35

查询每个学生的最高成绩
SELECT STUDENT.Sno, max(SC.Grade)
FROM STUDENT LEFT JOIN SC
ON STUDENT.Sno = SC.Sno
group by STUDENT.Sno

查询计算机系年龄不大于20岁的学生
SELECT *
FROM STUDENT WHERE Sdept = '计算机系' AND age <= 20

回答2:

作业?