mysql输入select now()_mysql 中select now(); 是怎么执行的?没有指定FROM tablename?
mysql中 使用指令select now();就會獲取當(dāng)前時間日期。為什么沒有from table,這種指令也能執(zhí)行?
不指定表的時候,應(yīng)該如何理解select呢?
回復(fù)內(nèi)容:
mysql中 使用指令select now();就會獲取當(dāng)前時間日期。為什么沒有from table,這種指令也能執(zhí)行?
不指定表的時候,應(yīng)該如何理解select呢?
參考文檔
now()是mysql內(nèi)置函數(shù),返回當(dāng)前時間,而select可以不從表中獲取數(shù)據(jù)。即使使用select now() from table,這個table也會被忽略,因為now()用不上
SELECT can also be used to retrieve rows computed without reference to any table.
For example:
mysql> SELECT 1 + 1;
-> 2
You are permitted to specify DUAL as a dummy table name in situations where
no tables are referenced:
mysql> SELECT 1 + 1 FROM DUAL;
-> 2
DUAL is purely for the convenience of people who require that all SELECT statements
should have FROM and possibly other clauses.
MySQL may ignore the clauses. MySQL does not require FROM DUAL if no tables are referenced.
本文原創(chuàng)發(fā)布php中文網(wǎng),轉(zhuǎn)載請注明出處,感謝您的尊重!
總結(jié)
以上是生活随笔為你收集整理的mysql输入select now()_mysql 中select now(); 是怎么执行的?没有指定FROM tablename?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python的span方法_Python
- 下一篇: lr mysql 增删改查_Python