码迷,mamicode.com
首页 > 数据库 > 详细

SQL(二)

时间:2014-11-27 17:40:51      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:sql   table   rom   br   select   di   计算   count   where   

1.求平均值:AVG()
(1)用法
求平均值:select AVG(列1) from table1;
求大于平均值的列:select * from B where num > (select AVG(num) from B );

2.计算行数:count()
(1)可做如下用法
select count(*) from A; 可计算A表总的行数。
select count(distinct name) from A; 可计算A表中不同name的数目。


SQL(二)

标签:sql   table   rom   br   select   di   计算   count   where   

原文地址:http://www.cnblogs.com/simone-wenwen/p/4126657.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!