SQLite Drop Table

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

Syntax:

snippet
DROP TABLE database_name.table_name;
Note
Note: You must be very careful while using the DROP TABLE command because once the table is deleted then all the information available in the phone is destroyed and you cannot recover.

Let's take an example to demonstrate how to delete a table in SQLite.

We have already two tables "DEPARTMENT" and "STUDENT". We can verify it by using .tables command.

SQLite Drop table 1

So you can see that we have two tables.

Let's delete the "STUDENT" table.

snippet
DROP TABLE STUDENT;
SQLite Drop table 2

You can verify it by using .tables command.

SQLite Drop table 3

You can see only one table is here in the database. It means the other table is dropped.

Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +