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