查询问题:
1、查询Student表中的所有记录的Sname、Ssex和Class列。
select Sname,Ssex,Class
from Student;
2、查询教师所有的单位即不重复的Depart列。
select distinct Depart
from Teacher;
3、查询Score表中成绩在60到80之间的所有记录。
select Sno,Cno,Degree
from Score
where Degree between 60 and 80;
4、查询Score表中成绩为85,86或88的记录。
select Sno,Cno,Degree
from Score
where Degree in('85','86','88');
5、Student表中“95031”班或性别为“女”的同学记录。
select Sno,Sname,Ssex,Sbirthday,class
from Student
where class='95031' or Ssex='nv';
6、以Class降序查询Student表的所有记录。
select Sno,Sname,Ssex,Sbirthday,class
from Student
order by Class desc;
7、以Cno升序、Degree降序查询Score表的所有记录。
select *
from Score
order by Cno,Degree desc;
8、查询“95031”班的学生人数。
select count(class)
from Student
where class='95031';
9、查询Score表中的最高分的学生学号和课程号。
select MAX(Degree),Sno,Cno
from Score;
10、查询每门课的平均成绩。
select Cno,count(Degree),avg(Degree)
from Score
group by Cno;