Lesson 2.1 · Pro

COUNT, SUM, AVG: summarise a table

Turn many rows into one number, and know exactly how each function treats NULL.

In this lesson

  1. Count rows with COUNT(*)
  2. COUNT(column) skips NULLs
  3. Count different values with COUNT(DISTINCT)
  4. SUM, AVG, MIN and MAX
  5. SUM of nothing is NULL, not 0
  6. AVG skips NULLs too