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?

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?
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;

Answer: C

Explanation:

: The DELETE command in Delta Lake allows you to remove data that matches a predicate from a Delta table. This command will delete all the rows where the value in the column age is greater than 25 from the existing Delta table my_table and save the updated table. The other options are either incorrect or do not achieve the desired result. Option A will only select the rows that match the predicate, but not delete them. Option B will update the rows that match the predicate, but not delete them. Option D will update the rows that do not match the predicate, but not delete them. Option E will delete the rows that do not match the predicate, which is the opposite of what we want.

Reference: Table deletes, updates, and merges ― Delta Lake Documentation

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments