MySQL FAQs
FAQs Categories
Client Server Commands
Database Structure
Table Types or Storage Engines
Indexes
SQL Statements
Table Joins
Funtions and Operators
Tricky Select Queries
Speed Up Queries
Data Back Up
General Questions
Errors
1PLs Company - #1Payday.Loans Agency - Loans online and near me $100-$2500 (Same Day)
Powered by MySQL
 
Home / Database Structure / Tables / Question No: 80

How to drop all existing tables in one go?

I want to drop / delete my all existing tables from the database. Is it possible to drop them in one go?

Answer No: 80

To remove a table when you no longer need it, use the DROP TABLE statement:

DROP TABLES tbl_users;

In MySQL, a single DROP TABLE statement can name several tables to be dropped simultaneously. So you can use DROP TABLES statement giving table names separated by comma (,). Take an example as below:

DROP TABLES tbl_users,  tbl_category, tbl_products;

Normally, an error occurs if you attempt to drop a table that does not exist. To prevent an error from occurring if a table does not exist when you attempt to drop it, add an IF EXISTS clause to the statement:

DROP TABLE IF EXISTS no_such_table;

Note: If you drop a table by mistake, you must recover it from backups, so be careful.

Related MySQL FAQs to the Above FAQ

How-to-create-table-in-MySQL How to create table in MySQL?

How-to-create-table-based-on-existing-tables How to create table based on existing tables?

What-is-temporary-table-and-how-to-create-it-in-MySQL What is temporary table and how to create it in MySQL?

How-to-describe-a-table-in-MySQL How to describe a table in MySQL?

How-to-renaming-a-table-in-MySQL How to renaming a table in MySQL?

How-to-specify-multiple-alterations-for-a-table How to specify multiple alterations for a table?

How-to-get-table-metadata How to get table metadata?

How-to-add-new-column-into-an-existing-table-in-MySQL How to add new column into an existing table in MySQL?

How-to-add-a-new-AUTO_INCREMENT-field-to-an-existing-table How to add a new AUTO_INCREMENT field to an existing table?

How-to-drop-a-column-from-the-existing-table How to drop a column from the existing table?

How-to-get-columns-of-an-existing-table-in-MySQL How to get columns of an existing table in MySQL?

How-to-change-data-type-of-an-existing-column How to change data type of an existing column?

How-to-delete-table-records How to delete table records?

How-to-set-AUTO_INCREMENT-value-other-than-1-in-MySQL How to set AUTO_INCREMENT value other than 1 in MySQL?

How-to-get-copy-of-table-structure-in-MySQL-using-query How to get copy of table structure in MySQL using query?

How-to-get-constraints-or-keys-of-the-existing-table How to get constraints or keys of the existing table?

About FAQs: Recently Added FAQs

About MySQL FAQs: Site Map | Bookmark Us

Useful Links: Wikipedia.org | Oracle.com | w3schools.com | www.php.net | Github.com

© 2024  www.mysqlfaqs.net
All rights reserved.