mysql数据库实验2

3. 按120分制重新计算成绩,显示xs_kc表中学号为081101的学生的成绩信息。

select 学号,课程号,成绩*1.20 as 成绩120
             from xs_kc
             where 学号='081101';

4. 对xscj数据库的xs表只选择专业名和总学分,消除结果集中的重复行。

select distinct 专业名,总学分
             from xs;

5. 对xs表求学生总数。

select count(*) as'学生总数'
             from xs;

6. 对xs表统计备注不为空的学生数目。

select count(备注) as'备注不为空的学生数目'
             from xs;

7. 对xs表统计总学分50分以上的人数。

select count(总学分) as'总学分50分以上的人数'
             from xs
    where 总学分>50;

8. 对xs_kc表求选修101号课程的学生的成绩最高分和最低分。

select max(成绩),min(成绩)
             from xs_kc
             where 课程号='101';

9. 求学号为081101的学生所学课程的总成绩。

select sum(成绩)as'课程总成绩'
             from xs_kc
             where 学号='081101';

10. 求选修101号课程的学生的平均成绩。

select avg(成绩)as'课程101平均成绩'
             from xs_kc
             where 课程号='101';

11. 求选修101号课程的学生的成绩方差。

select variance(成绩)
          from xs_kc
          where 课程号='101';

12. 求选修101号课程的学生的成绩标准差。

select stddev(成绩)
          from xs_kc
          where 课程号='101';

13. 求选修了206号课程的学生的学号。

select group_concat(学号)
              from xs_kc
              where 课程号='101';

14. 对Employees表,查询employeeID为000001的员工地址和电话。

select address,phonenumber
              from employees
              where employees='000001';

15. 查询月收入高于2000元的员工号码。

select employeeid
          from salary
          where income>2000;

16. 查询Employees表中员工的姓名和性别,要求Sex为1时显示男,为0时显示女。

select name,
case
When  sex=1  then '男'
When  sex=0  then '女'
End as sex
from employees;

17. 查询Employees表获得员工总数。

select count(*) as'员工总数'
              from employees;

18. 计算Salary表中员工月收入的平均值。

select avg(income)as'月收入平均值'
             from salary;

19. 获得Employees表中最大的员工号码。

select max(employees)
             from employees;

20. 计算Salary表中所有员工的总支出。

select sum(outcome) as '员工总支出'
              from salary;

  • 6
    点赞
  • 41
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值