Your question is Attribution: Clicked But Not Purchased. 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.
Asana Spa's marketing team wants to identify users who clicked an ad but did not complete a purchase within seven days of any recorded click. Write a PostgreSQL query that returns these users for campaign follow-up.
user_id.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique Asana Spa user identifier |
| VARCHAR(255) | User email address |
| Column | Type | Description |
|---|---|---|
| click_idPK | INT | Unique ad click identifier |
| user_id | INT | User who clicked the advertisement |
| campaign_name | VARCHAR(100) | Asana Spa marketing campaign name |
| clicked_at | TIMESTAMP | Timestamp when the ad was clicked |
| Column | Type | Description |
|---|---|---|
| purchase_idPK | INT | Unique purchase identifier |
| user_id | INT | User who completed the purchase |
| purchased_at | TIMESTAMP | Timestamp when the purchase was completed |
| amount | DECIMAL(10,2) | Purchase amount |