Is there a simple and easy way to create a result table with specified columns but zero rows? In set theory, this is called an empty set, but since relational databases use multidimensional sets, this term does not fit perfectly. I tried these two queries, but both deliver exactly one row, not null rows:
- SELECT '' AS ID;
- SELECT null AS ID;
But what I want is the same result as this query:
- SELECT ID FROM sometable WHERE false;
I am looking for a more elegant way because I do not want to have a linked table, so the query does not depend on any database schema. In addition, a general request may be a little faster (not so that it is important for such a request).
source share