Which clause completes the code to return the last updated time of the most recent row for each customer?

Prepare for the DP-600 Fabric Analytics Engineer Exam. Study with flashcards and multiple choice questions, each offering hints and detailed explanations. Enhance your chances of success on the exam!

Multiple Choice

Which clause completes the code to return the last updated time of the most recent row for each customer?

Explanation:
Filter after ranking the rows within each customer. By using a window function like ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY updated_at DESC) AS X, you label each customer’s rows with X = 1 for the most recent one. The outer query then keeps only those rows with X = 1, returning the last updated time for each customer. HAVING would apply to grouped aggregates, not to the per-row result after windowing; FILTER is for aggregates as well, not for filtering the windowed result set.

Filter after ranking the rows within each customer. By using a window function like ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY updated_at DESC) AS X, you label each customer’s rows with X = 1 for the most recent one. The outer query then keeps only those rows with X = 1, returning the last updated time for each customer. HAVING would apply to grouped aggregates, not to the per-row result after windowing; FILTER is for aggregates as well, not for filtering the windowed result set.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy