关系数据库标准语言sql(练习题)

学生选课数据库中表结构如下:
学生(学号,姓名,年龄,性别,所在系);
课程(课程号,课程名,学分,先行课);
选课(学号,课程号,成绩);
在学生选课数据库中运用SQL语言实现下面的数据查询操作。

  1. 求选修了高等数学的学生学号和姓名。
  2. 求张三学生选修成绩在90~95之间的课程名。
  3. 求其他系中比管理系某学生年龄小的学生信息。
  4. 求没有选修C2课程的学生姓名。
  5. 查询每个系的学生人数。
  6. 查询选修课程超过3门的学生学号和选课门数,要求只统计成绩及格的情况。
  7. 查询学生的选修情况,即学号、选课门数,并进行选修情况统计。
  8. 将计算机系学生的选课成绩提高10分。
  9. 删除成绩不及格的选课信息。
    10)将学生表的查询、修改权限赋予用户user1.
1.select  sno.sname  from student
where sno in(select cno   from course	 where cname =’高等数学’)

2.select cname   from course 	
where cno in(select cno  from sc 	
where grade between 90 and 95 and sno in (select sno  from student   
where sname =’张三’))

3.select *   from student   
where sdept != ‘管理系’  and sage < any (select sage from student 	
where sdept=’管理系’ )

4.select sname  from student 
where not exists(select *  from sc   where sno = student.sno  and cno = ’c2’)

5.select sdept , count(sdept)  from student   group by sdept

6.select sno , count(cno)  from sc 	  
where grade >= 60  group by sno   having count(cno) > 3

7.select sno , count(cno)   from sc   group by sno with cube

8.update sc  set grade = grade + 10
where sno in(select sno  from student    where sdept = ‘计算机系’)

9.delete from sc where grade < 60

10..grant update_ select  on table student   to user1
  • 2
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值