Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

DROP SCHEMA - Delete schema

You use DROP SCHEMA to delete a database schema.

The SCHEMATA view of the INFORMATION_SCHEMA provides you with information on which schemas have been defined (see chapter "Information schemas").

The current authorization identifier must own the schema.



DROP SCHEMA schema { CASCADE | RESTRICT }



schema

Name of the schema.

You can qualify the name of the schema with a database name.


CASCADE

The schema schema and all the objects of the schema are deleted. Views, routines, and integrity constraints that reference the base tables, views, and routines in schema directly or indirectly are also deleted.


RESTRICT

The schema schema can only be deleted when it is empty. All the schema’s base tables, views, and routines must be deleted beforehand.

Example

The example deletes the ADDONS schema, provided that all base tables, views, and routines of the schema have already been deleted. The schema was qualified using the catalog name.

DROP SCHEMA ordercust.addons RESTRICT

See also

CREATE SCHEMA, DROP TABLE, DROP VIEW, DROP FUNCTION, DROP PROCEDURE