Write a query to return every row in price_snapshots with effective_price, the latest non-NULL price_usd reported for that SKU at or before the row. A NULL input means no new price was reported; it does not withdraw the previous price.
Return stale_days as the whole elapsed days from the snapshot that supplied the effective price to the current snapshot. A row reporting its own price has 0 stale days. If the SKU has not yet received a price, both calculated values are NULL.
Order each SKU’s history by captured_at, then snapshot_id, both ascending. Return captured_at as text using strftime with '%Y-%m-%d %H:%M:%S'.
Ordering: Sort by sku, then captured_at, then snapshot_id in ascending order.