SQL MIN () Fonction
La fonction min ()
Le MIN () renvoie la plus petite valeur de la colonne sélectionnée.
SQL MIN () Syntaxe
SELECT MIN(column_name) FROM table_name
SQL MIN () Exemple
Nous avons ce qui suit "Commandes" table:
| O_ID | OrderDate | OrderPrice | Client |
|---|---|---|---|
| 1 | 12/11/2008 | 1000 | Hansen |
| 2 | 23/10/2008 | 1600 | Nilsen |
| 3 | 02/09/2008 | 700 | Hansen |
| 4 | 03/09/2008 | 300 | Hansen |
| 5 | 30/08/2008 | 2000 | Jensen |
| 6 | 04/10/2008 | 100 | Nilsen |
Maintenant, nous voulons trouver la plus petite valeur de la "OrderPrice" colonne.
Nous utilisons l'instruction SQL suivante:
SELECT MIN(OrderPrice) AS SmallestOrderPrice FROM Orders
L'ensemble de résultats se présente comme suit:
| SmallestOrderPrice |
|---|
| 100 |

0 commentaires:
Post a Comment
HELLO VISITORS THANKS FOR YOUR VISIT AND COMMENT