title: "DROP DATABASE"
description: "DROP DATABASE
removes a database from Materialize."
menu:
main:
parent: 'commands'
DROP DATABASE
removes a database from Materialize.
{{< warning >}} DROP DATABASE
immediately removes all objects within the
database without confirmation. Use with care! {{< /warning >}}
{{< diagram "drop-database.svg" >}}
Field | Use |
---|---|
IF EXISTS | Do not return an error if the specified database does not exist. |
database_name | The database you want to drop. For available databases, see SHOW DATABASES . |
CASCADE | Remove the database and its dependent objects. (Default) |
RESTRICT | Do not remove this database if it contains any schemas. |
You can use either of the following commands:
DROP DATABASE my_db;
DROP DATABASE my_db CASCADE;
DROP DATABASE my_db RESTRICT;
DROP DATABASE IF EXISTS my_db;
The privileges required to execute this statement are:
{{< include-md file="shared-content/sql-command-privileges/drop-database.md" >}}