MAX
Finds the largest of the values in the argument (ASCII comparison for alphabetic types). Null values are ignored. MAX can be applied to numeric, character, and BINARY data types. MAX is an aggregate function and can also be an aggregate analytic function. See "Aggregate Functions" for details on aggregate functions. See "Analytic Functions" for more information on analytic functions.
SQL syntax
MAX ([ALL | DISTINCT]{Expression | ROWID}) [OVER ([AnalyticClause])]Parameters
MAX has the parameters:
| Parameter | Description |
|---|---|
|
|
Can be any numeric data type or any nonnumeric data type that can be implicitly converted to a numeric data type. |
|
|
Includes any duplicate rows in the argument of an aggregate function. If neither |
|
|
Eliminates duplicate column values from the argument of an aggregate function. |
|
|
TimesTen assigns a unique ID called a rowid to each row stored in a table. The rowid value can be retrieved through the |
|
|
If specified, indicates aggregate analytic function. See "Analytic Functions" for more information on analytic functions. |
Description
-
If
MAXis computed over an empty table in whichGROUP BYis not used,MAXreturnsNULL. -
If
MAXis computed over an empty group or an empty grouped table (GROUP BYis used),MAXreturns nothing. -
The result data type is the same as the source.
-
If you do not use the
AnalyticClausein your query, thenMAXacts as an aggregate function.
Examples
Find the largest salary:
Command> SELECT MAX(salary) "Max Salary" FROM employees; MAX SALARY < 24000 > 1 row found.