桂林航天工业学院学生实验报告
实验三
实验名称 SELECT 查询 实验目的 熟悉SELECT查询语句的使用 实验内容 连接查询和嵌套查询 实验日期 2024.10.10 实验步骤及结论 1、查询选修3号课程且成绩在85分以上的所有学生的学号、姓名、所在院系。 SELECT Student.*,SC.* FROM Student,SC WHERE Student.Sno=Sc.sno AND SC.Cno='3' AND SC.Grade>85; 2、查询计算机系每个学生的学号、姓名、选修课程名及成绩。 select student.sno,sname,course.cname,sc.grade from student,course,sc where student.sno=sc.sno and sc.cno=course.cno and(student.sdept='cs') 3、查询与“刘晨”在同一个系学习的学生。 SELECT Sno,sname,sdept FROM student where sdept in (select sdept from student where sname='刘晨') 4、查询非计算机科学系中比计算机科学系任意一个学生年龄小的学生姓名和年龄。 select sname,sage 1
from student where sage
(SELECT * FROM SC WHERE Sno=Student.Sno AND Cno='1'); 9、查询至少选修了学生201215122选修的全部课程的学生号码。 SELECT DISTINCT Sno FROM SC SCX WHERE NOT EXISTS (SELECT* FROM SC SCY WHERE SCY.Sno='201215122'AND NOT EXISTS (SELECT * FROM SC SCZ WHERE SCZ.Sno=SCX.Sno AND SCZ.Cno=SCY.Cno))
3
数据库实验报告(3)



