distinct —— 去重函数
select distinct depart from teacher;
between ___ 在。。。。之间
select * from student where id between 50 and 70;
in —— 取固定的几个值
select * from student where degree in( 70,60,68);
order by ___排序
order by xx desc 降序
count —— 统计记数
select count(*) from student where class =95031;
如果是让你求最高分或者最大的 可以有两个思路一个是分页 林外一个是使用max 函数
select sno,cno from score where degree=(select max(degree) from score);
select Sno,Cno from Score order by Degree desc limit 0,1;
查询Score表中至少有5名学生选修的并以3开头的课程的平均分数。
select cno as cno_DEC,avg(Degree) from score_s where Cno like '3%' group by Cno having count(*)>=5
网友评论