聚合函数表

函数参数表说明SELECT 示例数值
SUM()[Field Expression]求和:SUM(amount) , :SUM(DISTINCT amount)350, 250
COUNT()[Field Expression]记录行数:COUNT(id),:COUNT(amount), :COUNT(DISTINCT amount)4,4, 2
AVG()[Field Expression]平均数:AVG(amount), :AVG(DISTINCT amount)87.5000, 125.0000
MIN()[Field Expression]最小值:MIN(amount)50
MAX()[Field Expression]最大值:MAX(amount)200
STDDEV_POP()[Field Expression]总体标准差:STDDEV_POP(amount)64.9519052838329
STDDEV_SAMP()[Field Expression]样品标准差:STDDEV_SAMP(amount)75
VAR_POP()[Field Expression]总体方差:VAR_POP(amount)4218.75
VAR_SAMP()[Field Expression]样品方差:VAR_SAMP(amount)5625
JSON_ARRAYAGG()[Field Expression]合并为一个 JSON Array:JSON_ARRAYAGG(amount)[50, 50, 50, 200]
JSON_OBJECTAGG()[Field Expression,Field Expression]合并为一个 JSON Object:JSON_OBJECTAGG(city,price){"上海": 200, "北京": 50}

聚合函数表

函数参数表说明SELECT 示例数值
SUM()[Field Expression]求和:SUM(amount) , :SUM(DISTINCT amount)350, 250
COUNT()[Field Expression]记录行数:COUNT(id),:COUNT(amount), :COUNT(DISTINCT amount)4,4, 2
AVG()[Field Expression]平均数:AVG(amount), :AVG(DISTINCT amount)87.5000, 125.0000
MIN()[Field Expression]最小值:MIN(amount)50
MAX()[Field Expression]最大值:MAX(amount)200
STDDEV_POP()[Field Expression]总体标准差:STDDEV_POP(amount)64.9519052838329
STDDEV_SAMP()[Field Expression]样品标准差:STDDEV_SAMP(amount)75
VAR_POP()[Field Expression]总体方差:VAR_POP(amount)4218.75
VAR_SAMP()[Field Expression]样品方差:VAR_SAMP(amount)5625
JSON_ARRAYAGG()[Field Expression]合并为一个 JSON Array:JSON_ARRAYAGG(amount)[50, 50, 50, 200]
JSON_OBJECTAGG()[Field Expression,Field Expression]合并为一个 JSON Object:JSON_OBJECTAGG(city,price){"上海": 200, "北京": 50}