aggregate

MIN

Returns the smallest non-NULL value in a group, using natural ordering for the column's data type. Works for numbers, dates, and strings (lexicographic).

MIN(expression)

Parameters / Modifiers

Parameter Purpose
OVER (...) Windowed minimum across a partition
FILTER (WHERE ...) Postgres: conditional minimum
COLLATE Force a specific collation for string comparisons

Examples

SELECT MIN(price) FROM products;

Cheapest product price in the table

SELECT MIN(created_at) FROM users WHERE country = 'IN';

Earliest signup date among Indian users

SELECT category, MIN(price) FROM products GROUP BY category;

Cheapest item per category

SELECT MIN(name) FROM users;

Alphabetically first name (locale/collation dependent)

Dialect notes / Gotcha

String comparisons obey the column's collation — MIN on a case-insensitive collation may differ from a binary one. NULLs are ignored, so MIN over all-NULL groups returns NULL.

Related functions

← All SQL functions · SQL cheat sheet · Window functions · PostgreSQL cheat sheet