UPDATESQL

Unit 2, lesson 8 · MIN, MAX, AVG, SUM

Summarizing a table: MIN, MAX, AVG and SUM

Catalog at a glance

Like COUNT, these functions turn many rows into one number. MIN and MAX find the smallest and largest values, SUM adds them up and AVG averages them. You can put several in one SELECT, and together they summarize the whole table in a single row. Unit 7 shows how to get one summary row for each category or city instead.

Example
SELECT COUNT(*) AS customers,
       MIN(signup_date) AS first_signup
FROM customers;

Your task

Give the team a one-line summary of the catalog: how many products there are, the lowest price, the highest price and the average price rounded to cents.

Tables you will use: products

Try it in your browserFree, no sign-up. Your query is checked as you go.