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

**Topic:** Soql · **Difficulty:** Easy · **Asked at:** TCS, Infosys, LTIMindtree · **Tags:** soql, aggregate

Read it on the site: https://www.forcechallenges.com/interview-questions/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 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
```

---
Source: ForceChallenges · last updated 2026-10-21
