MySQL聚合函数
MySQL 大约 620 字count(*)
表示计算总行数,括号中写星与列名,结果是相同的
select count(*) from user;
max(列)
表示求此列的最大值
select max(age) from user;
+----------+
| max(age) |
+----------+
| 40 |
+----------+
1 row in set (0.00 sec)
min(列)
表示求此列的最小值
select min(age) from user where isdelete is not null;
+----------+
| min(age) |
+----------+
| 18 |
+----------+
1 row in set (0.00 sec)
sum(列)
表示求此列的和
select sum(age) from user;
+----------+
| sum(age) |
+----------+
| 281 |
+----------+
1 row in set (0.00 sec)
avg(列)
表示求此列的平均值
select avg(age) from user;
+----------+
| avg(age) |
+----------+
| 25.5455 |
+----------+
1 row in set (0.01 sec)
阅读 438 · 发布于 2019-04-06
————        END        ————
扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
关于我们阅读 1112
-
Android生成随机颜色阅读 584
-
PostgreSQL distinct和distinct on区别阅读 121
-
Nginx配置之解决413错误(Request Entity Too Large)阅读 2027
-
Android ListView条目点击变色阅读 512
-
Git撤销commit和回退到指定commit阅读 48
-
Oracle数据库连接异常ORA-28000: the account is locked阅读 638
-
nginx: [emerg] unknown directive "if($request_uri" in阅读 1772
-
Linux命令之查看进程启动时间阅读 594
-
软考-系统架构设计师:信息系统开发方法阅读 463