Your team runs A/B tests that split users into a control and a treatment arm. For each experiment, report the conversion rate of each arm, the lift of treatment over control, and a 95% confidence interval for the difference, all in one query.
Table assignments (each (experiment_id, user_id) pair appears once; a user can be in several experiments):
experiment_id VARCHARuser_id INTEGERvariant VARCHAR, 'control' or 'treatment'assigned_date DATETable conversions (zero, one or many rows per user):
user_id INTEGERconverted_date DATEA user converted in an experiment if they have at least one conversion on or after their assigned_date in that experiment. Conversions before assignment do not count.
With the users per arm and the share of them who converted, return one row per experiment with:
experiment_id, n_control, n_treatmentrate_control , rate_treatment abs_lift rel_lift , NULL when ci_low, ci_high , where
Round the six rate columns to 4 decimals at the very end (compute from unrounded values). Every experiment has at least one user in each arm. Row order does not matter.