聚合函数

<< Click to Display Table of Contents >>

当前位置:  附录 

聚合函数

Previous pageReturn to chapter overviewNext page

聚合函数

举例

Max

SELECT Max(Sales) as Max_Sales from test_cloud.clqry

SELECT Product, Max(Sales) as Max_Sales from test_cloud.clqry group by Product

Min

SELECT Product, Min(Sales) as Min_Sales from test_cloud.clqry group by Product

Sum

SELECT Sum(Sales) as Sum_Sales from test_cloud.clqry

Count

SELECT Count(Sales) as Count_Sales from test_cloud.clqry

Count Distinct

SELECT Count(Distinct Market) as DistinctCount_Market from test_cloud.clqry

DistinctCount

SELECT Product, DistinctCount(Sales) as DistinctCount_Market from test_cloud.clqry group by Product

Avg

SELECT Product, Avg(Sales) as Avg_Sales from test_cloud.clqry group by Product

Correlation

SELECT Product, Correlation(Sales, Profit) as Correlation_Sales_Profit from test_cloud.clqry group by Product

Covariance

SELECT Product, Covariance(Sales, Profit) as Covariance_Sales_Profit from test_cloud.clqry group by Product

Median

SELECT Product, Median(Sales) as Median_Sales from test_cloud.clqry group by Product

PopulationStandardDeviation

SELECT Product, PopulationStandardDeviation(Sales) as PopulationStandardDeviation_Sales from test_cloud.clqry group by Product

PopulationVariance

SELECT Product, PopulationVariance(Sales) as PopulationVariance_Sales from test_cloud.clqry group by Product

Product

SELECT Product, Product(Sales) as Product_Sales from test_cloud.clqry where ID <= 100 group by Product

PthPercentile

SELECT Product, PthPercentile(Sales, 20) as PthPercentile_Sales from test_cloud.clqry group by Product

Quartile

SELECT Product, Quartile(Sales, 1) as Quartile_Sales from test_cloud.clqry group by Product

Range

SELECT Product, Min(Sales) as Min_Sales, Max(Sales) as Max_Sales, Range(Sales) as Range_Sales from test_cloud.clqry group by Product

StandardDeviation

SELECT Product, StandardDeviation(Sales) as StandardDeviation_Sales from test_cloud.clqry group by Product

StandardError

SELECT Product,StandardError(Sales) as StandardError_Sales from test_cloud.clqry group by Product

SumSQ

SELECT Product,SumSQ(Sales) as SumSQ_Sales from test_cloud.clqry group by Product

SumWT

SELECT Product,SumWT(Sales,Profit) as SumWT_Sales_Profit from test_cloud.clqry group by Product

Variance

SELECT Product, Variance(Sales) as Variance_Sales from test_cloud.clqry group by Product

WeightAVG

SELECT Product, WeightAVG(Sales, Profit) as WeightAvg_Sales_Profit from test_cloud.clqry group by Product

Mode

SELECT Product, Mode_(Sales) as Mode_Sales from test_cloud.clqry group by Product