inblog logo
|
silver
    SQL๋ฌธ์ œํ’€๊ธฐ

    [SQL๋ฌธ์ œํ’€๊ธฐ - Advent of SQL 2025 ๐ŸŽ…] A/B ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•œ ๋ฒ„ํ‚ท ๋‚˜๋ˆ„๊ธฐ 2

    silver's avatar
    silver
    Dec 23, 2025
    [SQL๋ฌธ์ œํ’€๊ธฐ - Advent of SQL 2025 ๐ŸŽ…] A/B ํ…Œ์ŠคํŠธ๋ฅผ ์œ„ํ•œ ๋ฒ„ํ‚ท ๋‚˜๋ˆ„๊ธฐ 2
    Contents
    ๋ฌธ์ œ๋‚ด๊ฐ€ ์ž‘์„ฑํ•œ ์ •๋‹ต

    ๋ฌธ์ œ

    solvesql.com
    solvesql.com
    https://solvesql.com/problems/ab-testing-buckets-2/

    ๋‚ด๊ฐ€ ์ž‘์„ฑํ•œ ์ •๋‹ต

    MySQL, PostgreSQL, SQLite

    with a as (select *,case when customer_id%10=0 then 'A' else 'B' end bucket from transactions), b as (select customer_id, count(transaction_id) tr, sum(total_price) pr, bucket from a where not is_returned group by customer_id, bucket) select bucket, count(distinct customer_id) user_count, round(avg(tr),2) avg_orders, round(avg(pr),2) avg_revenue from b group by bucket;
    Share article

    silver

    RSSยทPowered by Inblog