20230912 Mysql DUAL

  1. 官方文档:MySQL :: MySQL 8.0 Reference Manual :: 13.2.13 SELECT Statement

You are permitted to specify DUAL as a dummy table name in situations where no tables are referenced:

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.

在不引用表的情况下,允许指定DUAL作为虚拟表名: 

DUAL纯粹是为了方便那些要求所有select语句都应该有from和其他可能的子句的人。Mysql可能会忽略这些子句。如果没有表被引用,mysql不需要 from dual

SELECT 1 + 1; 
SELECT 1 + 1 FROM DUAL;

参考:

https://www.cnblogs.com/sheseido/p/13862317.html

浅谈 Mysql DUAL - 掘金

备注:

oracle中的DUAL, 用途类似,基本上就是为了符合语法结构。但是是一个实际存在的虚拟表,单行单列, 列Dummy,类型verchar2(1),oracle内部逻辑保证其有且只有一条数据,相比而言,mysql中的dual更虚,连个数据字典都没有。

oracle 中 dual 详解_oracle from dual 中 dual 是什么意思_周辉的博客-CSDN博客

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值