暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
数据库.pdf
40
5页
0次
2025-04-22
免费下载
1. 查询student表中所有学生的学号,姓名,系别
select 学号,姓名,所在系 from student;
2. 查询student表中所有学生的详细记录
select 学号,姓名,所在系 from student;
3. 查询查询student表中所有学生的学生名单
select 姓名 from student;
4. 查询查询student表中所有学生的姓名和出生年份
select 姓名,2011-年龄 from student;
5. 查询查询student表中所有学生的姓名,年龄,系别并插入’sdop is :’
select 姓名,年龄,'sdop is:' ,所在系 from student;
6. 查询查询student表中前三个学生的学号和姓名
select top 3 学号,姓名 from student;
7. 查询查询student表中学生的姓名和出生年份,用别名表示
select 姓名 sname,2011-年龄 出生年份 from student;
8. 查询SC表中所有选课学生的学号
select distinct 学号 from sc;
9. 列出所有男生在20岁以下的学生的姓名和年龄
select 姓名,年龄 from student where 年龄<20 and 性别='';
10. 列出所有及格学生的学号
select 学号 from sc where 成绩>=60;
11. 列出计算机科学系1990年前出生的所有学生的学号和姓名
select 学号,姓名 from student where 所在系='cs' and 2004-年龄<1990;
12. between…and…写出成绩在70~80之间学生的学号和课程号
select 学号,课程号 from sc where 成绩 between 70 and 80;
13. 查询19891992年出生的学生的姓名和性别
select 姓名,性别 from student where 2011-年龄 between 1989and 1992;
14. 查询成绩不在70~80之间的学生的学号
select distinct 学号 from sc where 成绩 not between 70 and 80;
15. 查询成绩等于70,80,90分的学生的学号,in谓词
select distinct 学号 from sc where 成绩 in (70,80,90);
16. in谓词写出19891987年出生的学生的姓名和学号
select 姓名,学号 from student where 2004-年龄 in (1989,1987);
17.查询学分不是3分和5分的课程的课程号和课程名;
select 课程号,课程名 from course where 学分 not in (3,5);
18. 查询所有2002级学生的所有信息
select * from student where 学号 like '2002%';
19. 查询2002级学生中刘姓和张姓学生的姓名和性别
select 姓名,性别 from student where 学号 like '2002%' and 姓名 like
'[刘张]%';
20. 查询课程名中含有数据这两个字的课程名和学分
select 课程名 ,学分 from course where 课程名 like '%数据%';
21. 查询所有参加了2号课程考试的所有学生的学号和成绩
select 学号,成绩 from sc where 课程号=2 and 成绩is not null;
22. 查询没有参加1号课程考试的学生的学号
Select 学号 from sc where 课程号=1 and 成绩 is null;
23. 查询所有2002级的男生和ma系的学生的学号和姓名
Select 学号,姓名 from student where 所在系='ma' and 学号='2002%';
24. 查询所有学分为4和先行课号为6的课程号和课程名
Select 课程号,课程名 from course where 学分=4 and 先行课=6;
25. 查询所有cs系的所有名单并按性别升序年龄降序排列
Select 姓名,性别,年龄 from student where 所在系='cs' order by 性别,
desc;
26. 查询所有2002级学生的选课考试情况并按课程号升序成绩降序排列
Select * from sc where 学号=’2002%’ order by 课程号,成绩desc;
27. 统计选修2号课程的总人数
Select count (*) from sc where 课程号=2;
28. 统计cs系年龄在20岁以上男生的平均年龄
Select avg (年龄) from student where 所在系='cs' and 年龄>20 and
='';
29. 统计选修了1号课程的最高成绩和最低成绩
Select max(成绩),min(成绩) from sc where 课程号=1;
30. 求各系学生的平均年龄
Select avg(年龄) from student group by 所在系;
31. 求每门课程的平均成绩和最高分
Select avg(成绩) ,max(成绩) from sc group by 课程号;
32. 查询各系男生的总人数及平均年龄
Select count (*),avg(年龄) from student where 所在系 in ('cs' , 'ma' ,
'is') and 性别='' group by 所在系;
33. 查询所有的及格学生各科的总成绩和平均成绩
Select sum (成绩),avg(成绩) from sc where 成绩>=60 group by 课程
;
34. 查询选修了3门以上课程的学生的学号
of 5
免费下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜