HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlModerate

What is the `TABLE example` syntax called?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
thecalledwhatexamplesyntaxtable

Problem

In PostgreSQL, I've been using syntax like
TABLE example1
UNION ALL
TABLE example2


which I understand to be equivalent to
SELECT * FROM example1
UNION ALL
SELECT * FROM example2


But a colleague asked me questions about this, and I can't find any PostgreSQL docs on this syntax. ("TABLE" isn't a helpful search phrase.) Where can I find documentation about it?

Is it ANSI SQL standard?

EDIT: It currently apparently even confuses StackExchanges's syntax highlighting.

Solution

It's documented with the SELECT statement and it's called "TABLE Command" there.

In the SQL standard it's called an "explicit table":


The `


  
TABLE


is equivalent to the


  
( SELECT * FROM )`

This seems to be part of the standard at least since SQL 1992

Context

StackExchange Database Administrators Q#258028, answer score: 13

Revisions (0)

No revisions yet.