mysql基础教程:函数查询语句
mysql基础教程:函数查询语句,参考表score,表中包括id,stu_id,c_name,grade等几列,对这个表进行函数查询

count()用来统计记录的条数
mysql> select count(*) from score;
mysql> select count(*) from score where stu_id=901;
sum()求和函数
mysql> select sum(grade) from score;
mysql> select id,sum(grade) from score where stu_id=901;
avg()求平均值函数
mysql> select avg(grade) from score where c_name='计算机';
mysql> select c_name,avg(grade) from score group by c_name;
max()求最大值函数
mysql> select c_name,max(grade) from score where c_name='英语';
mysql> select c_name,max(grade) from score group by c_name;
min()求最小值函数
mysql> select c_name,min(grade) from score where c_name='中文';
mysql> select c_name,min(grade) from score group by c_name;
Concat拼接函数
mysql> select Concat(c_name, '(', stu_id, ')')
-> from score order by stu_id;
-
标签错误:<!-- #Label#
labelId=20160707140604
moduleId=1
classId=12231768634
orderby=2
fields=url,title,u_info
attribute=
datatypeId=22192428132
recordCount=3
pageSize=
<htmlTemplate><dt><img src="/images/index_26${index}.jpg" width="100" height="62" /><a href="$url" title="${title}">${title}</a><span>${api.left(u_info,60)}</span></dt></htmlTemplate>
-->
- 我要参加技术沙龙