category
type
status
date
slug
summary
tags
password
Property
Mar 14, 2023 07:56 AM
icon
虚拟表DUAL
- 在MySQL中使用
select 1;
不加from table
就可以执行,但是在Oracle中国需要满足select * from table;
这样的语法才能正常运行,因此Oracle中引入了虚拟表DUAL来表示select 1 from dual;
在MySQL5.5
以上的版本也引入了类似的虚拟表DUAL,但是在MySQL中执行select * from dual
会报错:Not tables used
MySQL DUAL表的常见使用场景
插入数据前判断是否存在
- 如果需要在插入数据前判断数据表中是否存在此条记录,MySQL中的相关语法如下:
- 作者:axiszql
- 链接:https://axiszql.com/article/mysql-skill-dual
- 声明:本文采用 CC BY-NC-SA 4.0 许可协议,转载请注明出处。