> ## 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 CONSTRAINTS

The `SHOW CONSTRAINTS` [statement](/docs/stable/sql-statements.md) lists all named [constraints](/docs/stable/constraints.md) as well as any unnamed [`CHECK`](/docs/stable/check) constraints on a table.

## Required privileges

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

## Aliases

`SHOW CONSTRAINT` is an alias for `SHOW CONSTRAINTS`.

## Synopsis

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

## Parameters

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

## Response

The following fields are returned for each constraint.

| Field | Description |
| - | - |
| `table_name` | The name of the table. |
| `constraint_name` | The name of the constraint. |
| `constraint_type` | The type of constraint. |
| `details` | The definition of the constraint, including the column(s) to which it applies. |
| `validated` | Whether values in the column(s) match the constraint. |

## Example

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
> CREATE TABLE orders (
    id INT PRIMARY KEY,
    date TIMESTAMP NOT NULL,
    priority INT DEFAULT 1,
    customer_id INT UNIQUE,
    status STRING DEFAULT 'open',
    CHECK (priority BETWEEN 1 AND 5),
    CHECK (status in ('open', 'in progress', 'done', 'cancelled')),
    FAMILY (id, date, priority, customer_id, status)
);
```

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

```
+------------+------------------------+-----------------+--------------------------------------------------------------------------+-----------+
| table_name |    constraint_name     | constraint_type |                                 details                                  | validated |
+------------+------------------------+-----------------+--------------------------------------------------------------------------+-----------+
| orders     | check_priority         | CHECK           | CHECK (priority BETWEEN 1 AND 5)                                         |   true    |
| orders     | check_status           | CHECK           | CHECK (status IN ('open':::STRING, 'in progress':::STRING,               |   true    |
|            |                        |                 | 'done':::STRING, 'cancelled':::STRING))                                  |           |
| orders     | orders_customer_id_key | UNIQUE          | UNIQUE (customer_id ASC)                                                 |   true    |
| orders     | primary                | PRIMARY KEY     | PRIMARY KEY (id ASC)                                                     |   true    |
+------------+------------------------+-----------------+--------------------------------------------------------------------------+-----------+
(4 rows)
```

## See also

* [Constraints](/docs/stable/constraints.md)
* [`ADD CONSTRAINT`](/docs/stable/alter-table#add-constraint)
* [`RENAME CONSTRAINT`](/docs/stable/alter-table#rename-constraint)
* [`DROP CONSTRAINT`](/docs/stable/alter-table#drop-constraint)
* [`VALIDATE CONSTRAINT`](/docs/stable/alter-table#validate-constraint)
* [`CREATE TABLE`](/docs/stable/create-table)
* [Information Schema](/docs/stable/information-schema.md)
* [SQL Statements](/docs/stable/sql-statements.md)
