Advertisement
Google Ad Slot: content-top
MySQL Drop Table
MySQL DROP TABLE Statement
The DROP TABLE statement in MySQL is used to permanently delete a table from a database, along with all its data, indexes, and structure. This action CANNOT be undone, so use it with caution.
Syntax:
DROP TABLE table_name;
table_nameis the name of the table you want to delete.
Example: Deleting a Table
DROP TABLE students;
- This command removes the
studentstable and all its data from the database.
Drop Multiple Tables at Once
You can delete multiple tables in one command:
Example: Deleting multiple Table
DROP TABLE students, courses, teachers;
Alternative: Use TRUNCATE Instead of DROP
If you want to delete all rows but keep the table structure, use:
Example
TRUNCATE TABLE students;
- This removes all data but keeps the table structure intact.