1、 查询Student表中的所有记录的Sname、Ssex和Class列。
select t.sname ,t.ssex , t.sclass from student t

2、 查询教师所有的单位,即不重复的Depart列。
select distinct depart from teacher

3、 查询Student表的所有记录。
select * from student;

4、 查询Score表中成绩在60到80之间的所有记录。
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表中成绩为85,86或88的记录。
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 );

浙公网安备 33010602011771号