SQL Quest › SQL Interview Questions › Joins
Power Envelope Check
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
| udi | air_temp_k | process_temp_k | rotational_speed_rpm | torque_nm |
|---|---|---|---|---|
| 5640 | 302.6 | 312.1 | 1668 | 28.7 |
| 2171 | 299.4 | 309.1 | 1500 | 43.3 |
| 228 | 298.3 | 308.5 | 1539 | 36.1 |
failure_events
| udi | machine_failure | twf | hdf | pwf | osf | rnf |
|---|---|---|---|---|---|---|
| 5640 | 0 | 0 | 0 | 0 | 0 | 1 |
| 2171 | 0 | 0 | 0 | 0 | 0 | 0 |
| 228 | 0 | 0 | 0 | 0 | 0 | 0 |
Expected output: Out-of-envelope failures
Hint
Concepts
SELECT JOIN WHERE Multi-JOIN
Practise the topic: SQL practice questions · JOIN practice
Related questions
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