> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cockroachlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# SHOW COLUMNS

The `SHOW COLUMNS` [statement](/docs/stable/sql-statements.md) shows details about columns in a table, including each column's name, type, default value, and whether or not it's nullable.

## Required privileges

The user must have any [privilege](/docs/stable/security-reference/authorization.md#managing-privileges) on the target table.

## Synopsis

![show\_columns syntax diagram](https://mintcdn.com/cockroachlabs/UZNSFbmU2EwEm6G5/images/sql-diagrams/common/show_columns.svg?fit=max\&auto=format\&n=UZNSFbmU2EwEm6G5\&q=85\&s=35884b6930f2174ccea140a829eb6b3a)

## Parameters

| Parameter | Description |
| - | - |
| `table_name` | The name of the table for which to show columns. |

## Response

The following fields are returned for each column.

| Field | Description |
| - | - |
| `column_name` | The name of the column. |
| `data_type` | The [data type](/docs/stable/data-types.md) of the column. |
| `is_nullable` | Whether or not the column accepts `NULL`. Possible values: `true` or `false`. |
| `column_default` | The default value for the column, or an expression that evaluates to a default value. |
| `generation_expression` | The expression used for a [computed column](/docs/stable/computed-columns.md). |
| `indices` | The list of [indexes](/docs/stable/indexes.md) that the column is involved in, as an array. |
| `is_hidden` | Whether or not the column is hidden. Possible values: `true` or `false`. |

## Examples

#### Setup

To follow along, run [`cockroach demo`](/docs/stable/cockroach-demo) to start a temporary, in-memory cluster with the [`movr`](/docs/stable/movr) sample dataset preloaded:

```shell theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
$ cockroach demo
```

### Show columns in a table

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW COLUMNS FROM users;
```

```
  column_name | data_type | is_nullable | column_default | generation_expression |         indices          | is_hidden
--------------+-----------+-------------+----------------+-----------------------+--------------------------+------------
  id          | UUID      |    false    | NULL           |                       | {primary,users_name_idx} |   false
  city        | VARCHAR   |    false    | NULL           |                       | {primary,users_name_idx} |   false
  name        | VARCHAR   |    true     | NULL           |                       | {primary,users_name_idx} |   false
  address     | VARCHAR   |    true     | NULL           |                       | {primary}                |   false
  credit_card | VARCHAR   |    true     | NULL           |                       | {primary}                |   false
(5 rows)
```

Alternatively, within the built-in SQL shell, you can use the `\d ` [shell command](/docs/stable/cockroach-sql.md#commands):

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> \d users
```

```
  column_name | data_type | is_nullable | column_default | generation_expression |  indices  | is_hidden
+-------------+-----------+-------------+----------------+-----------------------+-----------+-----------+
  id          | UUID      |    false    | NULL           |                       | {primary,users_name_idx} |   false
  city        | VARCHAR   |    false    | NULL           |                       | {primary,users_name_idx} |   false
  name        | VARCHAR   |    true     | NULL           |                       | {primary,users_name_idx} |   false
  address     | VARCHAR   |    true     | NULL           |                       | {primary}                |   false
  credit_card | VARCHAR   |    true     | NULL           |                       | {primary}                |   false
(5 rows)
```

### Show columns with comments

You can use [`COMMENT ON`](/docs/stable/comment-on) to add comments on a column.

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> COMMENT ON COLUMN users.credit_card IS 'This column contains user payment information.';
```

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> SHOW COLUMNS FROM users WITH COMMENT;
```

```
  column_name | data_type | is_nullable | column_default | generation_expression |  indices  | is_hidden |                    comment
+-------------+-----------+-------------+----------------+-----------------------+-----------+-----------+------------------------------------------------+
  id          | UUID      |    false    | NULL           |                       | {primary} |   false   | NULL
  city        | VARCHAR   |    false    | NULL           |                       | {primary} |   false   | NULL
  name        | VARCHAR   |    true     | NULL           |                       | {primary} |   false   | NULL
  address     | VARCHAR   |    true     | NULL           |                       | {primary} |   false   | NULL
  credit_card | VARCHAR   |    true     | NULL           |                       | {primary} |   false   | This column contains user payment information.

(5 rows)
```

## See also

* [`CREATE TABLE`](/docs/stable/create-table)
* [Information Schema](/docs/stable/information-schema.md)
* [SQL Statements](/docs/stable/sql-statements.md)
* [`COMMENT ON`](/docs/stable/comment-on)
