#1 Data Analytics Program in India
₹2,499₹1,499Enroll Now
Step 3
3 min read

DROP TABLE

Delete entire tables from your database.

What is DROP TABLE?

DROP TABLE deletes the entire table - structure and all data. Gone forever!

The Syntax

DROP TABLE table_name;

Example

DROP TABLE old_students;

After this, the old_students table no longer exists.

Safe Version: IF EXISTS

Use this to avoid errors if table doesn't exist:

DROP TABLE IF EXISTS old_students;

ALTER TABLE vs DROP TABLE

ALTER TABLE - Changes the table (add/remove columns)

ALTER TABLE students DROP COLUMN age; -- Table still exists, just without the age column

DROP TABLE - Deletes the entire table

DROP TABLE students; -- Table is completely gone!

Think of it this way:

  • ALTER = Renovate a house (change rooms)
  • DROP = Demolish the house (remove everything)

DELETE vs DROP

DELETE - Removes data, keeps table

DELETE FROM students; -- Table is empty but still exists

DROP - Removes table completely

DROP TABLE students; -- Table doesn't exist anymore

How DROP TABLE Works (Step by Step)

Step 1: Write DROP TABLE command

Step 2: Specify which table to delete

Step 3: Add semicolon ;

Step 4: Table is gone!

DROP TABLE old_data; -- Steps 1, 2, 3 → Table deleted!

When to Use DROP TABLE?

  • Removing test tables you don't need
  • Cleaning up old backup tables
  • Starting fresh with a new table design

Warning: DROP TABLE is permanent! Always backup important data first.

Finished this topic?

Mark it complete to track your progress and maintain your streak!