You can execute the DROP SCHEMA statement to delete a schema from a database. This topic describes how to use the DROP SCHEMA statement and the limits on using the statement.

Limits

You cannot delete the public schema, which is automatically created by Hologres for each database.

Syntax

DROP SCHEMA [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
The following table describes the parameters in the statement.
Parameter Description
CASCADE The keyword indicating that the system automatically deletes all objects such as tables, functions, and data in the target schema.
RESTRICT The keyword indicating that the system does not delete a schema if the schema contains any objects.

Examples

DROP SCHEMA mystuff CASCADE;