What are all the Aggregate Functions available in SOQL (COUNT(), COUNT(Id), COUNT_DISTINCT(), SUM(), AVG(), MIN(), MAX())?
Answer
COUNT(): number of rows (no field, returns an integer directly)COUNT(fieldName): count of non-null valuesCOUNT_DISTINCT(fieldName): count of unique non-null valuesSUM(),AVG(),MIN(),MAX(): numeric/date aggregates
soql
SELECT COUNT(Id), SUM(Amount), AVG(Amount), MIN(Amount), MAX(Amount) FROM Opportunity
SELECT COUNT_DISTINCT(Industry) FROM Account
soqlaggregate