2
votes

I am searching for official documentation of TABLE command(it is not the same as TABLE(<string_literal>)).

Snowflake supports TABLE <table_name>, which is a shorthand for SELECT * FROM <table_name>, but I am unable to locate its documentation. Example:

CREATE OR REPLACE TEMPORARY TABLE t AS SELECT 1 AS col;

SELECT * FROM t;
-- COL 1

TABLE t;
-- COL 1

db<>fiddle demo

It works with parametrized table name as well:

SET name = 't';

TABLE IDENTIFIER($name);
-- COL  1

TABLE TABLE($name);
-- error as TABLE() could be only used in FROM

I searched at All Commands/Query Syntax without much success.

2

2 Answers

0
votes

I think the documentation you're looking for is Table Literals:

https://docs.snowflake.com/en/sql-reference/literals-table.html

0
votes

I think you have it right in your comment on another answer. It's the PostgreSQL TABLE command, not a Snowflake feature.

TABLE Command

The command

TABLE name

is equivalent to

SELECT * FROM name

It can be used as a top-level command or as a space-saving syntax variant in parts of complex queries. Only the WITH, UNION, INTERSECT, EXCEPT, ORDER BY, LIMIT, OFFSET, FETCH and FOR locking clauses can be used with TABLE; the WHERE clause and any form of aggregation cannot be used.