Hard
Window Functions
Pro Challenge

Detect Price Changes and Previous Price

Return only actual product price changes, excluding each product's first event and unchanged consecutive events. Sequence by effective_at then price_event_id, so same-time corrections are deterministic. Return product_id, price_event_id, effective_at, previous_price and new_price. Return columns: product_id, price_event_id, effective_at, previous_price, new_price.

Preparing the interactive SQL workspace...

Challenge overview

What you will practice

Return only actual product price changes, excluding each product's first event and unchanged consecutive events. Sequence by effective_at then price_event_id, so same-time corrections are deterministic. Return product_id, price_event_id, effective_at, previous_price and new_price. Return columns: product_id, price_event_id, effective_at, previous_price, new_price.

Difficulty
Advanced
SQL concept
Window Functions