SQL QuestSQL Interview Questions › Date Functions

Failed Banks Recent Decade

MediumFreeQuerying BasicsDate FunctionsAggregation & Grouping

How many bank failures occurred in 2020 or later? The failure_date column is text in M/D/YYYY format — but the YEAR is always the last 4 characters. Show failure_year, failure_count, total_pre_failure_assets. Group by year, order ascending. (Useful for tracking the post-COVID stability stress wave including 2023's regional bank crisis: SVB, Signature, First Republic.)

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

failures

certnamecitystatefailure_datepre_failure_assetspre_failure_depositsresolution_typeestimated_loss
57488METROPOLITAN CAPITAL B&TCHICAGONULL1/30/2026261185212152FAILURENULL
5520SANTA ANNA NATIONAL BANKSANTA ANNANULL6/27/20257693871376FAILURE23460
28611PULASKI SAVINGS BANKCHICAGONULL1/17/20254946642741FAILURE30284

Expected output: Year-by-year failure count + scale

Hint

Year is the last 4 characters of failure_date: SUBSTR(failure_date, LENGTH(failure_date) - 3). Convert to INTEGER for the >= 2020 filter and the GROUP BY.

Concepts

SELECT WHERE Date Functions Aggregation GROUP BY

Practise the topic: SQL practice questions · Date function practice · GROUP BY exercises

In these company practice sets

Morgan Stanley

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

Related questions

Employee Tenure BandsMedium · FreeQuarterly Hiring Cohort ReportMedium · FreeCustomer Recency AnalysisMedium · FreeMonthly Order TrendsMedium · FreeDate Functions: How Long Ago?Medium · FreeMonthly Order Volume in 2024Medium · 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