Write a SQL query to find the second-highest energy consumption record for each utility customer from a transaction table at Smart Energy Water.
Treat second-highest as the second distinct consumption value for each customer. Include every transaction tied at that value.
customer_id, transaction_id, and energy_consumption.customer_id, then transaction_id.| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique identifier for the energy transaction |
| customer_id | VARCHAR(20) | Utility customer identifier |
| transaction_date | DATE | Date when the consumption was recorded |
| energy_consumption | NUMERIC(12,2) | Energy consumed during the transaction period |