How would you approach a medium difficulty SQL exercise combined with probability questions in an interview?
Use the provided experiment exposure and conversion-event data. Write a PostgreSQL query that calculates the probability of conversion for each non-null variant in experiment 1 during January 2026, then ranks variants by that probability.
Output
- One row per variant, with
variant, exposed_exposures, converted_exposures, conversion_probability, and variant_rank.
- Include only January exposures belonging to experiment 1 and exclude null variants. Count an exposure as converted when it has at least one conversion event.
- Sort by
variant_rank ascending, then variant ascending.