Forum Stats

  • 3,826,928 Users
  • 2,260,726 Discussions


SELECT SQL expression without FROM clause

Gerald Venzl-Oracle
Gerald Venzl-Oracle Member, Moderator Posts: 85 Employee
edited May 7, 2020 6:08PM in Database Ideas - Ideas

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.

Gerald Venzl-OracleBPeaslandDBAKayKThorsten Kettnercormacoberxandre.psantos
11 votes

Under Review - Voting Still Open · Last Updated