SQL · ByteDance · Medium
Write PostgreSQL for a four-stage purchase funnel — a shopper first views a product (view_product), then adds it to the cart (add_to_cart), then begins checkout (checkout_start), and finally buys it (purchase). Use the schema and the sample rows shown below. Sample rows: Every timestamp above is UTC, and the tables may contain repeated rows. Each part below says precisely how records must be reduced to one row per logical event before the metric is computed. Your queries…
Checking your access…