doc/user/content/sql/drop-schema.md
DROP SCHEMA removes a schema from Materialize.
DROP SCHEMA [IF EXISTS] <schema_name> [CASCADE|RESTRICT];
| Syntax element | Description |
|---|---|
| IF EXISTS | Optional. If specified, do not return an error if the named schema does not exist. |
<schema_name> | The schema you want to remove. For available schemas, see SHOW SCHEMAS. |
| CASCADE | Remove the schema and its dependent objects. |
| RESTRICT | Do not remove this schema if it contains any sources or views. (Default) |
Before you can drop a schema, you must drop all sources and views it contains, or use the CASCADE option.
SHOW SOURCES FROM my_schema;
my_file_source
DROP SCHEMA my_schema;
SHOW SOURCES FROM my_schema;
my_file_source
DROP SCHEMA my_schema CASCADE;
You can use either of the following commands:
DROP SCHEMA my_schema;
DROP SCHEMA my_schema RESTRICT;
DROP SCHEMA IF EXISTS my_schema;
The privileges required to execute this statement are:
{{% include-headless "/headless/sql-command-privileges/drop-schema" %}}