SQLite: DROP TABLE Statement
This SQLite tutorial explains how to use the SQLite DROP TABLE statement with syntax and examples.
Description
The SQLite DROP TABLE statement allows you to remove or delete a table from the SQLite database.
Syntax
The syntax for the DROP TABLE statement in SQLite is:
DROP TABLE [ IF EXISTS ] table_name;
Parameters or Arguments
- table_name
- The name of the table to remove from the database.
- IF EXISTS
- Optional. If specified, the DROP TABLE statement will not raise an error if one of the tables does not exist.
Note
- If you use the SQLite DROP TABLE statement to drop a table that does not exist, the database will raise an error (unless you specify the IF EXISTS parameter in the DROP TABLE statement).
Example
Let's look at an example that shows how to drop a table using the SQLite DROP TABLE statement.
Drop One Table
First, let's look at a simple DROP TABLE example that shows how to use the DROP TABLE statement to drop one table in SQLite.
For example:
DROP TABLE employees;
This DROP TABLE example would delete the table called employees.
Advertisements