How would you write a query to find the second-highest transaction value for each client department using window functions?
Use the provided department and transaction data. Treat the second-highest value as the second-highest distinct non-null transaction value.
department_name, second_highest_transaction_value.department_name ascending.| Column | Type | Description |
|---|---|---|
| department_idPK | INT | Unique identifier for a client department |
| department_name | VARCHAR(100) | Name of the client department |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique identifier for a transaction |
| department_id | INT | Department associated with the transaction |
| transaction_value | DECIMAL(12,2) | Monetary value of the transaction |