Building a Multi-Step Funnel
Counting users who reach each ordered step and computing step conversion rates.
What a Funnel Question Really Tests
When an interviewer says "build me a signup funnel", they are testing whether you can count distinct users who reach each ordered step and express drop-off between them.
A funnel has stages like visit -> signup -> activate -> purchase. The deliverable is usually one row per step with a user count and a conversion rate.
- Count users, not events (one user firing an event twice is still one user).
- Steps are ordered; reaching step 3 implies you passed steps 1 and 2.
The Event Table You Will Be Given
Almost every funnel question hands you a single events table in long form. Picture this shape:
user_idwho did the actionevent_namesuch as 'visit', 'signup', 'purchase'event_timea timestamp
One row per action. Your job is to reshape this into a step-by-step count. Always confirm the exact event names with the interviewer before writing SQL.
CREATE TABLE events (
user_id INT,
event_name VARCHAR(50),
event_time TIMESTAMP
);All lessons in this course
- Building a Multi-Step Funnel
- Ordered Events and Time Windows
- A/B Test Assignment and Metrics
- Lift, Significance and Guardrails in SQL