Your question is SQL Funnel Drop-Off Detection. Start with the requirements and the three tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Apple Store analytics receives user funnel events from a distributed warehouse. Write a PostgreSQL query that identifies consecutive missing steps in each user session's purchase funnel.
Use the canonical Apple Store funnel defined in funnel_steps. Report only missing-step streaks containing at least two consecutive steps.
| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Apple Store user identifier |
| country | VARCHAR(30) | User billing country |
| signup_date | DATE | Date the user registered |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique event identifier |
| user_id | INT | References apple_store_users.user_id |
| session_id | VARCHAR(20) | Apple Store browsing session |
| event_ts | TIMESTAMP | Timestamp when the event occurred |
| device_type | VARCHAR(20) | Client device category |
| Column | Type | Description |
|---|---|---|
| step_numberPK | INT | Canonical order of the funnel step |
| step_name | VARCHAR(30) | Canonical Apple Store funnel step name |