Reference Guide > TDV Support for SQL Functions > TDV-Supported Aggregate Functions > MIN
 
MIN
Given an input set of values, MIN returns the minimum value in that set.
Syntax
MIN (expression)
Remarks
The expression can be numeric, string, or date/time.
The output type is the same as the input type.
If the input is a CHAR, the output is the lowest string in the sorting order.
If the input is date/time, the output is the earliest date/time.
If the input is a literal, the output is the same literal.
If the input is a numeric expression, MIN compares the values in algebraic order; that is, large negative numbers are less than small negative numbers, which are less than zero.
The following table lists the input types that you can use in MIN, and their corresponding output types.
Data Type of expression
Output Type
BIGINT, CHAR, DATE, DECIMAL, DOUBLE, FLOAT, INTEGER, INTERVAL_DAY, INTERVAL_YEAR, LONGVARCHAR, NULL, NUMERIC, REAL, SMALLINT, TIME, TIMESTAMP, TINYINT, VARCHAR
Same as the input type. For example, if the input is of type TINYINT, the output is also of type TINYINT.
Example
SELECT MIN (products.UnitPrice) Expr1,
MIN (orders.OrderDate) Expr2
FROM /shared/examples/ds_inventory/products products, /shared/examples/ds_orders/orders orders