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
DROPTABLE students;
This command removes the students table and all its data from the database.
Drop Multiple Tables at Once
You can delete multiple tables in one command:
Example: Deleting multiple Table
DROPTABLE 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.
We use cookies and similar technologies to enhance your browsing experience, serve personalized content and advertisements, and analyze our traffic.
By clicking "Accept All", you consent to our use of cookies and the processing of your personal data for these purposes.
You can manage your preferences or learn more in our
Privacy Policy and
Cookie Policy.