Drop Table

Drop Table removes a table and all of its rows from the catalog. The table name must exist; dropping a missing table is a static error.

Syntax

Railroad

droptablename;

BNF

drop-table-stmt ::= "drop" "table" identifier ";"

Rules

  1. Dropping a non-existent table is a static error. (phase: catalog)
  2. All rows and the table definition are removed. (phase: catalog)

Examples

Minimal

Is Empty

A table re-created after drop is fresh and empty.

SQL

create table T;

insert into T ({"x": 1}, {"x": 2});

drop table T;

create table T;

select * from T;

Result

[]

Error cases

After Drop,

After drop, the table can no longer be selected from.

SQL

create table T;

insert into T ({"x": 1});

drop table T;

select * from T;

Expected error: static

Dropping An

Dropping an undeclared table is a static error.

SQL

drop table Ghost;

Expected error: static

See also