MySQL筆記之函數查詢的應用。本站提示廣大學習愛好者:(MySQL筆記之函數查詢的應用)文章只能為提供參考,不一定能成為您想要的結果。以下是MySQL筆記之函數查詢的應用正文
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;