Write a SQL query using window functions and Common Table Expressions (CTEs) to find the running total of client transactions.
Use the provided clients and transactions tables. Include only transactions associated with a known client, treat a NULL amount as zero for accumulation, and use transaction ID to break date ties.
transaction_id, client_id, client_name, transaction_date, amount, and running_total.| Column | Type | Description |
|---|---|---|
| client_idPK | INT | Unique client identifier |
| client_name | VARCHAR(100) | Client display name |
| client_segment | VARCHAR(30) | Optional client segment |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| client_id | INT | Client associated with the transaction |
| transaction_date | DATE | Date of the transaction |
| amount | NUMERIC(12,2) | Transaction amount |