SQLite – DROP Table


SQLite – DROP Table


”;


SQLite DROP TABLE statement is used to remove a table definition and all associated data, indexes, triggers, constraints, and permission specifications for that table.

You have to be careful while using this command because once a table is deleted then all the information available in the table would also be lost forever.

Syntax

Following is the basic syntax of DROP TABLE statement. You can optionally specify the database name along with table name as follows −

DROP TABLE database_name.table_name;

Example

Let us first verify COMPANY table and then we will delete it from the database.

sqlite>.tables
COMPANY       test.COMPANY

This means COMPANY table is available in the database, so let us drop it as follows −

sqlite>DROP TABLE COMPANY;
sqlite>

Now, if you try .TABLES command, then you will not find COMPANY table anymore.

sqlite>.tables
sqlite>

It shows nothing which means the table from your database has been dropped successfully.

Advertisements

”;

Leave a Reply

Your email address will not be published. Required fields are marked *