DROP
DROP removes a schema object. IF EXISTS suppresses the error when the named object is absent; it does not suppress other failures.
Syntax
text
DROP TABLE [IF EXISTS] [schema.]name
DROP VIEW [IF EXISTS] [schema.]name
DROP INDEX [IF EXISTS] [schema.]name
DROP TRIGGER [IF EXISTS] [schema.]nameDropping a table removes its rows and associated indexes and triggers. Dropping a view removes its query definition. Dropping an index leaves the table rows in place.
DROP DATABASE is not a SQL command. Managed server database inventory has a separate management interface.
Examples
Removing a table
sql
CREATE TABLE obsolete(id INTEGER);
DROP TABLE obsolete;sql
SELECT count(*)
FROM sqlite_schema
WHERE name = 'obsolete'
FORMAT csv;text
0Removing an optional object
sql
DROP TABLE IF EXISTS optional_staging;The statement succeeds even when optional_staging does not exist.
Use DELETE to remove rows while retaining a table's definition.