NOW()
Syntaxe SQL NOW ()
SELECT MAINTENANT() D ' nom_table
Exemple 1
| Prod_id | ProductName | Unité | UnitéPrice |
|---|---|---|---|
| 1 | Jarlsberg | 1000 g | 10.45 |
| 2 | Mascarpone | 1000 g | 32.56 |
| 3 | Gorgonzola | 1000 g | 15.67 |
1 |
SELECT ProductName, UnitéPrice, Maintenant() que PerDate D ' Produits
|
Résultat Requête:
| ProductName | UnitéPrice | PerDate |
|---|---|---|
| Jarlsberg | 10.45 | 07/10/2008 11:25:02 |
| Mascarpone | 32.56 | 07/10/2008 11:25:02 |
| Gorgonzola | 15.67 | 07/10/2008 11:25:02 |
Exemple 2 pour MySQL
Créer une table contenant le NOW () la valeur par défaut.
1 2 3 4 5 |
CRÉER TABLEAU ageent ( id INT PAS NULL PRIMARY KEY AUTO_INCREMENT, des Données VARCHAR(100), créé TIMESTAMP DEFAULT MAINTENANT() ); |
SQL now ()




