2020-07-11 11:05:49 +00:00
---
2020-10-26 10:29:30 +00:00
toc_priority: 42
2020-07-23 20:02:18 +00:00
toc_title: DESCRIBE
2020-07-11 11:05:49 +00:00
---
# DESCRIBE TABLE Statement {#misc-describe-table}
2021-10-19 20:50:30 +00:00
Returns information about table columns.
**Syntax**
2020-07-11 11:05:49 +00:00
``` sql
DESC|DESCRIBE TABLE [db.]table [INTO OUTFILE filename] [FORMAT format]
```
2021-10-19 20:50:30 +00:00
The `DESCRIBE` statement returns a row for each table column with the following [String ](../../sql-reference/data-types/string.md ) values:
2021-10-20 20:01:57 +00:00
- `name` — A column name.
- `type` — A column type.
- `default_type` — A clause that is used in the column [default expression ](../../sql-reference/statements/create/table.md#create-default-values ): `DEFAULT` , `MATERIALIZED` or `ALIAS` . If there is no default expression, then empty string is returned.
2021-10-19 20:50:30 +00:00
- `default_expression` — an expression specified after the `DEFAULT` clause.
2021-10-20 20:01:57 +00:00
- `comment` — A [column comment ](../../sql-reference/statements/alter/column.md#alter_comment-column ).
- `codec_expression` - A [codec ](../../sql-reference/statements/create/table.md#codecs ) that is applied to the column.
- `ttl_expression` - A [TTL ](../../engines/table-engines/mergetree-family/mergetree.md#table_engine-mergetree-ttl ) expression.
- `is_subcolumn` - A flag that equals `1` for internal subcolumns. It is included into the result if subcolumn description is enabled.
2021-10-19 20:50:30 +00:00
2021-10-20 20:01:57 +00:00
All columns in a [Nested ](../../sql-reference/data-types/nested-data-structures/nested.md ) data structure are described separately. The name of each column is prefixed with a parent column name and a dot.
To include internal subcolumns into the result, use the [describe_include_subcolumns ](../../operations/settings/settings.md#describe_include_subcolumns ) setting.
2021-10-19 20:50:30 +00:00
**Example**
Query:
``` sql
CREATE TABLE describe_example (
id UInt64, text String DEFAULT 'unknown' CODEC(ZSTD),
user Tuple (name String, age UInt8)
) ENGINE = MergeTree() ORDER BY id;
DESCRIBE TABLE describe_example;
DESCRIBE TABLE describe_example SETTINGS describe_include_subcolumns=1;
```
Result:
2020-07-11 11:05:49 +00:00
2021-10-19 20:50:30 +00:00
``` text
┌─name─┬─type──────────────────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┐
│ id │ UInt64 │ │ │ │ │ │
│ text │ String │ DEFAULT │ 'unknown' │ │ ZSTD(1) │ │
│ user │ Tuple(name String, age UInt8) │ │ │ │ │ │
└──────┴───────────────────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┘
```
The second query additionally shows subcolumn information:
2020-07-11 11:05:49 +00:00
2021-10-19 20:50:30 +00:00
``` text
┌─name──────┬─type──────────────────────────┬─default_type─┬─default_expression─┬─comment─┬─codec_expression─┬─ttl_expression─┬─is_subcolumn─┐
│ id │ UInt64 │ │ │ │ │ │ 0 │
│ text │ String │ DEFAULT │ 'unknown' │ │ ZSTD(1) │ │ 0 │
│ user │ Tuple(name String, age UInt8) │ │ │ │ │ │ 0 │
│ user.name │ String │ │ │ │ │ │ 1 │
│ user.age │ UInt8 │ │ │ │ │ │ 1 │
└───────────┴───────────────────────────────┴──────────────┴────────────────────┴─────────┴──────────────────┴────────────────┴──────────────┘
```
2021-10-18 16:07:19 +00:00
**See Also**
- [describe_include_subcolumns ](../../operations/settings/settings.md#describe_include_subcolumns ) setting.