Write an SQL query to join two tables and calculate monthly revenue by customer segment.
Use the provided customer and transaction data. Include matched transactions, label customers without a segment as Unsegmented, and exclude transactions without a matching customer.
revenue_month, customer_segment, and total_revenue| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer name |
| segment | VARCHAR(50) | Customer classification |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| customer_id | INT | Customer associated with the transaction |
| transaction_date | DATE | Date of the transaction |
| amount | DECIMAL(12,2) | Transaction revenue amount |