SQL QuestSQL Interview Questions › Aggregation & Grouping

Female Survivor Count

EasyFreeQuerying BasicsAggregation & Grouping

A historical analysis is fact-checking the famous "women and children first" claim. As a starting data point, count how many female passengers survived the voyage.

Return a single number as survivor_count.

This is the simplest conditional count: COUNT(*) after a WHERE that narrows the rows. The alternative is SUM(CASE WHEN ... THEN 1 ELSE 0 END) which lets you compute multiple conditional counts in one pass — useful later, but unnecessary when you only need one.

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

passengers

passenger_idsurvivedpclassnamesexagesibspparchfareembarked
103Braund, Mr. Owen Harrismale22107.25S
211Cumings, Mrs. John Bradleyfemale381071.28C
313Heikkinen, Miss. Lainafemale26007.93S

Expected output: survivor_count = 3

Hint

The hint for this one spells out most of the query, so it stays in the editor. Reach for SELECT, COUNT, WHERE, and open the hint there if you stall.

Concepts

SELECT COUNT WHERE Aggregation

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 · FreeAverage Salary by DepartmentEasy · 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