Why SELECT without columns is valid

I accidentally wrote a query such as select from my_table;, and, surprisingly, this is a valid statement. Even more interesting to me is that it is even SELECT;a valid query in PostgreSQL. You can try writing a lot of funny queries with this:

select union all select;
with t as (select) select;
select from (select) a, (select) b;
select where exists (select);
create table a (b int); with t as (select) insert into a (select from t);

Is this a consequence of some standard SQL standard, or is there a precedent for this, or is it just fun behavior that no one wanted to program?

+4
source share
1 answer

To the right of the manual:

SELECT , . SQL. PostgreSQL . DISTINCT .

, . Postgres ( )

+5

All Articles