In many of the questions selects without tables are used.
But what does “SELECT 1;” for example actually do?
(Pick 1 correct answer; or if you like a challenge try finding all)
a) It results in a syntax error of course!
b) With Oracle you write it like: “select 1 from dual;”
c) In DB2 you get the same result with “values 1;”.
d) The result will be 1 row with 1 column containing “1″.
[ Just for fun ]
Question 46: What does “SELECT 1;” actually do?
21. May 2010
By plogi in mysql questions
One Response
You must be logged in to post a comment.
b c d are correct.
It works like selecting a constant from a table with 1 row.
Using the same technique, you can use MySQL as a pocket-calculator: