Difference between revisions of "SQL MIN()"

From Lianjapedia
Jump to: navigation, search
m (1 revision: SQL)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Returns a minimum value in a SELECT statement
 
Returns a minimum value in a SELECT statement
 
  
 
==Syntax==
 
==Syntax==
MIN(<expr>)
+
MIN(<expr1> [, <expr2> [, ...]])
 
+
  
 
==See Also==
 
==See Also==
 
[[SQL Aggregate Functions|AGGREGATES]], [[AVG()]], [[COUNT()]], [[SQL MAX()|MAX()]], [[SQL SELECT|SELECT]], [[SUM()]]
 
[[SQL Aggregate Functions|AGGREGATES]], [[AVG()]], [[COUNT()]], [[SQL MAX()|MAX()]], [[SQL SELECT|SELECT]], [[SUM()]]
 
  
 
==Description==
 
==Description==
Returns the minimum value of <expr>. The <expr> can be a numeric or date expression.
+
Returns the minimum value of <expr1> or the list of expressions (list supported from v6.0).
  
 +
The expressions can be of the following data types:
 +
* Numeric
 +
* Date
 +
* Character (from v6.0)
 +
* Currency (from v6.0)
 +
* Datetime (from v6.0)
  
 
==Example==
 
==Example==
 
<code lang="recital">
 
<code lang="recital">
SELECT MIN(sal) Minimum FROM accounts
+
open database southwind
 +
select min(orderdate,requireddate,shippeddate) from orders
 +
select min(companyname) from customers
 
</code>
 
</code>
  
 
==Products==
 
Recital, Recital Server
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:SQL|MIN()]]
 
[[Category:SQL|MIN()]]
 
[[Category:Functions]]
 
[[Category:Functions]]
 +
[[Category:SQL Functions]]
 +
[[Category:Lianja v6.0]]

Latest revision as of 06:37, 23 February 2021

Purpose

Returns a minimum value in a SELECT statement

Syntax

MIN(<expr1> [, <expr2> [, ...]])

See Also

AGGREGATES, AVG(), COUNT(), MAX(), SELECT, SUM()

Description

Returns the minimum value of <expr1> or the list of expressions (list supported from v6.0).

The expressions can be of the following data types:

  • Numeric
  • Date
  • Character (from v6.0)
  • Currency (from v6.0)
  • Datetime (from v6.0)

Example

open database southwind
select min(orderdate,requireddate,shippeddate) from orders
select min(companyname) from customers