Your question is SQL: Purchase Rate by Country. Start with the requirements and the one table 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.
Meta's Product Growth team is reviewing January 2021 conversion across countries for a purchase-oriented surface. The dataset below is a denormalized activity snapshot containing active-user events and purchase counts, similar to a product-growth extract used alongside AARRR Funnel reporting.
Write a PostgreSQL query to calculate the percentage of active users in each country who made at least one purchase during January 2021.
| Column | Type | Description |
|---|---|---|
| activity_idPK | INT | Unique activity-event identifier |
| user_id | INT | Meta user identifier |
| country | VARCHAR(50) | User's country |
| activity_date | DATE | Date of the activity event |
| is_active | BOOLEAN | Whether the event qualifies as active usage |
| purchase_count | INT | Purchases attributed to the user on that event |