SQL Quest › SQL Interview Questions › Aggregation & Grouping

Bank Count Per State

EasyFreeQuerying BasicsAggregation & Grouping

How many top-200 banks are headquartered in each state? Show state, bank_count. Order by bank_count descending, then state ascending. Useful for understanding regulatory exposure concentration.

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". Free accounts get 10 free challenge solves, and this can be one of them.

Schema

institutions

certnamecitystatezipcharter_classestablished_datetotal_assetstotal_depositstotal_equityoffice_countbank_class
628JPMorgan Chase Bank, National AssociationColumbusOH43240801/01/1824375266200026978420003359360005335N
3510Bank of America, National AssociationCharlotteNC282021304410/17/1904263682300021019680002462500003840N
7213Citibank, National AssociationSioux FallsSD57108146106/16/181218364360001465300000176530000958N

Expected output: Each state with its bank count

Hint

GROUP BY state, COUNT(*).

Concepts

SELECT GROUP BY Aggregation ORDER BY

Practise the topic: SQL practice questions · GROUP BY exercises

Read the concept: How to find duplicates in SQL

In these company practice sets

JPMorgan

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

Related questions

High-Volume Categories (HAVING)Easy · FreeMovie Title Initial Letter Histogram (SUBSTR)Easy · FreeNational Total DepositsEasy · FreeStates With 5 or More BanksEasy · FreeProperties Per BoroughEasy · FreeTotal Assessed ValueEasy · 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