← QCE Digital Solutions Unit 3

SQL DROP TABLE

Permanently deletes a whole table, its structure and all its records. Unlike DELETE, which only removes rows, it cannot be undone and can fail if other tables reference it.

Understanding SQL DROP TABLE in QCE Digital Solutions Unit 3

What it does: DROP TABLE with the table name removes the table and everything in it. orders holds a foreign key to students, so orders is dropped first. Dropping students first could fail because orders still references it. The whole table is gone, so the query fails. An empty result with headings is what you would see after DELETE FROM results;. DROP TABLE cannot be undone. Take a backup before running it, especially on a real solution. This is a mistake because the student wants to remove only some rows, which is a job for DELETE, not DROP TABLE.

Common mistakes: The statement is missing the TABLE keyword. To delete a whole table you must write DROP TABLE tmp;. DELETE TABLE is not valid SQL. DELETE only removes rows (DELETE FROM). To remove the whole table, structure and all, use DROP TABLE orders;.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 251–337) and word search (Modules 194–337).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which statement removes a whole table, including its structure?
DELETE FROM students;DROP TABLE students;
Matches
DROP TABLE students WHERE house = 'Red';
↓
DROP TABLE cannot use a WHERE clause because it removes the whole table. To remove only some rows, use DELETE FROM students WHERE house = 'Red';
Applying
Meanings
Term
DROP TABLE
Meaning
Permanently deletes a whole table, its structure and all its records. Unlike DELETE, which only removes rows, it cannot be undone and can fail if other tables reference it.
Practice
DROP TABLE orders;
Testing
Gaps
TABLE students;
Check Answer
Spots
2INSERT INTO tmp VALUES (1);
3DROP tmp;

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Chambered Nautilus' badge — File Explorer, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which statement removes a whole table, including its structure?
A. DELETE FROM students;
B. DROP TABLE students; ✓
DROP TABLE removes the table and its structure. DELETE FROM only removes the rows and leaves an empty table.
2. After DELETE FROM products; runs with no WHERE clause, what is left?
A. Nothing, the products table no longer exists
B. An empty products table with its columns ✓
DELETE removes rows only. The table structure stays, so you can still INSERT new records. DROP TABLE would remove the table itself.
3. Which is the correct syntax to drop a table called orders?
A. DROP TABLE orders; ✓
B. DROP orders TABLE;
The syntax is DROP TABLE followed by the table name.
4. You run DROP TABLE results; and then SELECT * FROM results; What happens?
A. An error, because the table no longer exists ✓
B. An empty result with the column headings
The whole table is gone, so the query fails. An empty result with headings is what you would see after DELETE FROM results;
5. Can you reliably undo a DROP TABLE after it runs?
A. No, it is permanent unless you have a backup ✓
B. Yes, the table comes back if you re-run SELECT
DROP TABLE cannot be undone. Take a backup before running it, especially on a real solution.

Match the Pairs

DROP TABLE orders; → Permanently removes the orders table, including its structure and every record in it
DELETE FROM orders; → Removes every row from orders but keeps the empty table and its structure
To remove a table that is no longer needed, including its structure and all its data, use DROP TABLE → DROP TABLE products;
A table that other tables reference through a foreign key may need those child tables dropped first → DROP TABLE orders; DROP TABLE students;
DROP TABLE students WHERE house = 'Red'; → DROP TABLE cannot use a WHERE clause because it removes the whole table. To remove only some rows, use DELETE FROM students WHERE house = 'Red';
DROP students; → The TABLE keyword is missing. The correct statement is DROP TABLE students;

Key Term

DROP TABLE
Permanently deletes a whole table, its structure and all its records. Unlike DELETE, which only removes rows, it cannot be undone and can fail if other tables reference it.

Fill in the Blanks

1. DROP TABLE students;
Hint: Type the keyword that permanently removes a whole table, not just its rows.
2. -- delete the subjects table completely DROP TABLE subjects;
Hint: Type the name of the table being removed, as described in the comment.
3. -- orders has a FOREIGN KEY to students DROP TABLE orders; DROP TABLE students;
Hint: Type the child table that must be dropped first, before the table it references.
4. DELETE FROM products WHERE stock = 0;
Hint: Type the keyword that removes only some rows and leaves the table structure in place.
5. -- removes the table and all its records DROP TABLE products;
Hint: Type the keyword that says what kind of object is being dropped.

Spot the Error

Question 1
A CREATE TABLE tmp (id INT);
B INSERT INTO tmp VALUES (1);
C DROP tmp;
Line C — The statement is missing the TABLE keyword. To delete a whole table you must write DROP TABLE tmp;
Question 2
A DELETE TABLE orders;
B CREATE TABLE orders (
C orderId INT PRIMARY KEY,
D quantity INT
E );
Line A — DELETE TABLE is not valid SQL. DELETE only removes rows (DELETE FROM). To remove the whole table, structure and all, use DROP TABLE orders;
Question 3
A -- Empty the table, keep it
B -- so it can be refilled later
C DROP TABLE students;
Line C — The comments say the table must be kept. DROP TABLE would destroy its structure as well as its records. DELETE FROM students; removes only the rows.
Question 4
A DROP orders TABLE;
B DROP TABLE students;
C DROP TABLE products;
Line A — The keywords are in the wrong order. The correct syntax is DROP TABLE followed by the table name: DROP TABLE orders;
Question 5
A -- Remove the child table first
B DROP TABLE FROM results;
C DROP TABLE subjects;
Line B — FROM belongs to DELETE FROM, not DROP TABLE. DROP TABLE takes the table name straight after it: DROP TABLE results;

Student with a class code? Join your class →