# DESCRIBE RELATION COLUMNS

## Syntax

```sql
DESCRIBE [ RELATION | STREAM | CHANGELOG | MATERIALIZED VIEW ]
COLUMNS fully_qualified_relation_name;
```

## Description

This provides the information about an existing [Database](/overview/core-concepts/databases.md#relation)'s columns in a [Database's](/overview/core-concepts/databases.md) [schema](/overview/core-concepts/databases.md#schema). This command can also be used to define a specific relation type's columns. See [LIST RELATIONS](/reference/sql-syntax/command/list-relations.md) for a list of available relations to describe.

Relations are visible only if the current [Access Control](/overview/core-concepts/access-control.md#role) has `USAGE` privileges on the database and schema and `SELECT` or `INSERT` privilege on the relation.

### Arguments <a href="#parameters" id="parameters"></a>

#### fully\_qualified\_relation\_name

This is the name of the relation to describe its columns. If the name is case-sensitive you must wrap it in double quotes; otherwise, the system uses the lowercase name.

Optionally, the relation name may be fully-qualified in the format of `<database_name>.<schema_name>.<relation_name>` or `<schema_name>.<relation_name>`. If the database or schema name is not provided, the system uses the current session's database or schema (see [USE](/reference/sql-syntax/command/use.md)).

## Examples

#### Describe a Stream's columns

```sh
demodb.public/demostore# DESCRIBE RELATION COLUMNS pageviews;
+----------+---------+-----------+-------------+
|  Name    |  Type   |  Nullable |  Properties |
+==========+=========+===========+=============+
| viewtime | BIGINT  | true      | {}          |
+----------+---------+-----------+-------------+
| userid   | VARCHAR | true      | {}          |
+----------+---------+-----------+-------------+
| pageid   | VARCHAR | true      | {}          |
+----------+---------+-----------+-------------+
```

#### Describe a stream's columns in a specific database/schema

The following describes the `total_views` [Database](/overview/core-concepts/databases.md#stream) relation columns in the `demodb` database and `analytics` schema, using its fully-qualified relation name:

```bash
demodb.public/demostore# DESCRIBE RELATION COLUMNS pageviews;
+----------+---------+-----------+-------------+
|  Name    |  Type   |  Nullable |  Properties |
+==========+=========+===========+=============+
| viewtime | BIGINT  | true      | {}          |
+----------+---------+-----------+-------------+
| userid   | VARCHAR | true      | {}          |
+----------+---------+-----------+-------------+
| pageid   | VARCHAR | true      | {}          |
+----------+---------+-----------+-------------+
```

#### Describe a materialized view's columns

The following describes the columns for `pvcount` in the `demodb` database and `public` schema:

```bash
demodb.public/demostore# DESCRIBE MATERIALIZED VIEW COLUMNS demodb."public".pvcount;
+-------------+---------+-----------+-------------+
|  Name       |  Type   |  Nullable |  Properties |
+=============+=========+===========+=============+
| page_name   | VARCHAR | true      | {}          |
+-------------+---------+-----------+-------------+
| pageid      | VARCHAR | true      | {}          |
+-------------+---------+-----------+-------------+
| cnt         | BIGINT  | false     | {}          |
+-------------+---------+-----------+-------------+
```

#### Describe a changelog

The following describes the `users_log` [Database](/overview/core-concepts/databases.md#changelog) in the current database and schema:

```bash
demodb.public/demostore# DESCRIBE CHANGELOG COLUMNS users_log;
+--------------+-----------------------+-----------+-------------+
|  Name        |  Type                 |  Nullable |  Properties |
+==============+=======================+===========+=============+
| registertime | BIGINT                | true      | {}          |
+--------------+-----------------------+-----------+-------------+
| userid       | VARCHAR               | true      | {}          |
+--------------+-----------------------+-----------+-------------+
| regionid     | VARCHAR               | true      | {}          |
+--------------+-----------------------+-----------+-------------+
| gender       | VARCHAR               | true      | {}          |
+--------------+-----------------------+-----------+-------------+
| interests    | ARRAY<VARCHAR>        | true      | {}          |
+--------------+-----------------------+-----------+-------------+
| contactinfo  | STRUCT <phone VARCHAR | true      | {}          |
|              | , city VARCHAR,       |           |             |
|              | "state" VARCHAR, zip  |           |             |
|              | code VARCHAR>         |           |             |
+--------------+-----------------------+-----------+-------------+
```

#### Describe a Table's columns

The following describes the columns for `pv_agg` [Database](/overview/core-concepts/databases.md#table) in the current database and schema:

```sh
demodb.public/demostore# DESCRIBE RELATION COLUMNS pv_agg;
+-----------+---------+-----------+-------------+
|  Name     |  Type   |  Nullable |  Properties |
+===========+=========+===========+=============+
| userid    | VARCHAR | true      | {}          |
+-----------+---------+-----------+-------------+
| pagecount | BIGINT  | true      | {}          |
+-----------+---------+-----------+-------------+
```

#### Describe a relation's columns with a case-sensitive name

The following describes the columns for `Pageviews` [Database](/overview/core-concepts/databases.md#stream) relation in the current `demodb` database and `public` schema:

```sh
demodb.public/demostore# DESCRIBE RELATION "Pageviews";
+----------+---------+-----------+-------------+
|  Name    |  Type   |  Nullable |  Properties |
+==========+=========+===========+=============+
| viewtime | BIGINT  | true      | {}          |
+----------+---------+-----------+-------------+
| userid   | VARCHAR | true      | {}          |
+----------+---------+-----------+-------------+
| pageid   | VARCHAR | true      | {}          |
+----------+---------+-----------+-------------+
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.deltastream.io/reference/sql-syntax/command/describe-relation-columns.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
