DROP SEMANTIC VIEW

Removes a semantic view definition from the catalog.

Syntax

DROP SEMANTIC VIEW [ IF EXISTS ] <name>

Statement Variants

DROP SEMANTIC VIEW <name>

Drops the named semantic view. Returns an error if the view does not exist.

DROP SEMANTIC VIEW IF EXISTS <name>

Drops the named semantic view if it exists. If the view does not exist, the statement succeeds silently.

Note

DROP participates in your surrounding transaction (BEGIN ... ROLLBACK restores the view). DROP SEMANTIC VIEW (without IF EXISTS) raises semantic view '<name>' does not exist when the view is absent at check time; IF EXISTS keeps its silent-no-op behaviour. The existence check and the delete are atomic only inside an explicit transaction – under autocommit a drop that another process commits in the window between them is not detected. See Transactional DDL and Known Limitations for the guard window and how to close it.

Note

Requires a writable database. On a read-only database this statement fails with DuckDB’s standard Cannot execute statement of type "..." which is attached in read-only mode! error. See Read-Only Databases.

Parameters

<name>

The name of the semantic view to drop. The name is folded to lowercase and matched case-insensitively, quoted or not – DROP SEMANTIC VIEW SALES, DROP SEMANTIC VIEW sales, and DROP SEMANTIC VIEW "sales" all refer to the same view, following DuckDB’s identifier semantics.

Note

A view created before v0.11.0 via a quoted mixed-case identifier (e.g. CREATE SEMANTIC VIEW "Sales") kept its original casing and is no longer reachable by any spelling. Drop and recreate it, or rename its stored catalog row to lowercase.

Examples

-- Drop an existing view
DROP SEMANTIC VIEW order_metrics;

-- Drop only if it exists (no error if missing)
DROP SEMANTIC VIEW IF EXISTS order_metrics;