PostgreSQL SyntaxLesson 22Free preview
PostgreSQL MIN and MAX
This lesson is part of PostgreSQL · All levels
Summary
The MIN and MAX aggregate functions take the smallest and largest values of a column. Both ignore the value of NULL and can be used on numbers, text, dates, or timestamps. When you combine it with GROUP BY, you get extreme values for each data group.
Key points
- MIN returns the smallest value, MAX returns the largest value.
- This aggregate function ignores the value of NULL when counting.
- It applies to numbers, text, dates, and timestamps.
- Combined GROUP BY to get min or max per group.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.