0
0
SQLquery~10 mins

DELETE without WHERE (danger) in SQL - 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 all rows from the table named 'employees'.

SQL
DELETE FROM [1];
Drag options to blanks, or click blank then click option'
Aemployees
Bemployee
Cemp
Dstaff
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong table name like 'employee' or 'emp' which does not exist.
2fill in blank
medium

Complete the code to delete only rows where the department is 'Sales'.

SQL
DELETE FROM employees WHERE department = [1];
Drag options to blanks, or click blank then click option'
A'HR'
B'Sales'
C'Finance'
D'Marketing'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different department name or missing quotes around the string.
3fill in blank
hard

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

SQL
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 '=' or '>' which deletes wrong rows or none.
4fill in blank
hard

Fill both blanks to delete employees who joined before 2020 and work in the 'HR' department.

SQL
DELETE FROM employees WHERE join_year [1] 2020 AND department = [2];
Drag options to blanks, or click blank then click option'
A<
B>
C'HR'
D'IT'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' instead of '<' or wrong department name.
5fill in blank
hard

Fill all three blanks to delete employees with salary greater than 50000, in 'Marketing' department, who joined after 2018.

SQL
DELETE FROM employees WHERE salary [1] 50000 AND department = [2] AND join_year [3] 2018;
Drag options to blanks, or click blank then click option'
A<
B>
C'Marketing'
D>=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' for salary or join_year conditions.
Missing quotes around department name.