---
title: DROP SCHEMA
description: Drop a schema and delete its associated directory with DROP SCHEMA in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-drop-schema
---

# DROP SCHEMA

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Drops a schema and deletes the directory associated with the schema from the file system. An
exception is thrown if the schema does not exist in the system.

While usage of `SCHEMA` and `DATABASE` is interchangeable, `SCHEMA` is preferred.

## Permissions

To drop a schema in Unity Catalog, you must have the `MANAGE` privilege on the schema or be its owner, plus `USE CATALOG` on the catalog where the schema resides.

Per the [object hierarchy](https://docs.databricks.com/aws/en/data-governance/unity-catalog/access-control/permissions-concepts.md), the owner of the parent catalog and users with `MANAGE` on the parent catalog can also perform this operation. The usage privileges they need depend on the object level at which they hold ownership or `MANAGE`. See [Usage privilege requirements for `MANAGE`](https://docs.databricks.com/aws/en/data-governance/unity-catalog/access-control/permissions-concepts.md#manage-usage-requirements).

## Syntax

```
DROP SCHEMA [ IF EXISTS ] schema_name [ RESTRICT | CASCADE ]
```

## Parameters

* **IF EXISTS**

  If specified, no exception is thrown when the schema does not exist.

* **[schema\_name](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names.md#schema-name)**

  The name of an existing schemas in the system.
  If the name does not exist, an exception is thrown.

* **RESTRICT**

  If specified, restricts dropping a non-empty schema and is enabled by default.

* **CASCADE**

  If specified, drops all the associated tables and functions recursively.

  > [!NOTE]
  >
  > In Unity Catalog, dropping a schema using `CASCADE` soft-deletes the schema and its child objects. Data files for managed tables and volumes are retained to allow for a 7-day recovery window. After the recovery window ends, the data files are permanently deleted (purged) within 48 hours. Files for external tables and external volumes are not deleted. For details, see [Object storage lifecycle in Unity Catalog](https://docs.databricks.com/aws/en/data-governance/unity-catalog/object-storage-lifecycle.md).

  **Warning!** If the schema is managed by the workspace-level Hive metastore, dropping a schema using `CASCADE` recursively deletes all files in the specified location, regardless of the table type (managed or external).

## Examples

```sql
-- Create `inventory_schema` Database
> CREATE SCHEMA inventory_schema COMMENT 'This schema is used to maintain Inventory';

-- Drop the schema and its tables
> DROP SCHEMA inventory_schema CASCADE;

-- Drop the schema using IF EXISTS
> DROP SCHEMA IF EXISTS inventory_schema CASCADE;
```

## Related articles

* [CREATE SCHEMA](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-schema.md)
* [DESCRIBE SCHEMA](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-aux-describe-schema.md)
* [SHOW SCHEMAS](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-aux-show-schemas.md)
* [Object storage lifecycle in Unity Catalog](https://docs.databricks.com/aws/en/data-governance/unity-catalog/object-storage-lifecycle.md)
