Before you can remove a database, you must use DROP SCHEMA to remove all its dependent schemas.

CAUTION

DROP DATABASE removes all data in a database and cannot be undone.

Syntax

DROP DATABASE [ IF EXISTS ] database_name;

Parameters

Parameter or clauseDescription
IF EXISTS clauseDo not return an error if the specified database does not exist.
database_nameThe name of the database you want to remove. You can use SHOW DATABASES to get a list of all available databases.

Examples

This statement removes the rw_db database which contains two schemas, rw_schema and public (default schema):

DROP SCHEMA rw_db.rw_schema;
DROP SCHEMA rw_db.public;
DROP DATABASE rw_db;

Use this statement if you don’t want RisingWave to return an error if the database you want to remove does not exist:

DROP DATABASE IF EXISTS rw_db;