mysql输入select now()_mysql 中select now(); 是怎么执行的?没有指定FROM tablename?
mysql中 使用指令select now();就會獲取當前時間日期。為什么沒有from table,這種指令也能執(zhí)行?
不指定表的時候,應該如何理解select呢?
回復內容:
mysql中 使用指令select now();就會獲取當前時間日期。為什么沒有from table,這種指令也能執(zhí)行?
不指定表的時候,應該如何理解select呢?
參考文檔
now()是mysql內置函數,返回當前時間,而select可以不從表中獲取數據。即使使用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中文網,轉載請注明出處,感謝您的尊重!
總結
以上是生活随笔為你收集整理的mysql输入select now()_mysql 中select now(); 是怎么执行的?没有指定FROM tablename?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python的span方法_Python
- 下一篇: java比较运算_Java比较运算符