SQLite classic ...login
SQLite classic tutorial
author:php.cn  update time:2022-04-13 17:05:02

SQLite delete table


SQLite's DROP TABLE statement is used to delete a table definition and all its related data, indexes, triggers, constraints, and permission specifications for the table.

Pay special attention when using this command, because once a table is deleted, all information in the table will be lost forever.

Syntax

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

DROP TABLE database_name.table_name;

Example

Let’s start with Confirm that the COMPANY table already exists, then we delete it from the database.

sqlite>.tables
COMPANY test.COMPANY

This means that the COMPANY table already exists in the database, let us delete it from the database, As follows:

sqlite>DROP TABLE COMPANY;
sqlite>

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

sqlite>.tables
sqlite>

The displayed result is empty, which means the table has been successfully deleted from the database.

php.cn