Question 41
Open question ↗An auditor asks two separate things about a Unity Catalog managed Delta table `orders`:
1. "Show me the **entire table exactly as it was 3 days ago**, so I can compare a full snapshot to today."
2. "Going forward, give downstream ETL a way to read **only the row-level inserts, updates, and deletes** that occurred since the last run, without scanning the whole table."
You must satisfy requirement 1 using existing data and configure the table to satisfy requirement 2 from now on. Which combination should you implement?
```sql
-- Requirement 1: full snapshot of the table as of 3 days ago
SELECT * FROM orders <CLAUSE_1>;
-- Requirement 2: enable row-level change consumption going forward
ALTER TABLE orders <CLAUSE_2>;
```
- A.Requirement 1: `TIMESTAMP AS OF date_sub(current_date(), 3)` (time travel); Requirement 2: `SET TBLPROPERTIES (delta.enableChangeDataFeed = true)`.
- B.Requirement 1: enable change data feed and read `_change_type`; Requirement 2: `VERSION AS OF 0`.
- C.Requirement 1: `RESTORE TABLE orders TO VERSION AS OF 0`; Requirement 2: run `VACUUM orders RETAIN 0 HOURS`.
- D.Requirement 1: `DESCRIBE HISTORY orders`; Requirement 2: `OPTIMIZE orders ZORDER BY (order_id)`.