Easy Tutorial
❮ Sqlite Constraints Sqlite C Cpp ❯

SQLite Drop Table

The DROP TABLE statement in SQLite is used to delete the table definition and all associated data, indexes, triggers, constraints, and permissions.

Use this command with extreme caution, as once a table is deleted, all information in the table is permanently lost.

Syntax

The basic syntax of the DROP TABLE statement is as follows. You can optionally specify the database name along with the table name, as shown below:

DROP TABLE database_name.table_name;

Example

Let's first confirm that the COMPANY table exists, and then we will delete it from the database.

sqlite>.tables
COMPANY       test.COMPANY

This indicates that the COMPANY table exists in the database. Now, let's delete it from the database as follows:

sqlite>DROP TABLE COMPANY;
sqlite>

Now, if you try the .TABLES command, the COMPANY table will no longer be found:

sqlite>.tables
sqlite>

The result is empty, indicating that the table has been successfully deleted from the database.

❮ Sqlite Constraints Sqlite C Cpp ❯