MIN | Minimum |
---|---|
Oracle Database SQL |
Syntaxe
Min(argument) |
Paramètres
Nom | Description |
---|---|
argument | Ce paramètre permet d'indiquer que le champ devant être comparer. |
Description
Cette fonction retourne la plus basse valeur d'une liste d'argument.
Exemple
Voici un exemple permettant d'afficher les plus petites valeurs en contournant le problème qu'il n'accepte pas une liste de valeurs directement comme paramètre dans la fonction :
- SELECT 'MIN(5,-18)=' AS Text,min(X) AS Result FROM (SELECT 5 AS X FROM DUAL UNION SELECT -18 AS X FROM DUAL) UNION
- SELECT 'MIN(0.25,0.115)=' AS Text, min(X) AS Result FROM (SELECT 0.25 AS X FROM DUAL UNION SELECT 0.115 AS X FROM DUAL) UNION
- SELECT 'MIN(1,2,3,4,5)=' AS Text,min(X) AS Result FROM (SELECT 1 AS X FROM DUAL UNION SELECT 2 AS X FROM DUAL UNION SELECT 3 AS X FROM DUAL UNION SELECT 4 AS X FROM DUAL UNION SELECT 5 AS X FROM DUAL) UNION
- SELECT 'MIN(5,4,3,2,1)=' AS Text, min(X) AS Result FROM (SELECT 5 AS X FROM DUAL UNION SELECT 4 AS X FROM DUAL UNION SELECT 3 AS X FROM DUAL UNION SELECT 2 AS X FROM DUAL UNION SELECT 1 AS X FROM DUAL) UNION
- SELECT 'MIN(24,34,13,72,100,1,34)=' AS Text, min(X) AS Result FROM (SELECT 24 AS X FROM DUAL UNION SELECT 34 AS X FROM DUAL UNION SELECT 13 AS X FROM DUAL UNION SELECT 72 AS X FROM DUAL UNION SELECT 100 AS X FROM DUAL UNION SELECT 1 AS X FROM DUAL UNION SELECT 34 AS X FROM DUAL);
on obtiendra le résultat suivant :
TEXT | RESULT |
MIN(0.25,0.115)= | ,115 |
MIN(1,2,3,4,5)= | 1 |
MIN(24,34,13,72,100,1,34)= | 1 |
MIN(5,-18)= | -18 |
MIN(5,4,3,2,1)= | 1 |
Voir également
Article - Les géants de l'informatique - Oracle
Dernière mise à jour : Lundi, le 11 mai 2015