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