Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

GREATEST

Example

Provide the maximum value from the list of arguments.

SELECT GREATEST(3, 12, 34, 8, 25); 

Definition and Usage

The GREATEST() function yields the highest value from the list of arguments.

Note: Also refer to the LEAST() function.

Syntax

GREATEST(arg1, arg2, arg3, …)

Parameter Values

Parameter

Description

arg1arg2arg3, …

Necessary: Specify the list of arguments for evaluation.

Technical Details

Works in: From MySQL 4.0

More Examples

Example

Provide the maximum value from the list of arguments.

SELECT GREATEST(“w3Schools.com”, “microsoft.com”, “apple.com”);