SHOW COLUMNS

statementsupportedTables, views, streams, sequences

docs.snowflake.com ↗

Lists the columns in the tables or views and the dimensions, facts, and metrics in the semantic views for which you have access privileges. This command can be used to list the columns, dimensions, facts, and metrics for the following objects: - The specified table or view. - All tables and views in the specified schema or in the schema that is currently in use. - All tables and views in the specified database or in the database that is currently in use. - All tables and views in your account.

Syntax

supportedpartialnot supportednot scored

SHOW COLUMNS [ LIKE '<pattern>' ]
             [ IN { ACCOUNT | DATABASE [ <database_name> ] | SCHEMA [ <schema_name> ] | TABLE | [ TABLE ] <table_name> | VIEW | [ VIEW ] <view_name> } | APPLICATION <application_name> | APPLICATION PACKAGE <application_package_name> ]

Parameters

NameRequiredDescription
LIKE '<pattern>'Filters the command output by object name. The filter uses case-insensitive pattern matching, with support for SQL wildcard characters (% and _). For example, the following patterns return the same results: ... LIKE '%testing%' ... ... LIKE '%TESTING%' ...
IN { ACCOUNT | DATABASE [ <database_name> ] | SCHEMA [ <schema_name> ] | TABLE | [ TABLE ] <table_name> | VIEW | [ VIEW ] <view_name> | APPLICATION <application_name> | APPLICATION PACKAGE <application_package_name> }Specifies the scope of the command, which determines whether the command lists records only for the current/specified database, schema, table, or view, or across your entire account: If you specify the keyword ACCOUNT, then the command retrieves records for all schemas in all databases of the current account. If you specify the keyword DATABASE, then: If you specify a db_name, then the command retrieves records for all schemas of the specified database. If you don’t specify a db_name, then: If there is a current database, then the command retrieves records for all schemas in the current database. If there is no current database, then the command retrieves records for all databases and schemas in the account. If you specify the keyword SCHEMA, then: If you specify a qualified schema name (for example, my_database.my_schema), then the command retrieves records for the specified database and schema. If you specify an unqualified schema_name, then: If there is a current database, then the command retrieves records for the specified schema in the current database. If there is no current database, then the command displays the error SQL compilation error: Object does not exist, or operation cannot be performed. If you don’t specify a schema_name, then: If there is a current database, then: If there is a current schema, then the command retrieves records for the current schema in the current database. If there is no current schema, then the command retrieves records for all schemas in the current database. If there is no current database, then the command retrieves records for all databases and all schemas in the account. If you specify the keyword TABLE without a table_name, then: If there is a current database, then: If there is a current schema, then the command retrieves records for the current schema in the current database. If there is no current schema, then the command retrieves records for all schemas in the current database. If there is no current database, then the command retrieves records for all databases and all schemas in the account. If you specify a table_name (with or without the keyword TABLE), then: If you specify a fully-qualified table_name (e.g. my_database_name.my_schema_name.my_table_name), then the command retrieves all records for the specified table. If you specify a schema-qualified table_name (e.g. my_schema_name.my_table_name), then: If a current database exists, then the command retrieves all records for the specified table. If no current database exists, then the command displays an error similar to Cannot perform SHOW object_type. This session does not have a current database.... If you specify an unqualified table_name, then: If a current database and current schema exist, then the command retrieves records for the specified table in the current schema of the current database. If no current database exists or no current schema exists, then the command displays an error similar to: SQL compilation error: object does not exist or not authorized.. If you specify the VIEW keyword or a view name, the rules for views parallel the rules for tables. If you specify the APPLICATION or APPLICATION PACKAGE keywords, records for the specified Snowflake Native App Framework application or application package are returned. Default: Depends on whether the session currently has a database in use: Database: DATABASE is the default (i.e. the command returns the objects you have privileges to view in the database). No database: ACCOUNT is the default (i.e. the command returns the objects you have privileges to view in your account).

Usage notes

Output

The command output provides column properties and metadata in the following columns: Column | Description table_name | Name of the table or view that the column, dimension, fact, or metric belongs to. schema_name | Schema for the table. column_name | Name of the column, dimension, fact, or metric. data_type | JSON object containing the data type and applicable properties of the column, dimension, fact, or metric. The type key-value pair specifies the data type of the column, dimension, fact, or metric. For string and numeric data types, type specifies one of the following values: TEXT for all string types. FIXED for all fixed-point numeric types. REAL for all floating-point numeric types. The other key-value pairs describe the properties that are applicable to the particular data type. For example: If type is TEXT or BINARY, the additional key-value pairs can include length, byteLength, nullable, and fixed. If type is FIXED, TIME, TIMESTAMP_NTZ, TIMESTAMP_LTZ, or TIMESTAMP_TZ, the additional key-value pairs can include precision, scale, and nullable. If type is REAL, DATE, or BOOLEAN, the additional key-value pairs can include nullable. null? | Whether the column can contain NULL values. default | Default value, if any, defined for the column. kind | One of the following values: COLUMN for columns in tables, views, and materialized views. VIRTUAL_COLUMN for virtual columns defined by an expression. DIMENSION for dimensions in semantic views. FACT for facts in semantic views. METRIC for metrics in semantic views. expression | The SQL expression that defines a virtual column. Empty for non-virtual columns. comment | Comment, if any, for the column, dimension, fact, or metric. database_name | Database for the table. autoincrement | Auto-increment start and increment values, if any, for the column. If the column has the NOORDER property, the value includes NOORDER (for example, IDENTITY START 1 INCREMENT 1 NOORDER). Otherwise, the value includes ORDER. schema_evolution_record | Records information about the latest triggered Schema Evolution for a given table column. This column contains the following subfields: EvolutionType: The type of the triggered schema evolution (ADD_COLUMN, ADD_FIELD, or DROP_NOT_NULL). EvolutionMode: The triggering ingestion mechanism (COPY, SNOWPIPE, or SNOWPIPE_STREAMING). FileName: The file name that triggered the evolution (NULL for SNOWPIPE_STREAMING). TriggeringTime: The approximate time when the column was evolved. QueryId or PipeId: A unique identifier of the triggering query or pipe (QUERY ID for COPY, PIPE ID for SNOWPIPE, or NULL for SNOWPIPE_STREAMING). Pipe name: Fully qualified pipe name that triggered schema evolution (SNOWPIPE_STREAMING only). Channel name: Channel that triggered schema evolution (SNOWPIPE_STREAMING only). offsetTokenUpperBound: An offset at or before which schema evolution was triggered (SNOWPIPE_STREAMING only).

See also