Dropping a Table with DROP TABLE

Use the DROP TABLE statement to remove a table from a database. When you’re dropping a table, some important considerations are:

  • You can drop a base table or a temporary table.

  • A dropped table is gone forever. You can’t undo or roll back a DROP TABLE statement.

  • Dropping a table destroys its structure, data, indexes, constraints, permissions, and so on.

  • Dropping a table isn’t the same as deleting all its rows. You can empty a table of rows, but not destroy it, with DELETE FROM table;. See “Deleting Rows with DELETE” in Chapter 9.

  • Dropping a table doesn’t drop views that reference that table; see Chapter 12.

  • You’ll encounter problems with foreign keys or views that reference a dropped table unless they’re altered or ...

Get SQL: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.