SQL MAX(), MIN() Functions

SQL MAX() Function

SQL MAX() function return maximum value of expression.

Supported Oracle SQL Version

  • Oracle 8i
  • Oracle 9i
  • Oracle 10g
  • Oracle 11g
  • Oracle 12c
  • Oracle 18c

Syntax

MAX( expression )

Example

Consider following emp_salary is our example table to find maximum salary using SQL MAX function.

SQL> SELECT * from emp_salary;

       NUM NAME                          SALARY
---------- ------------------------- ----------
         2 Max Miller                      2830
         3 Beccaa Moss                     2175
         4 Paul Singh                      5405
         5 Ken Myer                        3390
         6 Jack Evans                      3870

SQL> SELECT MAX(salary) "MAX SALARY" FROM emp_salary;

MAX SALARY
----------
      5405

Run it...   »


SQL MIN() Function

SQL MIN() function return maximum value of expression.

Supported Oracle SQL Version

  • Oracle 8i
  • Oracle 9i
  • Oracle 10g
  • Oracle 11g
  • Oracle 12c
  • Oracle 18c

Syntax

MIN( expression )

Example

Consider following emp_salary is our example table to find minimum salary using SQL MIN function.

SQL> SELECT * from emp_salary;

       NUM NAME                          SALARY
---------- ------------------------- ----------
         2 Max Miller                      2830
         3 Beccaa Moss                     2175
         4 Paul Singh                      5405
         5 Ken Myer                        3390
         6 Jack Evans                      3870

SQL> SELECT MIN(salary) "MIN SALARY" FROM emp_salary;

MAX SALARY
----------
      2175

Run it...   »