sql 函数 单词整理

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。