-
第9课 汇总数据
- 9.1 聚集函数
- AVG()平均值
- COUNT()返回某列行数
- MAX()返回某列最大值
- MIN()返回某列最小值
- SUM返回某列值之和
- 9.1.1 AVG( )函数
- SELECT AVG(prod_price) AS avg_price
- FROM products;
- 9.1.2 COUNT( )函数
- SELECT COUNT(cust_email) AS num_cust
- FROM Customers;
- 9.1.3 MAX( )函数
- SELECT MAX(prod_price) AS max_price
- FROM Products;
- 9.1.4 MIN( )函数
- SELECT MIN(prod_price) AS min_price
- FROM products;
- 9.1.5 SUM( )函数
- /*SELECT SUM(quantity) AS items_ordered
- FROM orderitems
- WHERE order_num = 20005;*/
- ---------------------------------------
- SELECT SUM(item_price*quantity) AS total_price
- FROM orderitems
- WHERE order_num = 20005;
- 9.2 聚集不同值
- SELECT AVG(DISTINCT prod_price) AS avg_price
- FROM products
- WHERE vend_id = 'DLL01';
- 9.3 组合聚集函数
- SELECT COUNT(*) AS num_items,
- MIN(prod_price) AS price_min,
- MAX(prod_price) AS price_max,
- AVG(prod_price) AS price_avg
- FROM products;
- 9.4 小结
-
相关阅读:
【AT1219】歴史の研究(回滚莫队模板)
【洛谷4245】【模板】任意模数多项式乘法
同余与逆元
线性推逆元
大整数类型!
浅谈扩展欧几里得定理(附裴蜀定理)
二进制串题解(国际考试备用题)
String 的成员函数
关于快速幂
string的赋值
-
原文地址:https://www.cnblogs.com/xuxaut-558/p/10285732.html
Copyright © 2020-2023
润新知