min

Returns the lowest value in a column.

Syntax

min(expression)

Parameters

Examples

Usage

  • You can use min with numeric, character, time, and datetime columns, but not with bit columns. With character columns, min finds the lowest value in the sort sequence. min implicitly converts char datatypes to varchar, and unichar datatypes to univarchar, stripping all trailing blanks. min ignores null values. distinct is not available, since it is not meaningful with min.

  • min preserves the trailing zeros in varbinary data.

  • min returns a varbinary datatype from queries on binary data.

  • unichar data is collated according to the default Unicode sort order.

  • The SAP ASE server goes directly to the first qualifying row for min when there is an index on the aggregated column, unless:
    • The expression is not a column.

    • The column is not the first column of an index.

    • There is another aggregate in the query.

    • There is a group by clause.

See also:
  • compute, group by and having clauses, select, where clause in Reference Manual: Commands

  • Transact-SQL Users Guide

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute min.

Related concepts
Expressions
Related reference
avg
max