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.
The syntax for a
DROP TABLE statement is:
DROP TABLE [IF EXISTS] table_name
TABLE: Keyword used to specify that a table should be dropped.
IF EXISTS: This is an optional clause. If the
IF EXISTSclause is included, the statement will not return an error if the specified table does not exist. If the
IF EXISTSclause 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.
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.