第1关:子查询
任务描述
本关任务:求年龄大于'刘东明' 的所有学生的姓名与出生日期。
编程要求
在右侧编辑器补充代码,求年龄大于'刘东明' 的所有学生的姓名与出生日期。 --学生表student
use teachingdb;
/****请在此编写代码,操作完毕之后点击评测******/
/**********Begin**********/
select sname,birthday from student where birthday < (select birthday from student where sname = "刘东明");
/**********End**********/
第2关:子查询-练习
任务描述
本关任务:求未选修任何课程的学生的学号和姓名。
编程要求
根据提示,在右侧编辑器补充代码,求未选修任何课程的学生的学号和姓名。 --学生表student --成绩表score
use teachingdb;
/****请在此编写代码,操作完毕之后点击评测******/
/**********Begin**********/
select sno,sname from student
where sno not in(select sno from score);
/**********End**********/
第3关:子查询-练习一
任务描述
本关任务:求比数学系中全体学生年龄大的学生的姓名和系
编程要求
根据提示,在右侧编辑器补充代码,求比数学系中全体学生年龄大的学生的姓名和系。 --学生表student
use teachingdb;
/****请在此编写代码,操作完毕之后点击评测******/
/**********Begin**********/
select sname,sdept,birthday from student
where birthday < all(select birthday from student where sdept = '数学');
/**********End**********/
第4关:子查询-练习二
任务描述
本关任务:求选修了004课程的学生的姓名和系。
编程要求
根据提示,在右侧编辑器补充代码,求选修了004课程的学生的姓名和系。 --学生表student --成绩表score
use teachingdb;
/****请在此编写代码,操作完毕之后点击评测******/
/**********Begin**********/
select sname,sdept from student
where sno in (select sno from score where cno = '004');
/**********End**********/
第5关:子查询-练习三
任务描述
本关任务:求选修了'刘东明' 同学选修的全部课程的学生的学号。
相关知识
见上一关
编程要求
在右侧窗口补充代码,求选修了'刘东明' 同学选修的全部课程的学生的学号。 --学生表student --成绩表score
use teachingdb;
/****请在此编写代码,操作完毕之后点击评测******/
/**********Begin**********/
select sno from score where cno in(select cno from score,student where score.sno = student.sno and sname = '刘东明') and score.sno!= (select sno from student where sname = '刘东明') group by sno having count(cno)>=2 ;
/**********End**********/
第6关:子查询-练习四
任务描述
本关任务:求选修了全部课程的学生的学号。
相关知识
见上一关
编程要求
根据提示,在右侧编辑器补充代码, 求选修了全部课程的学生的学号。 --学生表student --成绩表score --课程表course
use teachingdb;
/****请在此编写代码,操作完毕之后点击评测******/
/**********Begin**********/
/* select sno from student where not exists(select * from course where not exists(select * from score where score.sno = student.sno and score.cno = course.cno));*/
select sno from score group by sno having count(*)=
(select count(*) from course);
/**********End**********/