Ultimate access to all questions.
A broadband company uses a delta table named bills
with Change Data Feed enabled to store the latest bills of all customers. The table is updated whenever a new bill is generated, with only the bill_date
and amount
columns being updated for existing customers. If a customer leaves the company, their bill details are deleted from the bills
table. Which query should be used to retrieve the list of all customers along with the details of their first-ever bill?
Explanation:
The correct answer is option E. When Change Data Feed is enabled for a delta table, the table_changes()
function can be used to access change data logs. To retrieve the initial bill details for all customers, you should query the table_changes('bills', 0)
with a filter on _change_type = 'insert'
, as this captures the first insertion of each customer's bill. This approach ensures you only get the original bill details without subsequent updates or deletions.