Latest web development tutorials

SQLite delete table

SQLite TheDROP TABLE statement to remove a table definition and all relevant data, indexes, triggers, constraints, and permission specifications for that table.

When you use this command to pay special attention to, because once a table is deleted, all the information in the table will be lost forever.

grammar

The basic syntax for DROP TABLE statement is as follows. You can choose to specify the database name with the table name, as follows:

DROP TABLE database_name.table_name;

Examples

Let us make sure COMPANY table already exists, then we will remove it from the database.

sqlite> .tables
COMPANY test.COMPANY

This means that the COMPANY table already exists in the database, let's remove it from the database, as follows:

sqlite> DROP TABLE COMPANY;
sqlite>

Now, if you try .TABLES command, you will not find the COMPANY table:

sqlite> .tables
sqlite>

Showing results is empty, meaning that was successfully removed from the database table.