学校学生选修课程,经简化得到的数据项列出如下:
学生号s CHAR(6),学生姓名xm CHAR(8),课程号c CHAR(3),课程名称cname CHAR (20),成绩 grade NUMBER。
并确定以学生(student)信息,课程(course)信息实体,它们通过“选课”(sc)联系起来。
数据库概念设计的只包含主键属性的简化E-R图如下:
要求;
(1)设计数据库的逻辑结构设计:给出相应的表名、表的属性名(数据类型可省)、主键。
(2)给出选修了课程号为'C02'的学生姓名的SQL查询语句。
(3)给出三种等价的关系代数表达式来完成上述查询。并从查询优化的角度说明哪一种关系代数表达式查询效率最高?并说明在此查询优化的基础上,对哪些字段建立索引可提高查询效率?
第1题:
已知选课关系SC(S# char(8), C# char(8), GRADE integer),S#学号,C#课程号,GRADE成绩。检索选修4门以上课程的学生总成绩(不统计不及格的课程),并要求按总成绩的降序排列出来。正确的SELECT语句是_________。
A.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY Sgrade DESC
B.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY Sgrade
C.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 HAVING COUNT(*)>=4 GROUP BY S# ORDER BY Sgrade DESC
D.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 and COUNT(*)>=4 GROUP B
第2题:
已知选课关系SC(S# char(8), C# char(8), GRADE integer),S#学号,C#课程号,GRADE成绩。检索选修4门以上课程的学生总成绩(不统计不及格的课程),并要求按总成绩的降序排列出来。正确的SELECT语句是_____。
A.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 and COUNT(*)>=4 GROUP BY S# ORDER BY Sgrade DESC
B.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 HAVING COUNT(*)>=4 GROUP BY S# ORDER BY Sgrade DESC
C.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY Sgrade
D.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)&g
第3题:
已知选课关系SC(S# char(8), C# char(8), GRADE integer),S#学号,C#课程号,GRADE成绩。检索选修4门以上课程的学生总成绩(不统计不及格的课程),并要求按总成绩的降序排列出来。正确的SELECT语句是()。
A.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY Sgrade DESC;
B.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 and COUNT(*)>=4 GROUP BY S# ORDER BY Sgrade DESC;
C.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY Sgrade;
D.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 HAVING COUNT(*)>=4 GROU
第4题:
9、已知选课关系SC(S# char(8), C# char(8), GRADE integer),S#学号,C#课程号,GRADE成绩。检索选修4门以上课程的学生总成绩(不统计不及格的课程),并要求按总成绩的降序排列出来。正确的SELECT语句是_________。
A.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY Sgrade DESC
B.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY Sgrade
C.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 HAVING COUNT(*)>=4 GROUP BY S# ORDER BY Sgrade DESC
D.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 and COUNT(*)>=4 GROUP B
第5题:
9、已知选课关系SC(S# char(8), C# char(8), GRADE integer),S#学号,C#课程号,GRADE成绩。检索选修4门以上课程的学生总成绩(不统计不及格的课程),并要求按总成绩的降序排列出来。正确的SELECT语句是_________。
A.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY Sgrade DESC
B.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY Sgrade
C.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 HAVING COUNT(*)>=4 GROUP BY S# ORDER BY Sgrade DESC
D.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 and COUNT(*)>=4 GROUP B