Skip navigation

SELECT SQL expression without FROM clause

score 50
You have not voted. Under Review - Voting Still Open

To select values from SQL expressions, a FROM clause is not strictly required as the expression is not selected from that table anyway.

For example:


SELECT sysdate;


SELECT my_fuction();


Oracle uses the FROM dual construct as a workaround for that scenario where dual is a dummy one-column, one-row table, translating the above to:


SELECT sysdate FROM dual;

SELECT 1_2 FROM dual;

SELECT my_function() FROM DUAL;


Although the SQL standard doesn't allow a SELECT statement without a FROM clause, pretty much every other database does support the construct of selecting and expression without a FROM clause. Especially for beginners, users coming from other databases and quick tests, not having to know of and type FROM dual all the time aids user-friendliness.


Vote history