
Answer-first summary for fast verification
Answer: DELETE FROM employees WHERE salary <= 3000;
To retain only employees with a salary greater than 3000, it's necessary to remove those with salaries less than or equal to 3000. This is achieved using the `DELETE` statement with the appropriate condition: `DELETE FROM table_name WHERE condition;`. For more details, refer to the [Databricks documentation](https://docs.databricks.com/sql/language-manual/delta-delete-from.html).
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.
The data engineering team has a Delta table called employees that contains the employees' personal information, including their gross salaries. Which of the following code blocks will ensure the table only retains employees with a salary greater than 3000?
A
SELECT CASE WHEN salary <= 3000 THEN DELETE ELSE UPDATE END FROM employees;
B
DELETE FROM employees WHERE salary <= 3000;
C
UPDATE employees WHERE salary > 3000 WHEN MATCHED SELECT;
D
DELETE FROM employees WHERE salary > 3000;
E
UPDATE employees WHERE salary <= 3000 WHEN MATCHED DELETE;