Last modified on 23 March 2015, at 17:18

SQL Dialects Reference/Select queries/Select without tables

Select without tablesEdit

Sometimes one needs to execute SQL scalar expressions without table context, i.e. make a query that would act as normal SELECT operator, evaluate given comma-separated expressions and return a table with single row and one or multiple columns (one for every individual expression). Obviously, expressions can't reference any columns from the tables, as there are none.

An example is determining the value of a mathematical function, using Oracle syntax:

SQL> SELECT 4*ATAN(1) AS "Arc tangent of 1 times 4" FROM dual;
 
Arc tangent OF 1 times 4
------------------------
              3.14159265
Standard  ?
DB2
  • VALUES
  • SELECT expressions FROM sysibm.sysdummy1
Firebird SELECT expressions FROM rdb$database
Ingres SELECT expressions
Linter SELECT expressions
MonetDB SELECT expressions
MSSQL SELECT expressions
MySQL
  • SELECT expressions
  • SELECT expressions FROM dual
Oracle SELECT expressions FROM dual
PostgreSQL
SQLite SELECT expressions
Virtuoso  ?