SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ

Ordered Purchase Funnel

Unsolved

Amazon's growth team tracks a three-step funnel: `view` -> `add_to_cart` -> `purchase`. A user counts toward a step only if they completed the previous steps first, using each user's earliest event of each type: the first `add_to_cart` must be after the first `view`, and the first `purchase` must be after the first `add_to_cart`. A user who purchased without viewing, or who added to cart before ever viewing, does not count for later steps. Write an SQL query that returns a single row with `viewed_users`, `carted_users`, `purchased_users`, `view_to_cart_pct` (carted / viewed * 100, rounded to 2 decimals) and `cart_to_purchase_pct` (purchased / carted * 100, rounded to 2 decimals).

SQL Query Editor (Ctrl+Enter to run)
0 characters · Valid
Canonical Solution Official

Official Solution is Hidden

Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.

Community Q&A & Discussion

Ask questions, share alternate queries, and explore solutions

0 comments
Asked By:
🏢 Shopify🏢 Amazon🏢 Stripe

Submission History

Your recent query executions and answer checks

Execution Pipeline:
FROM web_events
Full source dataset
15 rows total
Ready. Type a query to see live execution.
Clause: Auto-Sync · AlaSQL Engine