SQL QuestSQL Interview Questions › Joins

Power Envelope Check

MediumFreeQuerying BasicsJoins

PWF (Power Failure) is triggered when required process power falls outside [3500, 9000] W. Power = torque_nm × (rotational_speed_rpm × 2π / 60). Find units where computed_power is outside [3500, 9000] W AND machine_failure = 1. JOIN operational_data with failure_events. Show udi, rotational_speed_rpm, torque_nm, computed_power_w (rounded), pwf flag. Order by computed_power_w descending. Top 15.

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

operational_data

udiair_temp_kprocess_temp_krotational_speed_rpmtorque_nm
5640302.6312.1166828.7
2171299.4309.1150043.3
228298.3308.5153936.1

failure_events

udimachine_failuretwfhdfpwfosfrnf
5640000001
2171000000
228000000

Expected output: Out-of-envelope failures

Hint

Power formula: torque_nm * rotational_speed_rpm * 2 * 3.14159265 / 60. Filter (computed_power < 3500 OR computed_power > 9000) AND machine_failure = 1.

Concepts

SELECT JOIN WHERE Multi-JOIN

Practise the topic: SQL practice questions · JOIN 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