Aggregate Functions
COUNT
Returns the number of rows matching the query criteria.
SELECT COUNT(*) FROM User WHERE CN = 'Administrator'
COUNT
Returns the number of rows matching the query criteria.
SELECT COUNT(AnnualRevenue) FROM User WHERE CN = 'Administrator'
COUNT(DISTINCT)
Returns the number of distinct, non-null field values matching the query criteria.
SELECT COUNT(DISTINCT Id) AS DistinctValues FROM User WHERE CN = 'Administrator'
AVG
Returns the average of the column values.
SELECT CN, AVG(AnnualRevenue) FROM User WHERE CN = 'Administrator' GROUP BY CN
MIN
Returns the minimum column value.
SELECT MIN(AnnualRevenue), CN FROM User WHERE CN = 'Administrator' GROUP BY CN
MAX
Returns the maximum column value.
SELECT CN, MAX(AnnualRevenue) FROM User WHERE CN = 'Administrator' GROUP BY CN
SUM
Returns the total sum of the column values.
SELECT SUM(AnnualRevenue) FROM User WHERE CN = 'Administrator'