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
MAX
is computed over an empty table in whichGROUP BY
is not used,MAX
returnsNULL
. -
If
MAX
is computed over an empty group or an empty grouped table (GROUP BY
is used),MAX
returns nothing. -
The result data type is the same as the source.
-
If you do not use the
AnalyticClause
in your query, thenMAX
acts as an aggregate function.
Examples
Find the largest salary:
Command> SELECT MAX(salary) "Max Salary" FROM employees; MAX SALARY < 24000 > 1 row found.