您的位置:首页 > 博客中心 > 数据库 >

SQL(二)

时间:2022-03-14 03:05

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的数目。


热门排行

今日推荐

热门手游