Latest web development tutorials

funzione SQL NOW ()

NOW function ()

NOW () restituisce la data corrente e l'ora del sistema.

SQL NOW () sintassi

SELECT NOW() FROM table_name;


Il database demo

In questo tutorial, useremo database di esempio w3big.

Il seguente è un selezionati "siti web" dati della tabella:

+----+--------------+---------------------------+-------+---------+
| id | name         | url                       | alexa | country |
+----+--------------+---------------------------+-------+---------+
| 1  | Google       | https://www.google.cm/    | 1     | USA     |
| 2  | 淘宝          | https://www.taobao.com/   | 13    | CN      |
| 3  | 本教程      | http://www.w3big.com/    | 4689  | CN      |
| 4  | 微博          | http://weibo.com/         | 20    | CN      |
| 5  | Facebook     | https://www.facebook.com/ | 3     | USA     |
| 7  | stackoverflow | http://stackoverflow.com/ |   0 | IND     |
+----+---------------+---------------------------+-------+---------+


SQL NOW () esempi

La seguente istruzione SQL SELECT nome, l'URL e la data odierna dal tavolo "siti web":

Esempi

SELECT name, url, Now() AS date
FROM Websites;

Eseguire SQL sopra i risultati di uscita sono i seguenti: