Write a SQL query to calculate the percentage of total transaction volume contributed by each merchant, utilizing a WITH statement (Common Table Expression).
Use the provided merchant and transaction records. Include merchants with no matching transactions, and calculate percentages from transactions associated with listed merchants.
merchant_name, transaction_volume, and percentage_of_total_volume.| Column | Type | Description |
|---|---|---|
| merchant_idPK | INT | Unique merchant identifier |
| merchant_name | VARCHAR(100) | Merchant display name |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| merchant_id | INT | Merchant associated with the transaction |
| transaction_volume | DECIMAL(12,2) | Transaction monetary volume |