Solar Installer Working Percentage (2021)
Problem
Using the same solar dataset (`Installers`, `Requests`, `Bookings`), report, for **each month of 2021** (1..12), the percentage of active installers who actually worked that month.
- An installer is **active** in month m if onboarded on or before the end of month m (prior-year joiners count in every month).
- An installer **worked** in month m if they have a booking whose request was made in that month of 2021.
- `worked_pct` = round(distinct working installers * 100 / active installers, 2); report 0 when there are no active installers.
Every month 1..12 appears. Rows may be in any order.
Tables
Example rows — the live problem includes the full dataset.
| installer_id | onboarded_on |
|---|---|
| 10 | 2020-12-10 |
| 8 | 2021-01-13 |
| 5 | 2021-02-16 |
| request_id | household_id | requested_on |
|---|---|---|
| 6 | 75 | 2020-12-09 |
| 1 | 54 | 2021-02-09 |
| 10 | 63 | 2021-03-04 |
| request_id | installer_id | panel_count | job_minutes |
|---|---|---|---|
| 10 | 10 | 63 | 38 |
| 13 | 10 | 73 | 96 |
| 7 | 8 | 100 | 28 |
Expected output
Your answer should return 12 rows with the columns month, worked_pct.
Starter code (SQL)
SELECT *
FROM Installers;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock