第(31)-(35)题使用如下三个数据库表:
学生表:student(学号,姓名,性别,出生日期,院系)
课程表:course(课程号,课程名,学时)
选课成绩表:score(学号,课程号,成绩)
其中出生日期的数据类型为日期型,学时和成绩为数值型,其它均为字符型。
(31)查询“计算机系”学生的学号、姓名、学生所选课程的课程名和成绩,正确的命令是
A)SELECT s.学号,姓名,课程名,成绩
FROM student s, score sc, course c
WHERE s.学号= sc.学号,sc.课程号=c.课程号,院系=’计算机系’
B)SELECT学号,姓名,课程名,成绩
FROM student s, score sc, course c
WHERE s.学号=sc.学号AND sc.课程号=c.课程号AND院系=’计算机系’
C)SELECT s.学号,姓名,课程名,成绩
FROM(student s JOIN score sc ON s.学号=sc.学号).
JOIN course cON sc.课程号=c.课程号
WHERE院系=’计算机系’
D)SELECT学号,姓名,课程名,成绩
FROM(student s JOIN score sc ON s.学号=sc.学号)
JOIN course c ON sc.课程号=c.课程号
WHERE院系=’计算机系’
(32)查询所修课程成绩都大于等于85分的学生的学号和姓名,正确的命令是
A)SELECT学号,姓名FROM student s WHERE NOT EXISTS
(SELECT*FROM score sc WHERE sc.学号=s.学号AND成绩<85)
B)SELECT学号,姓名FROM student s WHERE NOT EXISTS
(SELECT * FROM score sc WHERE sc.学号=s.学号AND成绩>= 85)
C)SELECT学号,姓名FROM student s,score sc
WHERE s.学号=sc.学号AND成绩>= 85
D)SELECT学号,姓名FROM student s,score sc
WHEkE s.学号=sc.学号AND ALL成绩>=85
(33)查询选修课程在5门以上(含5门)的学生的学号、姓名和平均成绩,并按平均成
绩降序排序,正确的命令是
A)SELECT s.学号,姓名,平均成绩FROM student s,score sc
WHEREs.学号=sc.学号
GROUP BY s.学号HAVING COUNT(*)>=5 ORDER BY平均成绩DESC
B)SELECT学号,姓名,AVG(成绩)FROM student s,score sc
WHERE s.学号=sc.学号AND COUNT(*)>=5
GROUP BY学号ORDER BY 3 DESC
C)SELECT s.学号,姓名,AVG(成绩)平均成绩FROM student s,score sc
WHERE s.学号=sc.学号AND COUNT(*)>= 5
GROUP BY s.学号ORDER BY平均成绩DESC
D)SELECT s.学号,姓名,AVG(成绩)平均成绩FROM student s,score sc
WHERE s.学号=sc.学号
GROUP BY s.学号HAVING COUNT(*)>=5 ORDER BY 3 DESC
(34)查询同时选修课程号为C1和C5课程的学生的学号,正确的命令是
A)SELECT学号FROM score sc WHERE课程号=’C 1’AND学号IN
(SELECT学号FROM score sc WHERE课程号=’C5’)
B)SELECT学号FROM score sc WHERE课程号=’C1’AND学号=
(SELECT学号FROM score sc WHERE课程号=’C5’}
C)SELECT学号FROM score sc WHERE课程号=’C 1’ AND课程号=’C5’
D)SELECT学号FROM score sc WHERE课程号=’C 1’OR ’C5’
(35)删除学号为“20091001”且课程号为“C1”的选课记录,正确命令是
A)DELETE FROM score WHERE课程号=’C 1’AND学号=’20091001’
B)DELETE FROM score WHERE课程号=’C 1’OR学号=’20091001’
C)DELETE FORM score WHERE课程号=’C 1’AND学号=’20091001’
D)DELETE score WHERE课程号=’C 1’AND学号=’20091001’