DROP TABLE

On this page

The DROP TABLE command allows you to delete a table. Be cautious when using this command, as once a table is dropped, all the data in the table is permanently deleted and cannot be recovered.

Syntax

The syntax for a DROP TABLE statement is:

DROP TABLE [IF EXISTS] table_name

Parameters

  • TABLE: Keyword used to specify that a table should be dropped.
  • IF EXISTS: This is an optional clause. If the IF EXISTS clause is included, the statement will not return an error if the specified table does not exist. If the IF EXISTS clause is not included and the specified table does not exist, the statement will result in an error.
  • table_name: The name of the table to be dropped.

Example

Here is an example of a DROP TABLE statement:

DROP TABLE IF EXISTS my_table

This example deletes the table my_table if it exists.

© Polypheny GmbH. All Rights Reserved.