# DROP RELATION

## Synopsis <a href="#synopsis" id="synopsis"></a>

```sql
DROP RELATION relation_name;
```

## Description

Drops an existing [relation](/overview/core-concepts/databases.md#_relation). Only the owner of the relation can execute this statement.

{% hint style="info" %}
**Notes**

* Deleting the relation does not delete the relation's underlying entity.
* You cannot drop a relation if there exist any references to that relation.
  {% endhint %}

{% hint style="warning" %}
**Important** `DROP RELATION` cannot be undone. Use it with care!
{% endhint %}

### Arguments

#### relation\_name

The name of the relation to drop. If the name is case-sensitive, you must wrap it in double quotes; otherwise, the system uses the lower case name.

## Example

#### Drop a relation using default database and schema

The following shows how to drop the relation named `pageviews`:

```sh
demodb.public/demostore# LIST RELATIONS;
+------------+------------+------------+------------+------------------------------------------+-------------------------------+-------------------------------+
|  Name      |  Type      |  Owner     |  State     |  Properties                              |  Created At                   |  Updated At                   |
+============+============+============+============+==========================================+===============================+===============================+
| pageviews  | stream     | sysadmin   | created    | { "value.format": "json", "key.type":    | 2024-07-03 15:25:20 +0000 UTC | 2024-07-03 15:25:21 +0000 UTC |
|            |            |            |            | "STRUCT\u003cuserid VARCHAR\u003e",      |                               |                               |
|            |            |            |            | "topic": "pageviews", "store":           |                               |                               |
|            |            |            |            | "demostore", "key.format": "json" }      |                               |                               |
+------------+------------+------------+------------+------------------------------------------+-------------------------------+-------------------------------+
demodb.public/demostore# DROP RELATION pageviews;
+------------+-------------------------+------------+------------------------------------------+
|  Type      |  Name                   |  Command   |  Summary                                 |
+============+=========================+============+==========================================+
| query      | demodb.public.pageviews | DROP       | relation demodb.public.pageviews was     |
|            |                         |            | dropped                                  |
+------------+-------------------------+------------+------------------------------------------+
demodb.public/demostore# LIST RELATIONS;
+------------+------------+------------+------------+-------------+-------------+-------------+
|  Name      |  Type      |  Owner     |  State     |  Properties |  Created At |  Updated At |
+============+============+============+============+=============+=============+=============+
+------------+------------+------------+------------+-------------+-------------+-------------+
```

#### Drop a relation using fully-qualified name

The following shows how to drop the relation named `PageViews` in the database `OtherDB` and schema `S1`:

```sh
demodb.public/demostore# LIST RELATIONS IN SCHEMA "OtherDB"."S1";
+------------+------------+------------+------------+------------------------------------------+-------------------------------+-------------------------------+
|  Name      |  Type      |  Owner     |  State     |  Properties                              |  Created At                   |  Updated At                   |
+============+============+============+============+==========================================+===============================+===============================+
| PageViews  | stream     | sysadmin   | created    | { "value.format": "json", "key.type":    | 2024-07-03 15:28:22 +0000 UTC | 2024-07-03 15:28:24 +0000 UTC |
|            |            |            |            | "STRUCT\u003cuserid VARCHAR\u003e",      |                               |                               |
|            |            |            |            | "topic": "pageviews", "store":           |                               |                               |
|            |            |            |            | "demostore", "key.format": "json" }      |                               |                               |
+------------+------------+------------+------------+------------------------------------------+-------------------------------+-------------------------------+
demodb.public/demostore# DROP RELATION "OtherDB"."S1"."PageViews";
+------------+----------------------+------------+------------------------------------------+
|  Type      |  Name                |  Command   |  Summary                                 |
+============+======================+============+==========================================+
| query      | OtherDB.S1.PageViews | DROP       | relation OtherDB.S1.PageViews was        |
|            |                      |            | dropped                                  |
+------------+----------------------+------------+------------------------------------------+
demodb.public/demostore# LIST RELATIONS IN SCHEMA "OtherDB"."S1";
+------------+------------+------------+------------+-------------+-------------+-------------+
|  Name      |  Type      |  Owner     |  State     |  Properties |  Created At |  Updated At |
+============+============+============+============+=============+=============+=============+
+------------+------------+------------+------------+-------------+-------------+-------------+
```


---

# 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/ddl/drop-relation.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.
