Databricks Certified Data Engineer Associate — Question 4
Which of the following code blocks will remove the rows where the value in column age is greater than 25 from the existing Delta table my_table and save the updated table?
Answer options
- A. SELECT * FROM my_table WHERE age > 25;
- B. UPDATE my_table WHERE age > 25;
- C. DELETE FROM my_table WHERE age > 25;
- D. UPDATE my_table WHERE age <= 25;
- E. DELETE FROM my_table WHERE age <= 25;
Correct answer: C
Explanation
The correct answer is C because the DELETE statement specifically removes rows that meet the condition, which in this case is having an age greater than 25. Option A just selects rows without modifying the table, B attempts to update without removing, while D and E incorrectly focus on retaining or deleting rows with ages less than or equal to 25.