Your question is Average Revenue Per User SQL. Start with the requirements and the two 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.
Quantiphi's customer analytics reporting team needs the average revenue per registered user for the first two months of 2024. Revenue should include only completed payments made during the reporting period, while users with no qualifying revenue must remain in the denominator.
Write a PostgreSQL query to calculate ARPU, defined as total completed payment revenue divided by the total number of registered users.
status = 'completed' from 2024-01-01 through 2024-02-29.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique registered user identifier |
| user_name | VARCHAR(100) | User display name |
| acquisition_channel | VARCHAR(50) | User registration channel |
| Column | Type | Description |
|---|---|---|
| payment_idPK | INT | Unique payment identifier |
| user_id | INT | User associated with the payment |
| payment_date | DATE | Payment recording date |
| amount | DECIMAL(10,2) | Payment amount |
| status | VARCHAR(20) | Payment processing status |