
Ultimate access to all questions.
Deep dive into the quiz with AI chat providers.
We prepare a focused prompt with your quiz and certificate details so each AI can offer a more tailored, in-depth explanation.
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;
Explanation:
To remove rows from a Delta table where a condition is met, you need to use the DELETE statement with a WHERE clause that specifies which rows to delete.
Let's analyze each option:
A. SELECT * FROM my_table WHERE age > 25;
B. UPDATE my_table WHERE age > 25;
UPDATE statement requires a SET clause to specify what columns to update. Even if it were complete, it would update rows, not delete them.C. DELETE FROM my_table WHERE age > 25;
my_table where the age column value is greater than 25. The DELETE FROM syntax removes entire rows that match the condition.D. UPDATE my_table WHERE age <= 25;
SET clause.E. DELETE FROM my_table WHERE age <= 25;
Key Points:
DELETE is used to remove rows from a tableWHERE clause specifies which rows to deleteDELETE operations are transactional and maintain ACID propertiesDELETE FROM table_name WHERE condition;