DESC
Description
You can use the statement to perform the following operations:
- View the schema of a table stored in your StarRocks cluster, along with the type of the sort key and materialized view of the table.
- View the schema of a table stored in the following external data sources, such as Apache Hive™. Note that you can perform this operation only in StarRocks 2.4 and later versions.
Syntax
DESC[RIBE] [catalog_name.][db_name.]table_name [ALL];
Parameters
Parameter | Required | Description |
---|---|---|
catalog_name | No | The name of the internal catalog or an external catalog.
|
db_name | No | The database name. |
table_name | Yes | The table name. |
ALL | No |
|
Output
+-----------+---------------+-------+------+------+-----+---------+-------+
| IndexName | IndexKeysType | Field | Type | Null | Key | Default | Extra |
+-----------+---------------+-------+------+------+-----+---------+-------+
The following table describes the parameters returned by this statement.
Parameter | Description |
---|---|
IndexName | The table name. If you view the schema of a table stored in an external data source, this parameter is not returned. |
IndexKeysType | The type of the sort key of the table. If you view the schema of a table stored in an external data source, this parameter is not returned. |
Field | The column name. |
Type | The data type of the column. |
Null | Whether the column values can be NULL.
|
Key | Whether the column is used as the sort key.
|
Default | The default value for the data type of the column. If the data type does not have a default value, a NULL is returned. |
Extra |
|
Note: For information about how a materialized view is displayed in the output, see Example 2.