DESCRIBE TABLE

Describes either the columns in a table or the current values, as well as the default values, for the stage properties for a table.

DESCRIBE can be abbreviated to DESC.

See also:

DROP TABLE , ALTER TABLE , CREATE TABLE , SHOW TABLES

DESCRIBE VIEW

Syntax

DESC[RIBE] TABLE <name> [ TYPE =  { COLUMNS | STAGE } ]
Copy

Parameters

name

Specifies the identifier for the table to describe. If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.

TYPE = COLUMNS | STAGE

Specifies whether to display the columns for the table or the stage properties (including their current and default values) for the table.

Default: TYPE = COLUMNS

Usage Notes

  • This command does not show the object parameters for a table. Instead, use SHOW PARAMETERS IN TABLE ….

  • DESC TABLE and DESCRIBE VIEW are interchangeable. Either command retrieves the details for the table or view that matches the criteria in the statement; however, TYPE = STAGE does not apply for views because views do not have stage properties.

  • If table schema evolution is enabled on the table, the output will contain a SchemaEvolutionRecord column. This column was introduced with the 2023_08 Bundle (Generally Enabled). For more information, see Table schema evolution.

  • The output includes a POLICY NAME column to indicate the masking policy set on the column.

    If a masking policy is not set on the column or if the Snowflake account is not Enterprise Edition or higher, Snowflake returns NULL.

  • To post-process the output of this command, you can use the RESULT_SCAN function, which treats the output as a table that can be queried.

Examples

Create an example table:

CREATE TABLE emp (id NUMBER NOT NULL PRIMARY KEY, fname VARCHAR(50), lname VARCHAR(50), location VARCHAR(100));
Copy

Describe the columns in the table:

DESC TABLE emp;
Copy

Describe the stage properties for the table:

DESC TABLE emp TYPE = STAGE;
Copy

Determine the masking policies set on the table columns:

DESC TABLE ssn_record;

---------------+-------------+--------+-------+---------+-------------+------------+--------+------------+---------+----------------------------+------------------+
      name     |    type     |  kind  | null? | default | primary key | unique key | check  | expression | comment |       policy name          |  privacy domain  |
---------------+-------------+--------+-------+---------+-------------+------------+--------+------------+---------+----------------------------+------------------+
EMPLOYEE_SSN_1 | VARCHAR(32) | COLUMN | Y     | [NULL]  | N           | N          | [NULL] | [NULL]     | [NULL]  | MY_DB.MY_SCHEMA.SSN_MASK_1 |     [NULL]       |
---------------+-------------+--------+-------+---------+-------------+------------+--------+------------+---------+----------------------------+------------------+
Copy