Write a SQL query using window functions to find the second-highest transaction amount for each customer.
Use the transactions table. Treat the second-highest amount as the second-highest distinct non-null amount. Customers with fewer than two distinct non-null amounts should be excluded.
customer_id, second_highest_amountcustomer_id ascending| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| customer_id | INT | Identifier of the customer who made the transaction |
| amount | NUMERIC(12,2) | Transaction amount |