DROP TABLE

To delete a table definition, use a DROP TABLE statement. Its form is:

DROP TABLE [IF EXISTS] table-name

where:

  • IF EXISTS is optional, and it causes the drop statement to be ignored if a table with the specified name does not exist in the store. If this phrase is not specified, and the table does not currently exist, then the DROP statement will fail with an error.

  • table-name is the name of the table you want to drop.

Note that dropping a table is a lengthy operation because all table data currently existing in the store is deleted as a part of the drop operation.

If child tables are defined for the table that you are dropping, then they must be dropped first. For example, if you have tables:

  • myTable

  • myTable.childTable1

  • myTable.childTable2

then myTable.childTable1 and myTable.childTable2 must be dropped before you can drop myTable.