集計関数
COUNT
クエリ条件に一致する行の数を返します。
SELECT COUNT(*) FROM [CData].[Employee Management].Leave_Types WHERE Leave_Type = 'Sick'
COUNT(DISTINCT)
クエリ条件に一致する、null 以外の個別のフィールド値の数を返します。
SELECT COUNT(DISTINCT ID) AS DistinctValues FROM [CData].[Employee Management].Leave_Types WHERE Leave_Type = 'Sick'
AVG
カラムの値の平均を返します。
SELECT Leave_Type, AVG(AnnualRevenue) FROM [CData].[Employee Management].Leave_Types WHERE Leave_Type = 'Sick' GROUP BY Leave_Type
MIN
カラムの値の最小値を返します。
SELECT MIN(AnnualRevenue), Leave_Type FROM [CData].[Employee Management].Leave_Types WHERE Leave_Type = 'Sick' GROUP BY Leave_Type
MAX
カラムの値の最大値を返します。
SELECT Leave_Type, MAX(AnnualRevenue) FROM [CData].[Employee Management].Leave_Types WHERE Leave_Type = 'Sick' GROUP BY Leave_Type
SUM
カラムの値の合計を返します。
SELECT SUM(AnnualRevenue) FROM [CData].[Employee Management].Leave_Types WHERE Leave_Type = 'Sick'