Skip to main content
SQL โ€ข LESSON 09

COUNT, SUM, AVG

How do we compute summary statistics across an entire table?

Intermediateโฑ 2 Minutesโญ 170 XP
๐Ÿค” THE QUESTION

How do we compute summary statistics across an entire table?

๐Ÿ’ก WHAT IS IT?

Aggregate functions (COUNT, SUM, AVG, MIN, MAX) calculate summaries over sets of values.

๐ŸŽฏ WHAT IS IT USED FOR?

Executive KPIs, financial totals, average customer spend, and headcount reporting.

๐Ÿ’ป EXAMPLE
SELECT
COUNT(*) AS employee_count,
SUM(salary) AS total_salary,
AVG(salary) AS average_salary
FROM employees;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for COUNT, SUM, AVG.

  • โœ“ COUNT()
  • โœ“ SUM()
  • โœ“ AVG()
  • โœ“ Column Aliases (AS)