By Alvin Alexander. Last updated: June 4, 2016
SQLite table FAQ: How do I drop a SQLite table? (i.e., "What is the SQLite DROP TABLE syntax?")
SQLite comes with the usual DROP TABLE command, so you can drop a SQLite database table named "orders" like this:
sqlite> drop table orders;
SQLite drop table commands in a script
If you're executing SQLite drop table
commands in a SQLite script, you may want to add a little bit of programming to this to account for possible errors. In this case, you can write your SQLite drop table
commands like this:
drop table if exists orders
or if you prefer to add the database name to the drop table
statement, you can also write that command like this:
drop table if exists mydatabase.orders
That SQLite drop table
command assumes your database is named mydatabase
, and the table you want to drop is named orders
.