Solar Installer Monthly Activity (2021)
Problem
A solar company onboards installers and fields install requests; an accepted request becomes a booking.
`Installers`: `installer_id` (int), `onboarded_on` (date) — when the installer joined.
`Requests`: `request_id` (int), `household_id` (int), `requested_on` (date).
`Bookings`: `request_id` (int), `installer_id` (int), `panel_count` (int), `job_minutes` (int) — one row per accepted request.
For **each month of 2021** (1 through 12), report:
- `active_installers` — installers onboarded on or before the end of that month (an installer onboarded in Dec 2020 counts in every 2021 month),
- `booked_requests` — bookings whose request was made in that month of 2021.
Every month 1..12 must appear even if it has zero bookings. 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, active_installers, booked_requests.
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