美文网首页
sql 函数 单词整理

sql 函数 单词整理

作者: 刘程旭 | 来源:发表于2017-12-18 18:24 被阅读0次

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

相关文章

网友评论

      本文标题:sql 函数 单词整理

      本文链接:https://www.haomeiwen.com/subject/amlmwxtx.html