Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: DUAL in MySQL

Re: DUAL in MySQL

From: ???????, <cichomitiko_at_gmail.com>
Date: Sun, 14 May 2006 19:54:11 +0200
Message-ID: <44676ec2$0$15792$14726298@news.sunsite.dk>


<jbmorla_at_gmail.com> wrote in message
news:1147620225.124802.113610_at_v46g2000cwv.googlegroups.com...
> Hi,
>
> I just tried:
>
> create table DUAL ( X varchar ( 1 ) );
>
> in MySQL 5.
>
> Guess what: it's forbidden ;-)

[...]

Because it's there, you don't need to create it :)

+---------------+----------------+
| Variable_name | Value          |
+---------------+----------------+
| version       | 5.0.21-max-log |
+---------------+----------------+

1 row in set (0.00 sec)

mysql> select sysdate() from dual;

+---------------------+
| sysdate()           |
+---------------------+

| 2006-05-14 19:50:13 |
+---------------------+

1 row in set (0.01 sec)

<quote>
MySQL 5.1 Reference Manual

SELECT can also be used to retrieve rows computed without reference to any table.
For example:
mysql> SELECT 1 + 1;

        -> 2

You are allowed 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 compatibility with some other database servers that require a FROM clause. MySQL does not require the clause if no tables are referenced.
</quote>

Dimitre Received on Sun May 14 2006 - 12:54:11 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US