0
0
SQLquery~10 mins

DELETE vs TRUNCATE behavior 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 delete all rows from the table named 'employees'.

SQL
DELETE FROM [1];
Drag options to blanks, or click blank then click option'
Aemployee
Bemp
Cemployees
Dstaff
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong table name like 'employee' or 'emp'.
Forgetting the semicolon at the end.
2fill in blank
medium

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

SQL
TRUNCATE TABLE [1];
Drag options to blanks, or click blank then click option'
Aorders
Border_table
Corder_list
Dorder
Attempts:
3 left
💡 Hint
Common Mistakes
Using singular form 'order' instead of 'orders'.
Confusing TRUNCATE with DELETE syntax.
3fill in blank
hard

Fix the error in the command to delete rows from 'customers' where the city is 'Paris'.

SQL
DELETE FROM customers WHERE city [1] 'Paris';
Drag options to blanks, or click blank then click option'
A===
B==
Cequals
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' or '===' instead of '='.
Writing 'equals' as a word instead of '='.
4fill in blank
hard

Fill both blanks to write a command that deletes all rows from 'products' but logs each deletion.

SQL
DELETE FROM [1] WHERE [2];
Drag options to blanks, or click blank then click option'
Aproducts
B1=1
CTRUE
D0=0
Attempts:
3 left
💡 Hint
Common Mistakes
Using TRUNCATE instead of DELETE for logging.
Using a false condition in WHERE clause.
5fill in blank
hard

Fill the blanks to write a command that truncates the 'logs' table and resets identity counters.

SQL
TRUNCATE TABLE [1] [2] RESTART IDENTITY;
Drag options to blanks, or click blank then click option'
Alogs
BCASCADE
CONLY
DIF EXISTS
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting CASCADE when dependent tables exist.
Forgetting RESTART IDENTITY.