ID EN
Aggregate Functions

MAX([DISTINCT] expr) [over_clause]

MySQL 8.4 🇮🇩 Bahasa Indonesia

MAX([BERBEDA] expr) [over_clause]

Syntax

MYSQL
SELECT student_name, MIN(test_score), MAX(test_score)
       FROM student
       GROUP BY student_name;

Contoh

Example

Returns the maximum value of expr. MAX() may take a string argument; in such cases, it returns the maximum string value. See Section 10.3.1, “How MySQL Uses Indexes”. The DISTINCT keyword can be used to find the maximum of the distinct values of expr, however, this produces the same result as omitting DISTINCT.

MYSQL
SELECT student_name, MIN(test_score), MAX(test_score)
       FROM student
       GROUP BY student_name;