FirebirdSQL logo

MAX Examples

SELECT
  dept_no,
  MAX(salary)
FROM employee
GROUP BY dept_no

MIN()

Minimum

Result type

Returns a result of the same data type the input expression.

Syntax
MIN ([ALL | DISTINCT] <expr>)
Table 1. MIN Function Parameters
Parameter Description

expr

Expression.It may contain a table column, a constant, a variable, an expression, a non-aggregate function or a UDF.Aggregate functions are not allowed as expressions.

MIN returns the minimum non-NULL element in the result set.

  • If the group is empty or contains only NULLs, the result is NULL.

  • If the input argument is a string, the function will return the value that will be sorted first if COLLATE is used.

  • This function fully supports text BLOBs of any size and character set.

Note

The DISTINCT parameter makes no sense if used with MIN() as it doesn’t change the result;it is implemented only for compliance with the standard.