mysql select now_mysql 中select now(); 是怎么执行的?没有指定FROM tablename?-问答-阿里云开发者社区-阿里云...

本文解析了MySQL内置函数now()的作用,指出即使在没有引用实际表的情况下,如`SELECT now() FROM table`,table会被忽略。特别提到DUAL表作为辅助,允许在无需实际表引用的SELECT语句中提供FROM子句。
摘要由CSDN通过智能技术生成

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值