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>' was concurrently dropped if another process drops the view at the same time, instead of silently succeeding. IF EXISTS keeps its silent-no-op behaviour. See Transactional DDL and Known Limitations.

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. Case-sensitive.

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;