1、 查询Student表中的所有记录的SnameSsexClass列。

select t.sname ,t.ssex , t.sclass from student t

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

select distinct depart from teacher

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

select * from student;

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

 

select s.* from score s where s.degree>=60 and s.degree<=80;

 

select s.* from score s where s.degree between 60 and 80;

5、 查询Score表中成绩为858688的记录。

select s.* from score s where s.degree=85 or s.degree=86 or s.degree=88;

 

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

select t.* from student t where t.sclass=95031 or t.ssex='女';

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

 

select * from student order by sno;

 

select * from student order by sno desc;

 

select * from student order by sclass desc;

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

select * from score order by cno, degree desc;

 

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

select count(1) from student where sclass='95031';

10、 查询Score表中的最高分的学生学号和课程号。

 

select max(degree) from score ;

 

select sno,cno from score where degree = (select max(degree) from score );

 

posted on 2016-12-13 14:42  云破月丶  阅读(222)  评论(0编辑  收藏  举报