Updated: April 19, 2023

Remove a table


 DROP TABLE [IF EXISTS] [database-name.] table-name 


The DROP TABLE statement removes a table added with the CREATE TABLE statement. The table is completely removed from the database schema and the disk file, meaning the table cannot be recovered. All indexes associated with the table are also deleted.

In the default mode, the DROP TABLE statement doesn't reduce the size of the database file. Empty space in the database is retained for later INSERT commands. To remove free space in the database, use the VACUUM command. If auto-vacuum mode is enabled for a database, then space will be freed automatically by DROP TABLE.

The optional IF EXISTS clause suppresses the error that would normally result if the table doesn't exist.