MIN() in MySQL — How It Works
What the MySQL MIN() function does, with an example.
Published October 20, 2026
MIN() returns the smallest value in a column. It works on numbers, strings and dates, and ignores NULL.
How it works
Combine with GROUP BY for per-group minimums.
Try it in MySQL
SELECT MIN(price) FROM products
4.99
SELECT MIN(created_at) FROM users
2024-01-03 09:12:00
SELECT category, MIN(price) FROM products GROUP BY category
per category
Practical examples
Example 1
SELECT MIN(price) FROM products;
-- 4.99Example 2
SELECT MIN(created_at) FROM users;
-- 2024-01-03 09:12:00Example 3
SELECT category, MIN(price) FROM products GROUP BY category;
-- per categoryUse it in a real query
SELECT MIN(price) FROM products;Common mistakes
- Selecting other columns alongside MIN and getting arbitrary rows.
- Using it on strings and expecting numeric order.
- Empty tables returning NULL.
Key takeaways
- MIN() in one line: MIN() returns the smallest value in a column.
- Try queries in a test database first.
- Check NULL handling and data types.
FAQ
Row with the minimum?
ORDER BY col ASC LIMIT 1.
Does MIN() work in other databases?
Most have an equivalent, but names and syntax vary between MySQL, PostgreSQL, SQL Server and SQLite.