> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Documentation for DROP Statements

# DROP Statements

Deletes existing entity. If the `IF EXISTS` clause is specified, these queries do not return an error if the entity does not exist. If the `SYNC` modifier is specified, the entity is dropped without delay.

<h2 id="drop-database">
  DROP DATABASE
</h2>

Deletes all tables inside the `db` database, then deletes the `db` database itself.

Syntax:

```sql theme={null}
DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster] [SYNC]
```

<h2 id="drop-table">
  DROP TABLE
</h2>

Deletes one or more tables.

<Tip>
  To undo the deletion of a table, please see [UNDROP TABLE](/reference/statements/undrop)
</Tip>

Syntax:

```sql theme={null}
DROP [TEMPORARY] TABLE [IF EXISTS] [IF EMPTY]  [db1.]name_1[, [db2.]name_2, ...] [ON CLUSTER cluster] [SYNC]
```

Limitations:

* If the clause `IF EMPTY` is specified, the server checks the emptiness of the table only on the replica which received the query.
* Deleting multiple tables at once is not an atomic operation, i.e. if the deletion of a table fails, subsequent tables will not be deleted.

<h2 id="drop-dictionary">
  DROP DICTIONARY
</h2>

Deletes the dictionary.

Syntax:

```sql theme={null}
DROP DICTIONARY [IF EXISTS] [db.]name [SYNC]
```

<h2 id="drop-user">
  DROP USER
</h2>

Deletes a user.

Syntax:

```sql theme={null}
DROP USER [IF EXISTS] name [,...] [ON CLUSTER cluster_name] [FROM access_storage_type]
```

<h2 id="drop-role">
  DROP ROLE
</h2>

Deletes a role. The deleted role is revoked from all the entities where it was assigned.

Syntax:

```sql theme={null}
DROP ROLE [IF EXISTS] name [,...] [ON CLUSTER cluster_name] [FROM access_storage_type]
```

<h2 id="drop-row-policy">
  DROP ROW POLICY
</h2>

Deletes a row policy. Deleted row policy is revoked from all the entities where it was assigned.

Syntax:

```sql theme={null}
DROP [ROW] POLICY [IF EXISTS] name [,...] ON [database.]table [,...] [ON CLUSTER cluster_name] [FROM access_storage_type]
```

<h2 id="drop-masking-policy">
  DROP MASKING POLICY
</h2>

Deletes a masking policy.

Syntax:

```sql theme={null}
DROP MASKING POLICY [IF EXISTS] name ON [database.]table [ON CLUSTER cluster_name] [FROM access_storage_type]
```

<h2 id="drop-quota">
  DROP QUOTA
</h2>

Deletes a quota. The deleted quota is revoked from all the entities where it was assigned.

Syntax:

```sql theme={null}
DROP QUOTA [IF EXISTS] name [,...] [ON CLUSTER cluster_name] [FROM access_storage_type]
```

<h2 id="drop-settings-profile">
  DROP SETTINGS PROFILE
</h2>

Deletes a settings profile. The deleted settings profile is revoked from all the entities where it was assigned.

Syntax:

```sql theme={null}
DROP [SETTINGS] PROFILE [IF EXISTS] name [,...] [ON CLUSTER cluster_name] [FROM access_storage_type]
```

<h2 id="drop-view">
  DROP VIEW
</h2>

Deletes a view. Views can be deleted by a `DROP TABLE` command as well but `DROP VIEW` checks that `[db.]name` is a view.

Syntax:

```sql theme={null}
DROP VIEW [IF EXISTS] [db.]name [ON CLUSTER cluster] [SYNC]
```

<h2 id="drop-function">
  DROP FUNCTION
</h2>

Deletes a user defined function created by [CREATE FUNCTION](/reference/statements/create/function).
System functions can not be dropped.

**Syntax**

```sql theme={null}
DROP FUNCTION [IF EXISTS] function_name [on CLUSTER cluster]
```

**Example**

```sql theme={null}
CREATE FUNCTION linear_equation AS (x, k, b) -> k*x + b;
DROP FUNCTION linear_equation;
```

<h2 id="drop-named-collection">
  DROP NAMED COLLECTION
</h2>

Deletes a named collection.

**Syntax**

```sql theme={null}
DROP NAMED COLLECTION [IF EXISTS] name [on CLUSTER cluster]
```

**Example**

```sql theme={null}
CREATE NAMED COLLECTION foobar AS a = '1', b = '2';
DROP NAMED COLLECTION foobar;
```
