DROP TABLE
Remove a table and all its data, indexes, triggers, and constraints from the database.Syntax
Description
DROP TABLE permanently removes a table definition and all data stored in the table. All indexes, triggers, and constraints associated with the table are also removed.
Parameters
Behavior
- All rows in the table are deleted.
- All indexes built on the table are removed.
- All triggers associated with the table are removed.
- The table entry is removed from the
sqlite_schemasystem table. - If foreign key constraints reference the dropped table, those references become invalid. Turso does not prevent dropping a table that is referenced by foreign keys in other tables.
DROP TABLEis not allowed while the table is being read or written by another statement in the same connection.
Examples
Drop a Table
Drop a Table Only if It Exists
Drop a Table in an Attached Database
See Also
- CREATE TABLE for creating tables
- ALTER TABLE for modifying tables
- DELETE for removing rows without dropping the table