查询选修了2号课程的学生姓名。 SELECT Student.Sname FROM Student, SC WHERE Student.Sno=SC.Sno AND SC.Cno=‘2’ 计算以下所示三种查询策略的查询效率: 假设1:有500个学生,2000个选课记录,2号课程选课记录有50个。 假设2:一个内存块装元组:10个Student, 或100个SC; 内存中一次可以存放: 5块Student元组, 1块SC元组和若干块连接结果元组。 假设3:读写速度:20块/秒http://p.ananas.chaoxing.com/star3/origin/cc9cdca089ebb01a03ff459115f9cb9f.png
举一反三
- 在学生选课数据库中,查询选修了课程的学生的学号、姓名,SQL语句可为( ) A: SELECT DISTINCT Sno, Sname FROM Student, SC WHERE Student.Sno = SC.Sno; B: SELECT Sno, Sname FROM Student, SC WHERE Student.Sno = SC.Sno; C: SELECT DISTINCT Sno, DISTINCT Sname FROM Student WHERE Student.Sno IN (SELECT Sno FROM SC); D: SELECT Sno, Sname FROM Student WHERE Student.Sno IN (SELECT DISTINCT Sno FROM SC);
- 查询每个学生的学号、姓名、选修的课程名及成绩,下列()的操作是正确的。 A: select student,sno,sname,grade from student,sc where student.sno=sc.sno and sc.cno=course.cno B: select student,sno,sname,grade from student,sc,cource where student.sno=sc.sno C: select student,sno,sname,grade from student,sc,cource where sc.cno=course.cno D: select student,sno,sname,grade from student,sc,cource where student.sno=sc.sno and sc.cno=course.cno
- 下列SQL语句中,_____________可以在“学生-课程”数据库正确实现“查询选修2号课程且成绩在90分以上的所有学生的学号和姓名”。 A: SELECT Sno, Sname FROM Student, SC WHERE Student.Sno = SC.Sno ANDSC.Cno= ‘2’ AND SC.Grade > 90 B: SELECT Student.Sno, Sname FROM Student, SC WHERE Student.Sno = SC.Sno ANDSC.Cno=‘2’AND SC.Grade > 90 C: SELECT Sno, Sname FROM Student, SC WHERE SC.Cno=‘2’AND SC.Grade > 90 D: SELECT Student.Sno, Sname FROM Student, SC WHERE Student.Sno = SC.Sno AND SC.Grade > 90
- 下列SQL语句中,_________可以在“学生-课程”数据库正确实现“查询所有选修了1号课程的学生姓名”。 A: SELECT SnameFROM Student, SCWHERE SC.Cno= '1' B: SELECT SnameFROM Student, SCWHERE Student.Sno=SC.Sno AND SC.Cno= 1 C: SELECT Sname FROM Student WHERE Sno= (SELECT Sno FROM SC WHERE Cno= '1') D: SELECT Sname FROM Student WHERE EXISTS (SELECT * FROM SC WHERE Sno=Student.Sno AND Cno= '1')
- 中国大学MOOC: 在student和sc表中查找选修002课程号的学生姓名,查询语句如下Select sname from student,sc where student.sno=sc.sno and cno=”002”如果student表有1000条学生记录,SC表有5000条选课记录,符合要求的选课记录有50条,一个块能装10条学生记录或100条选课记录,内存中留出10块用于存放选课记录、留出一块用于存放学生记录。如果按照自然连接-选择-投影的过程执行,如果一个块可以装10条连接结果记录,则在自然连接阶段需要写出的块数是多少?