🔍
👶 Kids📝 Blog About Contact 🚀 Get Started Free

SQL – MIN

Find the minimum (smallest) value in a column using the MIN() aggregate function.

The MIN() function scans a column and returns the single smallest value. It works on numbers (lowest score, cheapest price), dates (earliest date), and even strings (alphabetically first name). It is one of the most used functions in analytics — finding the floor of a dataset is always valuable.

MIN() automatically ignores NULL values in its calculation. If the column is all NULLs, it returns NULL. You can also use MIN() with GROUP BY to find the minimum per group — e.g., the cheapest course per category.

MIN on different types

MIN(score)        -- Lowest number
MIN(enroll_date)  -- Earliest date
MIN(name)         -- First alphabetically

Try It Yourself — Interactive SQL Editor

Edit the query below and click Run Query ▶ to see live results powered by SQLite running directly in your browser.

SQLite – edit & run
Results
← Click Run Query ▶ to see results

Key Points

  • MIN works on numbers, dates, and strings
  • NULL values are ignored by MIN
  • MIN WITHOUT GROUP BY returns one global minimum
  • Pair with GROUP BY to get minimum-per-category

Pro Tip from CodesCompiler: The best way to learn SQL is to break things intentionally — modify the query above, change the WHERE conditions, try different columns. Every error teaches you something the docs cannot.

In the next lesson, we continue exploring SQL’s powerful feature set to build your database mastery.