2020-07-11 11:05:49 +00:00
|
|
|
|
---
|
2020-10-26 10:29:30 +00:00
|
|
|
|
toc_priority: 44
|
2020-07-23 13:06:50 +00:00
|
|
|
|
toc_title: DROP
|
2020-07-11 11:05:49 +00:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# DROP Statements {#drop}
|
|
|
|
|
|
2021-05-27 19:44:11 +00:00
|
|
|
|
Deletes existing entity. If the `IF EXISTS` clause is specified, these queries do not return an error if the entity does not exist.
|
2020-07-11 11:05:49 +00:00
|
|
|
|
|
|
|
|
|
## DROP DATABASE {#drop-database}
|
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Deletes all tables inside the `db` database, then deletes the `db` database itself.
|
|
|
|
|
|
|
|
|
|
Syntax:
|
|
|
|
|
|
2020-07-11 11:05:49 +00:00
|
|
|
|
``` sql
|
|
|
|
|
DROP DATABASE [IF EXISTS] db [ON CLUSTER cluster]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## DROP TABLE {#drop-table}
|
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Deletes the table.
|
|
|
|
|
|
|
|
|
|
Syntax:
|
|
|
|
|
|
2020-07-11 11:05:49 +00:00
|
|
|
|
``` sql
|
|
|
|
|
DROP [TEMPORARY] TABLE [IF EXISTS] [db.]name [ON CLUSTER cluster]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## DROP DICTIONARY {#drop-dictionary}
|
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Deletes the dictionary.
|
|
|
|
|
|
|
|
|
|
Syntax:
|
|
|
|
|
|
2020-07-11 11:05:49 +00:00
|
|
|
|
``` sql
|
|
|
|
|
DROP DICTIONARY [IF EXISTS] [db.]name
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## DROP USER {#drop-user-statement}
|
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Deletes a user.
|
|
|
|
|
|
|
|
|
|
Syntax:
|
|
|
|
|
|
2020-07-11 11:05:49 +00:00
|
|
|
|
``` sql
|
|
|
|
|
DROP USER [IF EXISTS] name [,...] [ON CLUSTER cluster_name]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## DROP ROLE {#drop-role-statement}
|
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Deletes a role. The deleted role is revoked from all the entities where it was assigned.
|
|
|
|
|
|
|
|
|
|
Syntax:
|
|
|
|
|
|
2020-07-11 11:05:49 +00:00
|
|
|
|
``` sql
|
|
|
|
|
DROP ROLE [IF EXISTS] name [,...] [ON CLUSTER cluster_name]
|
|
|
|
|
```
|
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
## DROP ROW POLICY {#drop-row-policy-statement}
|
2020-07-11 11:05:49 +00:00
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Deletes a row policy. Deleted row policy is revoked from all the entities where it was assigned.
|
2020-07-11 11:05:49 +00:00
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Syntax:
|
2020-07-11 11:05:49 +00:00
|
|
|
|
|
|
|
|
|
``` sql
|
|
|
|
|
DROP [ROW] POLICY [IF EXISTS] name [,...] ON [database.]table [,...] [ON CLUSTER cluster_name]
|
|
|
|
|
```
|
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
## DROP QUOTA {#drop-quota-statement}
|
2020-07-11 11:05:49 +00:00
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Deletes a quota. The deleted quota is revoked from all the entities where it was assigned.
|
2020-07-11 11:05:49 +00:00
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Syntax:
|
2020-07-11 11:05:49 +00:00
|
|
|
|
|
|
|
|
|
``` sql
|
|
|
|
|
DROP QUOTA [IF EXISTS] name [,...] [ON CLUSTER cluster_name]
|
|
|
|
|
```
|
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
## DROP SETTINGS PROFILE {#drop-settings-profile-statement}
|
2020-07-11 11:05:49 +00:00
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Deletes a settings profile. The deleted settings profile is revoked from all the entities where it was assigned.
|
2020-07-11 11:05:49 +00:00
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Syntax:
|
2020-07-11 11:05:49 +00:00
|
|
|
|
|
|
|
|
|
``` sql
|
|
|
|
|
DROP [SETTINGS] PROFILE [IF EXISTS] name [,...] [ON CLUSTER cluster_name]
|
|
|
|
|
```
|
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
## DROP VIEW {#drop-view}
|
2020-07-11 11:05:49 +00:00
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Deletes a view. Views can be deleted by a `DROP TABLE` command as well but `DROP VIEW` checks that `[db.]name` is a view.
|
2020-07-21 19:24:08 +00:00
|
|
|
|
|
2020-10-26 10:09:41 +00:00
|
|
|
|
Syntax:
|
2020-07-21 19:24:08 +00:00
|
|
|
|
|
|
|
|
|
``` sql
|
|
|
|
|
DROP VIEW [IF EXISTS] [db.]name [ON CLUSTER cluster]
|
|
|
|
|
```
|
|
|
|
|
|
2021-05-27 19:44:11 +00:00
|
|
|
|
[Оriginal article](https://clickhouse.tech/docs/en/sql-reference/statements/drop/) <!--hide-->
|