Web Analytics Made Easy - Statcounter
Tuesday , 31 January 2023
Home > MySql > Drop or Delete Table – SQL

Drop or Delete Table – SQL

Drop or Delete Table – SQL statement is used to remove a table definition and all data, indexes, triggers, constraints, and permission specifications for that table.

NOTE: You have to be careful while using this command because once a table is deleted then all the information available in the table would also be lost forever.


Basic syntax of DROP TABLE statement is as follows:

DROP TABLE table_name;


Let us first verify CUSTOMERS table and then we would delete it from the database:

| Field   | Type          | Null | Key | Default | Extra |
| ID      | int(11)       | NO   | PRI |         |       |
| NAME    | varchar(20)   | NO   |     |         |       |
| AGE     | int(11)       | NO   |     |         |       |
| ADDRESS | char(25)      | YES  |     | NULL    |       |
| SALARY  | decimal(18,2) | YES  |     | NULL    |       |
5 rows in set (0.00 sec)

This means CUSTOMERS table is available in the database, so let us drop it as follows:

Query OK, 0 rows affected (0.01 sec)

Now, if you would try DESC command, then you would get error as follows:

ERROR 1146 (42S02): Table 'TEST.CUSTOMERS' doesn't exist

Here, TEST is database name which we are using for our examples.

About Whendy

Whendy Blog mengumpulkan beberapa Tutorial Website, PHP, AngularJS, JQuery, Laravel, Codeigniter dan lain-lain. ( jika sempat ) :)

Check Also

Delete Query – SQL

Delete Query – SQL is used to delete the existing records from a table. You ...

One comment

  1. Very good blog you have here but I was curious if
    you knew of any community forums that cover the same
    topics discussed here? I’d really like to be a part of community where I can get advice from
    other knowledgeable people that share the same interest.
    If you have any suggestions, please let me know.
    Thanks a lot!

Leave a Reply

Your email address will not be published. Required fields are marked *