Your question is Second-Highest Energy Consumer. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Write a query to find the second-highest energy-consuming household from a customer transactions table at Nextera Energy Services.
Calculate total energy consumption per household. Treat the second-highest value as the second distinct total, and return all households tied at that level.
household_id and total_energy_kwh.household_id ascending.| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| household_id | INT | Household associated with the transaction |
| energy_kwh | DECIMAL(10,2) | Energy consumed in kilowatt-hours |
| transaction_date | DATE | Date of the energy transaction |