亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

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

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

count()用來統(tǒng)計記錄的條數(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='計算機';
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)文章

最新評論