SQL · Pattern 4 — Aggregation
MIN / MAX
MIN() and MAX() return the smallest and largest value in a column.
Source data — Pattern 4: Aggregation
All queries run against the shared employees table (see schema.sql) — no new columns needed for this pattern.

What it does
MIN() and MAX() return the smallest and largest value in a column. They work on numbers, dates, and even text (alphabetical order) — and like the other aggregates, they collapse the whole result set into one row unless paired with GROUP BY (Pattern 5).
Problem
Find the highest and lowest salary.
SELECT MAX(salary) AS highest_salary,
MIN(salary) AS lowest_salary
FROM employees;
Result
