MaxCompute SQL函式詳解 ODPS SQL函式詳解---之聚合相關函式
MaxCompute/ODPS SQL函式數字聚合函式
- count 函式-計算資料條數
sql:
select COUNT(*) as 計數值
from test_table;
函式作用:計算test_table表的資料條數
- SUM 函式-求和
sql:
select SUM (num) as 求和
from test_table;
函式作用:計算test_table表num欄位的求和值
- MAX函式-最大值
sql:
select MAX(num) as 最大值
from test_table;
函式作用:計算test_table表num欄位的最大值
- MIN函式-最小值
sql:
select MIN(num) as 最小值
from test_table;
函式作用:計算test_table表num欄位的最小值
- MEDIAN函式-中位數
sql:
select MEDIAN(num) as 中位數
from test_table;
函式作用:計算test_table表num欄位值的中位數
- AVG 函式-平均值
sql:
select AVG(num) as 平均值
from test_table;
函式作用:計算test_table表num欄位值的平均值
- STDDEV 函式-總體標準差
sql:
select STDDEV(num) as 總體標準差
from test_table;
函式作用:計算test_table表num欄位值的總體標準差
- STDDEV_SAMP 函式-樣本標準差
sql:
select STDDEV_SAMP(num) as 樣本標準差
from test_table;
函式作用:計算test_table表num欄位值的樣本標準差
舉例:
計算COUNT(*) as 計數值,
SUM(mun) as 求和,
MAX(mun) as 最大值,
MIN(mun) as 最小值,
MEDIAN(mun) as 中位數,
AVG(mun) as 平均值,
STDDEV(mun) as 總體標準差,
STDDEV_SAMP(mun) as 樣本標準差

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/423401.html
標籤:其他
上一篇:報錯 【hiveserver2】hive --service hiveserver2 報錯 GC overhead limit exceeded
