Your question is Consecutive Month Purchasers. 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.
Revature wants to identify customers who remain active across consecutive calendar months. Write a PostgreSQL query that analyzes purchase history and returns every consecutive month pair for each qualifying customer.
| Column | Type | Description |
|---|---|---|
| customer_idPK | INTEGER | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer's name |
| Column | Type | Description |
|---|---|---|
| purchase_idPK | INTEGER | Unique purchase identifier |
| customer_id | INTEGER | References customers.customer_id |
| purchased_at | TIMESTAMP | Timestamp when the purchase occurred |
| amount | NUMERIC(10,2) | Purchase amount |