Is it possible to have a tableless select with multiple rows?
Posted
by outis
on Stack Overflow
See other posts from Stack Overflow
or by outis
Published on 2010-05-22T00:38:11Z
Indexed on
2010/05/22
0:40 UTC
Read the original article
Hit count: 290
sql
A SELECT
without a FROM
clause gets us a multiple columns without querying a table:
SELECT 17+23, REPLACE('bannanna', 'nn', 'n'), RAND(), CURRENT_TIMESTAMP;
How can we write a query that results in multiple rows without referring to a table? Basically, abuse SELECT
to turn it into a data definition statement. The result could have a single column or multiple columns.
I'm most interested in a DBMS neutral answer, but others (e.g. based on UNPIVOT
) are welcome. There's no technique application behind this question; it's more theoretical than practical.
© Stack Overflow or respective owner