Aggregate functions boil down a whole bunch of rows into a single summary value. They're the go-to tool for dashboard cards showing things like "Total Users", "Average Sales", or "Total Revenue".
• COUNT() — for counting rows
• AVG() — for calculating the average
• SUM() — for calculating the total
sql
SELECT COUNT(CustomerID) AS TotalCustomers
FROM Customers;You should see
+----------------+ | TotalCustomers | +----------------+ | 4 | +----------------+ What this code does: Counts how many customers are in the Customers table. Important things to notice: COUNT(column) counts values that aren't NULL. If you want to count every row regardless, COUNT(*) is what's typically used.