Write a SQL query using joins to combine customer, transaction, and merchant tables.
Return one row for every transaction, including transactions whose customer or merchant reference is missing.
transaction_id, transaction_date, customer_name, transaction_amount, merchant_name, and merchant_categoryUnknown customer, Unknown merchant, or Uncategorized when the related value is missingtransaction_date ascending, then transaction_id ascending| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer full name |
| customer_segment | VARCHAR(30) | Customer segmentation label |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| customer_id | INT | Customer associated with the transaction |
| merchant_id | INT | Merchant associated with the transaction |
| transaction_date | DATE | Date the transaction occurred |
| transaction_amount | NUMERIC(12,2) | Transaction amount |
| Column | Type | Description |
|---|---|---|
| merchant_idPK | INT | Unique merchant identifier |
| merchant_name | VARCHAR(120) | Merchant display name |
| merchant_category | VARCHAR(50) | Merchant business category |