1 / 19
文档名称:

sql习题及答案.doc

格式:doc   大小:3,539KB   页数:19页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

sql习题及答案.doc

上传人:Alone-丁丁 2021/8/17 文件大小:3.46 MB

下载得到文件列表

sql习题及答案.doc

相关文档

文档介绍

文档介绍:sql****题及答案
D
22、查询和学号为108的同学同年出生的所有学生的Sno、Sname和Sbirthday列。
23、查询“张旭“教师任课的学生成绩。
24、查询选修某课程的同学人数多于5人的教师姓名。
25、查询95033班和95031班全体学生的记录。
26、查询存在有85分以上成绩的课程Cno.
27、查询出“计算机系“教师所教课程的成绩表。
28、查询“计算机系”与“电子工程系“不同职称的教师的Tname和Prof。
29、查询选修编号为“3-105“课程且成绩至少高于选修编号为“3-245”的同学的Cno、Sno和Degree,并按Degree从高到低次序排序。
30、查询选修编号为“3-105”且成绩高于选修编号为“3-245”课程的同学的Cno、Sno和Degree.
31、查询所有教师和同学的name、sex和birthday.
32、查询所有“女”教师和“女”同学的name、sex和birthday.
33、查询成绩比该课程平均成绩低的同学的成绩表。
34、查询所有任课教师的Tname和Depart.
35 查询所有未讲课的教师的Tname和Depart.
36、查询至少有2名男生的班号。
37、查询Student表中不姓“王”的同学记录。
38、查询Student表中每个学生的姓名和年龄。
39、查询Student表中最大和最小的Sbirthday日期值。
40、以班号和年龄从大到小的顺序查询Student表中的全部记录。
41、查询“男”教师及其所上的课程。
42、查询最高分同学的Sno、Cno和Degree列。
43、查询和“李军”同性别的所有同学的Sname.
44、查询和“李军”同性别并同班的同学Sname.
45、查询所有选修“计算机导论”课程的“男”同学的成绩表
下面是参考答案:
SQL语句练****题参考答案
sname,ssex,class from student;
2.
select distinct(depart) from teacher;
or
select distinct depart from teacher;
* from student;
4.     
select * from score where degree between 60 and 80;  
or 
select * from score where degree>=60 and degree<=80;
5.  
select * from score where degree in (85,86,88); 
or
select * from score where degree=85 or degree=86 or degree=88;
* from student where class=95031 or ssex='女';
* from student order by class desc;
8.       
select * from score order by cno asc,degree desc;
or
select * from score order by cno,degree desc;
9.     
select count(*) from student where class=95031;
or
select count(sno) from student where class=95031;
10. select Sno as '学号',cno as '课程号', degree as '最高分' from score where degree=(select max(degree) from score);
11. select avg(degree) from score where cno='3-105';
12.      
select cno,avg(degree) from score where cno like '3%' group by cno having count(sno)>5;
or      
select cno,avg(degree) from score where cno like '3%' group by cno having count(*)>5;
sno from score group by sno having min(degree)>70 a