MIN
Description
The MIN function is used to find the minimum value from a set of data. This function supports various data types, including numeric types (such as tinyint, smallint, int, bigint, float, double, and decimal), time types (such as date and timestamp), string types (such as char, varchar, and string), and binary types.
Parameter Description
expr
: Comparable data types, including numeric types, time types, and string types.
Return Results
- The return value type is the same as the input parameter type.
- If the
distinct
keyword is set, the minimum value in the deduplicated set is calculated, but it has no effect on the result. null
values are not included in the calculation.
Usage Example
- Find the minimum value from a set of numbers:
- Find the minimum value from a set of time-type data:
- Find the minimum value from a set of string type data:
- Use the
distinct
keyword to find the minimum value from a set of numbers (no effect on the result):
Through the above example, you can see the application of the MIN function in different data types. Please note that null
values do not affect the calculation of the minimum value.