SQL TutorialLesson 17Free preview
SQL Max()
This lesson is part of SQL · All levels
Summary
The MAX function returns the largest value in the summed columns, including numbers, text, and dates. Similar to MIN, this function also ignores the value NULL. The MAX is useful for finding the latest records, the highest prices, or the best achievements.
Key points
- Returns the largest value and ignores the first.
- In the text, MAX returns the final value in the order of collation.
- Can be used with GROUP BY for the maximum value of each group.
- Can't use it directly on WHERE; use subquery.
- MAX(id) is often used to determine the last stored id.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.