
Answer-first summary for fast verification
Answer: RESTORE TABLE products TO VERSION AS OF 20
The latest version of the table is 21, indicating that version 20 contains all the data before the accidental deletion. The correct syntax to restore a table to a previous version is `RESTORE TABLE [table_name] TO VERSION AS OF [version]`. For example, to restore the `employee` table to version 1, you would use `RESTORE TABLE employee TO VERSION AS OF 1;`. Therefore, the correct answer to restore the `products` table is `RESTORE TABLE products TO VERSION AS OF 20`.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
A junior data engineer accidentally executed a query that deleted all records from the Delta table products. After checking the table's history with DESCRIBE HISTORY products, the latest version is found to be 21. To undo the deletion and restore the table to its state before the accident, which SQL statement should you use?
A
ROLLBACK TABLE products TO VERSION 20
B
RESTORE products TO VERSION AS OF 19
C
ROLLBACK TABLE products TO VERSION 20
D
RESTORE products TO VERSION 19
E
RESTORE TABLE products TO VERSION AS OF 20
No comments yet.