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