1.avg 平均值 select avg(id) from student 找出大于平均值的:select * from student where id>(select avg(id) from student) 2.count 返回行数 select count(*) from student 3.max 一个列中的最大值 select max(id) from student 4.min 一个列中的最小值 select min(id) from student 5.sum 一个列数值总和 select sum(id) from student 6.group by 分组(一定要和聚合函数一起使用) select sum(id) from student group by name 7.having (合计函数无法与where一起使用,所以使用having) select sum(id) from student group by name having count(*)>10 8.mid 从文本中截取字符 mysql :select mid(name,1,2) from student 9.now() 获取当前时间 mysql :select now() from student |
|
来自: 昵称19003105 > 《SQL》