Mysql 中的dual表

版权声明:如若转载,请联系作者。 https://blog.csdn.net/liu16659/article/details/82826859

Mysql 中的dual表

0.参看mysql refman

SELECT can also be used to retrieve rows computed without reference to any table.
SELECT Syntax
2099
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.

1.

简言之,from dual完全是一个可有可无的东西。只是为了方便使用select 语句中喜欢带上from的开发者。

猜你喜欢

转载自blog.csdn.net/liu16659/article/details/82826859