0
0
MySQLquery~10 mins

DELETE with WHERE clause in MySQL - Interactive Code Practice

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

Complete the code to delete rows from the table named 'employees'.

MySQL
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 like 'employee' or 'emp'.
Forgetting the table name entirely.
2fill in blank
medium

Complete the code to delete employees whose department is 'Sales'.

MySQL
DELETE FROM employees WHERE department = '[1]';
Drag options to blanks, or click blank then click option'
ASales
BHR
CMarketing
DFinance
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong department name.
Forgetting the quotes around the string value.
3fill in blank
hard

Fix the error in the DELETE statement to remove employees with salary less than 30000.

MySQL
DELETE FROM employees WHERE salary [1] 30000;
Drag options to blanks, or click blank then click option'
A>
B<
C=
D>=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of a comparison operator.
Using '>' which deletes employees with salary greater than 30000.
4fill in blank
hard

Fill both blanks to delete employees who are in department 'HR' and have salary greater than 50000.

MySQL
DELETE FROM employees WHERE department = '[1]' AND salary [2] 50000;
Drag options to blanks, or click blank then click option'
AHR
B<
C>
DSales
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the comparison operator.
Using wrong department name.
5fill in blank
hard

Fill all three blanks to delete employees whose name starts with 'J', are in 'Marketing' department, and have salary less than 40000.

MySQL
DELETE FROM employees WHERE name LIKE '[1]' AND department = '[2]' AND salary [3] 40000;
Drag options to blanks, or click blank then click option'
AJ%
BMarketing
C<
DSales
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of LIKE for name pattern.
Wrong department or comparison operator.