SQL QuestSQL Interview Questions › Aggregation & Grouping

Failure Count by Mode

EasyFreeQuerying BasicsAggregation & Grouping

How many failures occurred per failure mode? The flags twf/hdf/pwf/osf/rnf are 0/1 in failure_events. Show one row per mode: twf_count, hdf_count, pwf_count, osf_count, rnf_count, total_failures.

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

Expected output: Failure counts per mode

Hint

SUM(twf), SUM(hdf), etc. SUM of 0/1 columns gives the count.

Concepts

SELECT Aggregation SUM

Practise the topic: SQL practice questions · GROUP BY exercises

Related questions

Counting RowsEasy · FreeSUM, AVG, MIN, MAXEasy · FreeGROUP BY BasicsEasy · FreeMonthly Order CountEasy · FreeHow Many Genres Do We Cover? (DISTINCT)Easy · FreeFemale Survivor CountEasy · 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