Your question is Monthly Revenue by Segment. Start with the requirements and the three 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.
Regions Financial wants a monthly view of revenue generated across its customer segments. Write a PostgreSQL query that summarizes posted transaction revenue for the first quarter of 2025.
customer_segments and card_transactions using their related keys.status = 'posted' from January through March 2025, using a half-open date range.| Column | Type | Description |
|---|---|---|
| segment_idPK | INT | Unique customer segment identifier |
| segment_name | VARCHAR(50) | Business name of the customer segment |
| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer's display name |
| segment_id | INT | Reference to customer_segments |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| customer_id | INT | Reference to customers |
| posted_at | DATE | Date the transaction was posted |
| revenue_amount | DECIMAL(12,2) | Revenue amount associated with the transaction |
| status | VARCHAR(20) | Processing status of the transaction |