找回密码
 立即注册
dcs_29mqh +好友
这个人很懒什么都没写
听众
1
主题
0
金钱
12
个人名片
  • 未填写地址
  • 这家伙很懒什么都没写
粉丝关注
还没有人关注TA
添加表情

0509练习-dcs29-毛庆华

已有 182 次阅读2021-5-9 20:04

六、数据库单表练习题

有这样一个表:

 

作业:完成时间2021-5-9

1、查询1832班的成绩信息

select * from score1 where class=1832;

2,查询1833班,语文成绩大于80小于90的成绩信息

select * from score1 where class=1833 and Chinese>80 and Chinese<90;

3,查询学生表中510行的数据

select * from score1 where limit 4,6;

4,显示1832班英语成绩为98,数学成绩为77的姓名与学号,

select name,sid,English,math from score1 where English=98 and math=77;

5,查询出1832班成绩并且按语文成绩排序(降序)

 select * from score1 where class=1832 order by Chinese desc;

6,查询1833班与1832班,语文成绩与数学成绩都小于80的姓名。

 select name,Chinese,math from score1 where Chinese<80 and math<80;

7,查询出没有参加语文考试的学生姓名和班级名称。

 select name,class,Chinese from score1 where Chinese is null;

8,求出班上语文成绩不及格的学生姓名

 select name,Chinese from score1 where Chinese<60;

9,求出每个班的数学平均成绩

select class,avg(math) from score1 group by class;

10、求出每个班级语文成绩总分 --涉及到每个的时候都需要分组

select class,sum(Chinese) from score1 group by class;

11、将语文成绩不及格的学生成绩改为60

update score1 set Chinese=60 where Chinese<60;

12、三科分数都大于70分的人名和年纪

select name,age,Chinese,math,English from score1 where Chinese>70 and math>70 and English >70;

13、求出英语分数高于70且其它任何一科目大于60分的人和班级

select name,age,Chinese,math,English from score1 where English>70 and math>60 and Chinese>60;

14、统计每个班的人数

select class,count(class) from score1 group by class;

15、求每个班数学成绩大于80的人数

 select class,count(class) from score1 where math>80 group by class;

16、求出每个班英语成绩最高的那个人的姓名和班级名称 --每个班英语成绩

最高

17、给student表增加3个字段(数据类型及长度自定义,建议要合理),

  alter table score1 add(level varchar(10),month varchar(20) default 'May',address varchar(40));

18、创建一个dcs”远程用户授予该用户只有查询的权限

全部作者的其他最新日志

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 立即注册