There are dual virtual tables similar to those in Oracle in MySQL: the official statement is purely to satisfy the habit of select... from,MySQL ignores the reference to this table.
You can pay attention to the following:
- Select * from dual; MySQL will have an error-- 1096: The table is not used. Oracle returns the column "du" with the value "X". The behavior is the same as that of a regular table with only one row of records!
- 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 and then the express statement is calculated. The where condition here determines whether expres will return!
To sum up:
- Oracle dual hasCodeAesthetic, unified style, conventions become vulgar!
- 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