学校学生选修课程,经简化得到的数据项列出如下:学生号s CHAR(6),学生姓名xm CHAR(8),课程号c CHAR(3),课程名称cname CHAR (20),成绩 grade NUMBER。并确定以学生(student)信息,课程(course)信息实体,它们通过“选课”(sc)联系起来。数据库概念设计的只包含主键属性的简化E-R图如下:要求;(1)设计数据库的逻辑结构设计:给出相应的表名、表的属性名(数据类型可省)、主键。(2)给出选修了课程号为'C02'的学生姓名的SQL查询语句。(3)给出三种等价的关系代数表达式来完成上述查询。并从查询优化的角度说明哪一种关系代数表达式查询效率最高?并说明在此查询优化的基础上,对哪些字段建立索引可提高查询效率?
学校学生选修课程,经简化得到的数据项列出如下:
学生号s CHAR(6),学生姓名xm CHAR(8),课程号c CHAR(3),课程名称cname CHAR (20),成绩 grade NUMBER。
并确定以学生(student)信息,课程(course)信息实体,它们通过“选课”(sc)联系起来。
数据库概念设计的只包含主键属性的简化E-R图如下:
要求;
(1)设计数据库的逻辑结构设计:给出相应的表名、表的属性名(数据类型可省)、主键。
(2)给出选修了课程号为'C02'的学生姓名的SQL查询语句。
(3)给出三种等价的关系代数表达式来完成上述查询。并从查询优化的角度说明哪一种关系代数表达式查询效率最高?并说明在此查询优化的基础上,对哪些字段建立索引可提高查询效率?
相关考题:
教学管理数据库创建了如下表:CTEATE TABLE student(学号 CHAR(5) not null unique,姓名 CHAR(8),性别 CHAR(2),出生日期 DATETIME,班号 CHAR(5))CREATE TABLE course(课程号 CHAR(5) not null unique,课程名 CHAR(20),任课教师编号 CHAR(5))CREATE TABLE score(学号 CHAR(5),课程号 CHAR(5),分数 INT)请写出完成检索score表中最高分与最低分之差大于12的课程号的SQL语句。
教学管理数据库创建了如下表:CTEATE TABLE student(学号 CHAR(5) not null unique,姓名 CHAR(8),性别 CHAR(2),出生日期 DATETIME,班号 CHAR(5))CREATE TABLE score(学号 CHAR(5),课程号 CHAR(5),分数 INT)请写出完成以下任务需要的SQL语句:查询所有学生的姓名、课程号和分数列。
教学管理数据库创建了如下四张表:CTEATE TABLE student(学号 CHAR(5) not null unique,姓名 CHAR(8),性别 CHAR(2),出生日期 DATETIME,班号 CHAR(5))CTEATE TABLE teacher(教师编号 CHAR(5) not null unique,姓名 CHAR(8),性别 CHAR(2),出生日期 DATETIME,职称 CHAR(6),系别 CHAR(10))CREATE TABLE course(课程号 CHAR(5) not null unique,课程名 CHAR(20),任课教师编号 CHAR(5))CREATE TABLE score(学号 CHAR(5),课程号 CHAR(5),分数 INT)请写出完成以下任务需要的SQL语句: 1) 检索score表中成绩在60-80之间的所有记录。2) 检索student表中所有姓王的学生记录。
已知关系模式:S (SNO,SNAME) 学生关系。SNO 为学号,SNAME 为姓名C (CNO,CNAME,CTEACHER) 课程关系。CNO 为课程号,CNAME 为课程名,CTEACHER 为任课教师SC(SNO,CNO,SCGRADE) 选课关系。SCGRADE 为成绩要求实现如下5个处理:1. 找出没有选修过“李明”老师讲授课程的所有学生姓名2. 列出有二门以上(含两门)不及格课程的学生姓名及其平均成绩3. 列出既学过“1”号课程,又学过“2”号课程的所有学生姓名4. 列出“1”号课成绩比“2”号同学该门课成绩高的所有学生的学号5. 列出“1”号课成绩比“2”号课成绩高的所有学生的学号及其“1”号课和“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 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY Sgrade DESCB.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY SgradeC.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 HAVING COUNT(*)>=4 GROUP BY S# ORDER BY Sgrade DESCD.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 and COUNT(*)>=4 GROUP B
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 DESCB.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY SgradeC.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 HAVING COUNT(*)>=4 GROUP BY S# ORDER BY Sgrade DESCD.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 and COUNT(*)>=4 GROUP B
已知选课关系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 DESCB.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 HAVING COUNT(*)>=4 GROUP BY S# ORDER BY Sgrade DESCC.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)>=4 ORDER BY SgradeD.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE>=60 GROUP BY S# HAVING COUNT(*)g
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 DESCB.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE=60 GROUP BY S# HAVING COUNT(*)=4 ORDER BY SgradeC.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE=60 HAVING COUNT(*)=4 GROUP BY S# ORDER BY Sgrade DESCD.SELECT S#,SUM(GRADE) as Sgrade FROM SC WHERE GRADE=60 and COUNT(*)=4 GROUP B
已知选课关系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