SQL QuestSQL Interview Questions › Joins

Failure Mode Catalog Join

MediumFreeQuerying BasicsJoinsSubqueries & CTEs

Build a unified failure event log: for each failure mode (TWF/HDF/PWF/OSF/RNF), output rows of (udi, mode_code, mode_name, fmea_category) by joining failure_events flags to failure_modes lookup. UNION ALL the 5 modes together. Show top 30 by udi.

Solve it in the browser editor →

Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect".

Schema

failure_events

udimachine_failuretwfhdfpwfosfrnf
5640000001
2171000000
228000000

failure_modes

codenamefmea_categorydescription
TWFTool Wear FailureMechanicalTool wear exceeded threshold (~200 minutes)
HDFHeat Dissipation FailureThermalAir-process temperature differential too low + high rotational speed
PWFPower FailureElectricalRequired process power outside [3500, 9000] W envelope

Expected output: One row per (udi, fired-mode)

Hint

5 SELECTs UNION ALL. Each filters failure_events to one flag column = 1 and joins failure_modes WHERE code = 'TWF' (etc).

Concepts

SELECT JOIN UNION ALL Set Operations

Practise the topic: SQL practice questions · JOIN practice · CTE practice

Related questions

Customers Who Never OrderedMedium · FreeAbove-Average Departments (Derived Table)Medium · FreeLEFT JOIN NULL Semantics: Inactive CustomersMedium · FreeManagement Hierarchy OverviewMedium · FreeCount Direct ReportsMedium · FreeCustomer Recency AnalysisMedium · Free

Where would this cost you points in an interview?

Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.

Take the readiness test