Development questions

What are all the Aggregate Functions available in SOQL (COUNT(), COUNT(Id), COUNT_DISTINCT(), SUM(), AVG(), MIN(), MAX())?

DevelopmentEasyTCSInfosysLTIMindtree
  • COUNT(): number of rows (no field, returns an integer directly)
  • COUNT(fieldName): count of non-null values
  • COUNT_DISTINCT(fieldName): count of unique non-null values
  • SUM(), 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