AnalystPath

Fully Certified Staff

SQLMediumMid level~15 min

Problem

A company tracks training in three tables: staff(staff_id, full_name, team), modules(module_id, title, hours, team), and attempts(staff_id, module_id, term, result). Every team has a set of required modules (the modules whose team matches the staff member's team). Find every staff member who has a passing attempt (result = 'Pass') in every required module for their team. A person counts only if they passed all of their team's modules with no module left unattempted or failed. Order the result by staff_id.

Tables

Example rows — the live problem includes the full dataset.

staff
staff_idfull_nameteam
1NadiaSecurity
2OmarSecurity
3PriyaLogistics
modules
module_idtitlehoursteam
101Threat Modelling3Security
102Incident Response3Security
103Warehouse Safety4Logistics
attempts
staff_idmodule_idtermresult
1101Q1 2024Pass
1102Q1 2024Pass
2101Q1 2024Fail

Expected output

Your answer should return 2 rows with the columns staff_id.

Starter code (SQL)

SELECT *
FROM staff;

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