SQL sreve数据库习题(增删改查)汇总

1、查询信息系年龄大于20岁的学生
select * from student where sdept='信息系' and sage>20
2、查询所有女同学的信息
select * from student where ssex='女'
3、查询学生的姓名、性别和年龄
select sname,ssex,sage from student
4、查询信息系年龄大于20岁的学生,显示学生的姓名和年龄
select sname,sage from student where sdept='信息系'and sage>20
5、查询计算机系的学生姓名和年龄
select sname,sage from student where sdept='计算机系'
6、查询成绩在70-80分之间的学生学号、课程号和成绩
select sno,cno,grade from sc where grade between 70 and 80
7、查询计算机系年龄在18-20的男同学的姓名和年龄
select sname,sage from student where sdept='计算机系'and sage between 18 and 20
8、查询“c01”课程的最高分
select top 1 grade 最高分 from sc where cno='c01' order by grade desc 
9、查询“c01”课程最低的2名学生的学号和成绩
select top 2 sno,grade from sc where cno='c01' order by grade asc
10、查询课程名中包含“计算机”的课程的课程号、课程名和开课学期
select cno,cname,Semester from course where cname like '%计算机%'
11、查询课程名中不包含“数学”的4个字的课程的课程号、课程名和开课学期
select cno,cname,semester from course
  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值