0
0
SQLquery~10 mins

TRUNCATE vs DELETE vs DROP in SQL - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to remove all rows from the table quickly without logging individual row deletions.

SQL
TRUNCATE TABLE [1];
Drag options to blanks, or click blank then click option'
ADROP
Busers
CDELETE
DTABLE
Attempts:
3 left
💡 Hint
Common Mistakes
Using DELETE instead of TRUNCATE for fast removal.
Writing DROP instead of the table name.
2fill in blank
medium

Complete the code to delete rows from the table named 'orders' where the status is 'cancelled'.

SQL
DELETE FROM orders WHERE status = '[1]';
Drag options to blanks, or click blank then click option'
Acompleted
Bpending
Ccancelled
Dshipped
Attempts:
3 left
💡 Hint
Common Mistakes
Deleting rows with the wrong status value.
Forgetting to put the status value in quotes.
3fill in blank
hard

Fix the error in the code to remove the entire table named 'products' from the database.

SQL
[1] TABLE products;
Drag options to blanks, or click blank then click option'
ADROP
BTRUNCATE
CDELETE
DREMOVE
Attempts:
3 left
💡 Hint
Common Mistakes
Using DELETE or TRUNCATE which only remove data, not the table.
Using REMOVE which is not a valid SQL command.
4fill in blank
hard

Fill both blanks to write a command that deletes all rows from 'employees' but keeps the table structure intact.

SQL
[1] FROM employees WHERE [2];
Drag options to blanks, or click blank then click option'
ADELETE
BDROP
C1=1
DTRUNCATE
Attempts:
3 left
💡 Hint
Common Mistakes
Using DROP which deletes the table itself.
Leaving out the WHERE clause which deletes all rows anyway but is less explicit.
5fill in blank
hard

Fill all three blanks to write a command that quickly removes all rows from 'logs' and resets identity counters if supported.

SQL
[1] TABLE [2] RESTART IDENTITY [3];
Drag options to blanks, or click blank then click option'
ATRUNCATE
Blogs
CCASCADE
DDELETE
Attempts:
3 left
💡 Hint
Common Mistakes
Using DELETE which is slower and does not reset identity.
Omitting CASCADE when dependent tables exist.