# Drop a table

Control / ddl

A variant of [Create or change tables](https://meridian.online/operations/create-or-change-tables).

Remove a table, view or other catalogue entry.

Page: <https://meridian.online/operations/create-or-change-tables/drop-a-table>

## Status

Runs as a SQL step.

arcform carries it as a `sql:` step today.

## The DuckDB step

drop a table, a view, a sequence, a type, a macro and a schema

```sql
CREATE SCHEMA staging;
CREATE TABLE staging.scratch (id INTEGER);
CREATE TABLE t2 (id INTEGER);
CREATE VIEW v2 AS SELECT * FROM t2;
CREATE SEQUENCE s1;
CREATE TYPE mood AS ENUM ('ok', 'sad');
CREATE MACRO m1(x) AS x + 1;
CREATE TABLE keep (id INTEGER);
INSERT INTO keep VALUES (1);
CREATE TEMP VIEW entries AS
SELECT 'table' AS kind, schema_name || '.' || table_name AS name FROM duckdb_tables() WHERE database_name = 'memory'
UNION ALL SELECT 'view', schema_name || '.' || view_name FROM duckdb_views() WHERE database_name = 'memory' AND NOT internal
UNION ALL SELECT 'sequence', schema_name || '.' || sequence_name FROM duckdb_sequences() WHERE database_name = 'memory'
UNION ALL SELECT 'type', schema_name || '.' || type_name FROM duckdb_types() WHERE database_name = 'memory' AND NOT internal
UNION ALL SELECT 'macro', schema_name || '.' || function_name FROM duckdb_functions() WHERE database_name = 'memory' AND NOT internal AND function_type = 'macro'
UNION ALL SELECT 'schema', schema_name FROM duckdb_schemas() WHERE database_name = 'memory' AND NOT internal;
CREATE TEMP TABLE before AS SELECT * FROM entries;
-- a view is not dropped with the table it reads, so each is dropped by name
DROP VIEW v2;
DROP TABLE t2;
DROP SEQUENCE s1;
DROP TYPE mood;
DROP MACRO m1;
-- dropping what is not there is an error unless IF EXISTS says that is fine
DROP TABLE IF EXISTS no_such_table;
-- a schema that still holds a table is dropped only with CASCADE, which takes the table with it
DROP SCHEMA staging CASCADE;
CREATE TEMP TABLE after AS SELECT * FROM entries;
SELECT * FROM (SELECT * FROM before EXCEPT SELECT * FROM after) ORDER BY kind, name;
SELECT CASE WHEN ((SELECT list((kind, name) ORDER BY kind, name) FROM (SELECT * FROM before EXCEPT SELECT * FROM after))
      = [('macro', 'main.m1'), ('schema', 'staging'), ('sequence', 'main.s1'), ('table', 'main.t2'), ('table', 'staging.scratch'), ('type', 'main.mood'), ('view', 'main.v2')]
  AND (SELECT count(*) = 0 FROM (SELECT * FROM after EXCEPT SELECT * FROM before))
  AND (SELECT count(*) = 1 FROM keep)) THEN 'as expected' ELSE error('dropping should remove exactly the table t2, the view v2, the sequence, the type, the macro, and the schema with its table, leave every other entry and the data of the table keep, and not complain about the table that was never there') END AS verdict;
```

The statement builds its own data.

It needs nothing installed beyond DuckDB itself.

## What other tools call it

Meridian's classification; an independent blind rating agreed on 95.7% of 324 rows (variant, version 3).

- DuckDB: [`DROP`](https://duckdb.org/docs/current/sql/statements/drop) (read 2026-09-27)
