Your question is Cohort Payment Trends 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.
Rover's Business Analytics team wants to monitor payment performance across user cohorts. Write a PostgreSQL query that summarizes the last four calendar quarters represented by payment activity for selected Rover cohorts.
users to payments and include only the New Sitter, Experienced Sitter, and New Pet Parent cohorts.status = 'succeeded' as successful financial activity. Use 0 for financial totals when no payment in a group qualifies.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique Rover user identifier |
| cohort_label | VARCHAR(40) | Business-defined user cohort |
| signup_date | DATE | Date the user joined Rover |
| Column | Type | Description |
|---|---|---|
| payment_idPK | INT | Unique payment attempt identifier |
| user_id | INT | User associated with the payment attempt |
| payment_date | DATE | Date of the payment attempt |
| status | VARCHAR(20) | Payment processing status |
| amount | NUMERIC(10,2) | Payment amount before Rover fees |
| rover_fee | NUMERIC(10,2) | Fee retained by Rover |
| payment_method | VARCHAR(20) | Payment method used |