---
title: "DROP DOMAIN"
url: "https://docs.yugabyte.com/stable/api/ysql/the-sql-language/statements/ddl_drop_domain/"
---

# DROP DOMAIN

Use the DROP DOMAIN statement to remove a domain from the database.

## Synopsis

Use the `DROP DOMAIN` statement to remove a domain from the database.

## Syntax

- [![Grammar Icon](/icons/file-lines.svg)Grammar](#grammar-1)
- [![Diagram Icon](/icons/diagram.svg)Diagram](#diagram-1)

```output.ebnf
drop_domain ::= DROP DOMAIN [ IF EXISTS ] name [ , ... ] 
                [ CASCADE | RESTRICT ]
```

#### drop\_domain

DROPDOMAINIFEXISTS,[name](/stable/api/ysql/syntax_resources/grammar_diagrams#name)CASCADERESTRICT

## Semantics

### *drop\_domain*

#### *name*

Specify the name of the domain. An error is raised if the specified domain does not exist (unless `IF EXISTS` is set). An error is raised if any objects depend on this domain (unless `CASCADE` is set).

### IF EXISTS

Do not throw an error if the domain does not exist.

### CASCADE

Automatically drop objects that depend on the domain such as table columns using the domain data type and, in turn, all other objects that depend on those objects.

### RESTRICT

Refuse to drop the domain if objects depend on it (default).

## Examples

### Example 1

```plpgsql
yugabyte=# CREATE DOMAIN idx DEFAULT 5 CHECK (VALUE > 0);
```

```plpgsql
yugabyte=# DROP DOMAIN idx;
```

### Example 2

```plpgsql
yugabyte=# CREATE DOMAIN idx DEFAULT 5 CHECK (VALUE > 0);
```

```plpgsql
yugabyte=# CREATE TABLE t (k idx primary key);
```

```plpgsql
yugabyte=# DROP DOMAIN idx CASCADE;
```

## See also

- [ALTER DOMAIN](/stable/api/ysql/the-sql-language/statements/ddl_alter_domain "ALTER DOMAIN")
- [CREATE DOMAIN](/stable/api/ysql/the-sql-language/statements/ddl_create_domain "CREATE DOMAIN")
