DESCRIBE COLUMNS¶
The DESCRIBE COLUMNS
command lets you list information about table and view columns.
Note
DESCRIBE
commands use CPU to increase usability.
Syntax¶
DESC[RIBE] COLUMNS [ DATABASE <database_name> ] [ SCHEMA <schema_name> ] TABLE <table_name> [LIKE 'pattern'] | VIEW <view_name>[LIKE 'pattern']
Parameters¶
Parameter |
Parameter Type |
Description |
---|---|---|
|
Filters by a specific database |
|
|
Filters by a specific schema |
|
|
Identifies the specific table for which you want to retrieve column descriptions |
|
|
String pattern to match |
Output¶
Using the DESCRIBE COLUMNS
command generates the following output:
Parameter |
Data Type |
Description |
---|---|---|
|
|
Displays the name of the database |
|
|
Displays the name of the schema |
|
|
Displays the name of the table |
|
|
Displays whether the column can contain |
|
|
Displays the ID of the table |
|
|
Displays the name of the column |
|
|
Displays the data type of the column |
|
|
Displays the column default value if one exists |
|
|
Displays the table’s creation date and timestamp |
|
|
Displays the size of the column in bytes |
Examples¶
DESCRIBE COLUMNS DATABASE master SCHEMA public TABLE nba;
database_name|schema_name|table_name|is_nullable|column_name|type_name|default_value|created |column_size|
-------------+-----------+----------+-----------+-----------+---------+-------------+-------------------+-----------+
master |public |nba |true |name |TEXT | |2023-08-08 06:47:47|0 |
master |public |nba |true |team |TEXT | |2023-08-08 06:47:47|0 |
master |public |nba |true |number |INT |0 |2023-08-08 06:47:47|4 |
master |public |nba |true |position |TEXT | |2023-08-08 06:47:47|0 |
master |public |nba |true |age |INT |0 |2023-08-08 06:47:47|4 |
master |public |nba |true |height |TEXT | |2023-08-08 06:47:47|0 |
master |public |nba |true |weight |INT |0 |2023-08-08 06:47:47|4 |
master |public |nba |true |college |TEXT | |2023-08-08 06:47:47|0 |
master |public |nba |true |salary |INT |0 |2023-08-08 06:47:47|4 |
master |public |nba |true |name0 |TEXT | |2023-08-08 06:47:47|0 |
DESCRIBE COLUMNS DATABASE master SCHEMA public TABLE nba LIKE '%name%';
database_name|schema_name|table_name|is_nullable|column_name|type_name|default_value|created |column_size|
-------------+-----------+----------+-----------+-----------+---------+-------------+-------------------+-----------+
master |public |nba |true |name |TEXT | |2023-08-08 06:47:47|0 |
master |public |nba |true |name0 |TEXT | |2023-08-08 06:47:47|0 |
Permissions¶
This command requires USAGE
permission on the schema level.