SQL QuestSQL Interview Questions › Aggregation & Grouping

Full Survival Dashboard by Class

MediumFreeQuerying BasicsAggregation & Grouping

Build a complete class-level survival report. Show exactly these 6 columns, in this order: pclass, total (passenger count), survivors, survival_rate (%, 1 decimal), avg_fare (2 decimals), avg_age (1 decimal — AVG skips NULLs automatically). Order by pclass.

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: 3 rows with full stats per class

Hint

Five aggregates in one GROUP BY: COUNT(*), SUM(survived), ROUND(100.0*SUM/COUNT,1), ROUND(AVG(fare),2), ROUND(AVG(age),1). AVG ignores NULLs automatically

Concepts

SELECT GROUP BY Aggregation ORDER BY

Practise the topic: SQL practice questions · GROUP BY exercises

In these company practice sets

Snowflake

A SQL Quest challenge matched to patterns reported for these companies — not a question any of them has published.

Related questions

Class Survival BreakdownMedium · FreeDepartment Roster with GROUP_CONCATMedium · FreeMovie Rating Tier BreakdownMedium · FreeGenre Financial ReportMedium · FreeDepartment Compensation ReportMedium · FreeConsistent Director 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