欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

MySQL筆記之函數(shù)查詢的使用

 更新時(shí)間:2013年05月03日 17:39:55   作者:  
本篇文章介紹了mysql中函數(shù)查詢的使用。需要的朋友參考下
參考表

count()用來統(tǒng)計(jì)記錄的條數(shù)

復(fù)制代碼 代碼如下:

mysql> select count(*) from score;
mysql> select count(*) from score where stu_id=901;

sum()求和函數(shù)

復(fù)制代碼 代碼如下:

mysql> select sum(grade) from score;
mysql> select id,sum(grade) from score where stu_id=901;

avg()求平均值函數(shù)

復(fù)制代碼 代碼如下:

mysql> select avg(grade) from score where c_name='計(jì)算機(jī)';
mysql> select c_name,avg(grade) from score group by c_name;


max()求最大值函數(shù)
復(fù)制代碼 代碼如下:

mysql> select c_name,max(grade) from score where c_name='英語';
mysql> select c_name,max(grade) from score group by c_name;


min()求最小值函數(shù)
復(fù)制代碼 代碼如下:

mysql> select c_name,min(grade) from score where c_name='中文';
mysql> select c_name,min(grade) from score group by c_name;


Concat拼接函數(shù)
復(fù)制代碼 代碼如下:

mysql> select Concat(c_name, '(', stu_id, ')')
    -> from score order by stu_id;

相關(guān)文章

最新評(píng)論