MIN
Finds the smallest of the values in the argument (ASCII comparison for alphabetic types). Null values are ignored. MIN
can be applied to numeric, character, and BINARY
data types. See "Aggregate Functions" for more details on aggregate functions. MIN
can also be an aggregate analytic function. See "Analytic Functions" for information.
SQL syntax
MIN ([ALL | DISTINCT]{Expression
|ROWID}) [OVER (AnalyticClause)]
Parameters
MIN
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 the
MIN
function is computed over an empty table in whichGROUP BY
is not used,MIN
returnsNULL
. -
If the
MIN
function is computed over an empty group or an empty grouped table (GROUP BY
is used),MIN
returns nothing. -
The result data type is the same as the source.
-
If you do not use the
AnalyticClause
in your query, thenMIN
acts as an aggregate function.
Examples
Show the smallest salary:
Command> SELECT MIN(salary) "Min Salary" FROM employees; MIN SALARY < 2100 >
Show the earliest hire date:
Command> SELECT MIN(hire_date) "Earliest Hire Date" FROM employees; EARLIEST HIRE DATE < 1987-06-17 00:00:00 > 1 row found.