0
0
SQLquery~10 mins

Why DELETE needs caution in SQL - Test Your Understanding

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'
Aemp
Bemployee
Cemployees
Dstaff
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong table name causes an error or deletes nothing.
Misspelling the table name.
2fill in blank
medium

Complete the code to delete only employees with the job title 'Intern'.

SQL
DELETE FROM employees WHERE job_title = [1];
Drag options to blanks, or click blank then click option'
A'Intern'
B'Manager'
C'Engineer'
D'Clerk'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around text values.
Deleting the wrong job title.
3fill in blank
hard

Fix the error in the DELETE statement to remove employees hired before 2020.

SQL
DELETE FROM employees WHERE hire_date [1] '2020-01-01';
Drag options to blanks, or click blank then click option'
A>
B<
C=
D>=
Attempts:
3 left
💡 Hint
Common Mistakes
Using greater than deletes employees hired after 2020.
Using equal deletes only those hired exactly on 2020-01-01.
4fill in blank
hard

Fill both blanks to delete employees from the 'sales' department hired after 2018.

SQL
DELETE FROM employees WHERE department = [1] AND hire_date [2] '2018-12-31';
Drag options to blanks, or click blank then click option'
A'sales'
B'marketing'
C>
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong department name.
Using less than or equal operator deletes wrong rows.
5fill in blank
hard

Fill all three blanks to delete employees with salary less than 30000 and job title 'Assistant'.

SQL
DELETE FROM [1] WHERE salary [2] [3] AND job_title = 'Assistant';
Drag options to blanks, or click blank then click option'
Aemployees
B<
C30000
Dstaff
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong table name.
Using quotes around salary number.
Using wrong comparison operator.