Back to Materialize

SHOW COLUMNS

doc/user/content/sql/show-columns.md

1231.5 KB
Original Source

SHOW COLUMNS lists the columns available for an object. This can be a source, subsource, materialized view, view, or table.

Syntax

sql
SHOW COLUMNS FROM <object_name>
[LIKE <pattern> | WHERE <condition(s)>]
;
Syntax elementDescription
LIKE <pattern>If specified, only show columns that match the pattern.
WHERE <condition(s)>If specified, only show columns that match the condition(s).

Details

Output format

SHOW COLUMNS's output is a table, with this structure:

nofmt
+---------+------------+--------+
| name    | nullable   | type   |
|---------+------------+--------|
| ...     | ...        | ...    |
+---------+------------+--------+
FieldMeaning
nameThe name of the column
nullableDoes the column accept null values?
typeThe column's type

Rows are sorted by the order in which the fields are defined in the targeted object.

Examples

mzsql
SHOW SOURCES;
nofmt
   name
----------
my_sources
mzsql
SHOW COLUMNS FROM my_source;
nofmt
  name  | nullable | type
---------+----------+------
 column1 | f       | int4
 column2 | f       | text

Privileges

The privileges required to execute this statement are:

{{% include-headless "/headless/sql-command-privileges/show-columns" %}}