Learn SQL Lesson

MIN, MAX, and AVG Together

After learning each aggregate separately, you can combine them to get a compact summary of the spread of your data.

SELECT
  MIN(amount) AS smallest_sale,
  MAX(amount) AS largest_sale,
  AVG(amount) AS average_sale
FROM sales

This gives you the lowest value, highest value, and mean in one query. That makes it a useful “quick profile” of a numeric column.

Practice challenge

Return the smallest sale as smallest_sale, the largest sale as largest_sale, and the average sale amount as average_sale.

Open interactive editor