Given a table of Wix user logins and a table of purchases, write a query to calculate the conversion rate of users who upgraded to premium within 7 days of their first login.
Treat completed premium purchases occurring from the first login timestamp through, but not including, seven days later as conversions. Ignore null user IDs and purchases that are not completed premium upgrades.
total_users, converted_users, and conversion_rate_pct.conversion_rate_pct rounded to two decimal places.| Column | Type | Description |
|---|---|---|
| login_idPK | INT | Unique login event identifier |
| user_id | INT | Wix user identifier |
| login_at | TIMESTAMP | Timestamp of the login event |
| platform | VARCHAR(30) | Platform used for the login |
| Column | Type | Description |
|---|---|---|
| purchase_idPK | INT | Unique purchase identifier |
| user_id | INT | Wix user who made the purchase |
| purchased_at | TIMESTAMP | Timestamp of the purchase |
| plan | VARCHAR(30) | Purchased plan type |
| status | VARCHAR(30) | Purchase processing status |
| amount | NUMERIC(10,2) | Purchase amount |