DROP SCHEMA
Removes a schema.
Syntax
DROP SCHEMA [IF EXISTS] <name> [, ...] [CASCADE | RESTRICT]
Description
To run DROP SCHEMA, you must be the schema owner.
You do not need to own all the objects that belong to the target schema.
Parameters
-
IF EXISTSIf you include
IF EXISTSin your command, no error will be reported when the specified schema does not exist. A notice will be issued instead. -
<name>The name of the schema.
-
<table_name>The name of the table or view to which the rule applies. You can specify this name with the schema qualification.
-
CASCADEorRESTRICTWhether to drop the schema and its dependent objects if dependent objects exist. Supported options include:
CASCADE: specifies to drop the dependent objects along with the schema.RESTRICT: specifies to reject the entire drop operation and is the default.
If you specify
CASCADEin your command, dependent objects in other schemas can also be dropped.
Examples
Drop schema basic_info:
DROP SCHEMA basic_info;
SQL standard compatibility
DROP SCHEMA in Relyt is fully compatible to DROP SCHEMA in the SQL standard, and DROP SCHEMA in Relyt provides the following extensions:
- Allows you to drop more than one schema in a single command.
- Allows you to use the
IF EXISTSoption.