The DROP TABLE Statement

SQL provides a command to completely remove a table from a database. The DROP TABLE command deletes a table along with all its associated constraints and indexes. After this command has been issued, there is no turning back. The most common use of the DROP TABLE statement is when you have created a table for temporary use. When you have completed all operations on the table that you planned to do, issue the DROP TABLE statement the following syntax:

DROP TABLE table_name;

Here's how to drop the MAX_HITS table:

SQL> DROP TABLE MAX_HITS; Table dropped. mysql> drop table max_hits; Query OK, 0 rows affected (0.00 sec)  ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition 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.