MIN and MAX find the smallest and largest
MIN hands back the lowest value in a column and MAX the highest — the cheapest price, the latest date. Each gives back that one value on its own. It does not tell you which row the value came from; finding that row takes a different query.
A tiny example
In plain English: Tell me the lowest price on the menu.
SELECT MIN(price) AS cheapest
FROM menu_items;Query result
| cheapest |
|---|
| 3 |
3 is the lowest price on the menu — MIN gives the value, not which item it belongs to.
Common questions
- What do MIN and MAX do with NULL values?
- They skip them. MIN and MAX only look at rows where the column has a value, so a NULL never becomes the answer.
- Can MIN and MAX work on text or dates?
- Yes. On text they return the alphabetically first or last value, and on dates the earliest or latest. They are not just for numbers.
Related SQL lessons
Ready for a break?
A fresh, bite-sized SQL puzzle waits every morning. Tap tiles, see real results. No terminal, no setup, no timers.
Try today's free SQL puzzle