MySQL SQLLesson 19Free preview
MySQL MAX()
This lesson is part of MySQL · All levels
Summary
The inverse of MIN(), the MAX() function returns the largest value of a column, such as the most expensive price or last date. This function also ignores NULL and can be used for numerical, text, or date types. If you want to get a complete line (not just the maximum value), you need to compile a separate query with a subquery or comparison condition.
Key points
- MAX() returns the largest value on the calculated column
- Just like MIN(), MAX() ignores the value of NULL
- MAX() produces a single value, not the entire data line
- To take the line with the maximum value, use the subquery or ORDER BY... LIMIT 1 clause
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.