码迷,mamicode.com
首页 > 数据库 > 详细

10-11数据库练习

时间:2016-10-11 21:30:36      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:

1、 查询Student表中的所有记录的Sname、Ssex和sClass列。

select Sname,Ssex,sClass from studeng

 

2、 查询教师所有的单位即不重复的Depart列。

 

 

3、 查询Student表的所有记录。

select * from studeng

 

4、 查询Score表中成绩在60到80之间的所有记录。

select * from Score where degree >= 60 and degree <= 80

 

5、 查询Score表中成绩为85,86或88的记录。

select * from Score where degree = 85 or degree = 86 or degree = 88

 

6、 查询Student表中“95031”班或性别为“女”的同学记录。

select * from studeng where sclass = 95031 or ssex = ‘女‘

 

7、 以Class降序查询Student表的所有记录。

select * from studeng t order by sclass desc

 

8、 以Cno升序、Degree降序查询Score表的所有记录。

select * from Score t order by Cno , Degree desc

 

9、 查询“95031”班的学生人数。

 

 

10、 查询Score表中的最高分的学生学号和课程号。(子查询或者排序)

select * from Score t order by degree desc

 

11、 查询每门课的平均成绩。

 

 

12、查询Score表中至少有5名学生选修的并以3开头的课程的平均分数。

 

 

13、查询分数大于70,小于90的Sno列。

select sno from Score t where degree >=70 and degree <=90

 

14、查询所有学生的Sname、Cno和Degree列。

 

 

15、查询所有学生的Sno、Cname和Degree列。

 

 

16、查询所有学生的Sname、Cname和Degree列。

 

10-11数据库练习

标签:

原文地址:http://www.cnblogs.com/jingfengling/p/5950550.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!