Write a SQL query to compare conversion rates before and after a product change using joins and aggregations.
Use the supplied tables to classify sessions before or after each product's change date. A conversion is counted when a session has at least one matching conversion record. Treat the period before the change as dates earlier than the change date, and the period after as dates on or after it.
Output
- One row per product change.
- Include
product_id, before and after session counts, conversion counts, conversion rates, and the rate change.
- Return products without sessions with zero counts and NULL rates. Order by
product_id ascending.