AnalystPath

Top Solar Installer per Panel Technology

SQLMediumMid level~15 min

Problem

A solar company tracks installers, the arrays they own, and the individual jobs run on those arrays. Each array uses one panel_tech. Each job records the kilowatts delivered and a customer satisfaction score from 1 to 5. For every panel_tech find the single best installer ranked by, in order: highest average satisfaction score (rounded to 2 decimals), then highest total kilowatts, then fewest safety_flags on the installer record. Return panel_tech, installer_id, score and kilowatts, ordered by panel_tech.

Tables

Example rows — the live problem includes the full dataset.

installers
installer_idfull_nameyears_activesafety_flags
1Nadia101
2Omar203
3Priya50
arrays
array_idinstaller_idpanel_techwatt_rating
1001Mono20000
1012Thin Film30000
1023Mono15000
jobs
job_idarray_idkilowattsminutesscore
20110050305
20210030204
203101100604

Expected output

Your answer should return 2 rows with the columns panel_tech, installer_id, score, kilowatts.

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

Related SQL questions