MySQL is similar to the dual virtual table of Oracle.

Source: Internet
Author: User

There are dual virtual tables similar to those in Oracle in mysql: the official statement is purely to satisfy select... from... mysql ignores the reference to this table.

You can pay attention to the following:

Select * from dual; mysql will encounter an error -- 1096: The table is not used; and oracle will return the column "du ", its value is "X"-the behavior is the same as that of a normal table with only one record!

Select express [from dual]; mysql is always executed as a normal select statement that returns the value of this expression, and returns the result set of a row of records. from dual is simply a decoration for mysql! In oracle, this sentence must contain from dual; otherwise, an error is returned!

Select express from dual where 0 = 2; the behavior of mysq is the same as that of oracle: This statement is just like the normal table you think -- The where condition is calculated first before the computation of express; the where condition determines whether expres returns!

To sum up:

Oracle's dual features code aesthetics, unified style, and conventions!

In SQL Server, select has the characteristics of combining mysql with oracle:

Select * sqlserver reports an error similar to mysql -- you must specify a table. This is completely a sentence, and no one will recognize it!

Select express sqlserver is similar to mysql. A valid statement returns the result set of a row of records.

Select express where 0 = 2 sqlserver features: The from clause is not required. Consider the where clause to determine whether to return the result set.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.