Top 50
Skill roadmap
Updated weekly · Last refresh Oct 18

Top 50 SQL Interview Questions

The most frequently asked questions on this topic across all roles and companies, ranked by real interview frequency. Updated daily.

50questions
~17htotal time
1,683companies covered
Track your progressSign up free to work through all 50 questions and resume where you left off.
Start practicing free →
1
SubqueriesStart here. 4 questions · ~80 min
Second Highest Trader SalaryEasy
Practice
Recently asked

Find the second highest distinct salary from a single table using basic PostgreSQL ordering and limiting.

SubqueriesRankingSortingeClinicalWorksNNeenOpal CanadaInformatica
Second Highest Without AggregatesHard
Practice
Recently asked

Find the second highest salary in each department without using aggregate functions.

SubqueriesRankingSelf-JoinsCredit GenieDevoteamCisco Restaurant + Bar
More Subqueries questions with a free account
2
Window Functions16 questions · ~320 min
7-Day Rolling Active UsersMedium
Practice
Recently asked

Compute daily active users and a 7-day rolling average using a CTE, distinct counts, and window functions.

Window FunctionsDate FunctionsRunning TotalsMetaSpotifyMeta IT
SQL Window Functions Moving AverageMedium
Practice
Recently asked

Calculate a three-day moving average of active-client revenue using aggregation and SQL window functions.

Window FunctionsData AnalysissqlEEvalueserveSShyena Tech YarnsAATB Financial
More Window Functions questions with a free account

Sign up to see every question

Create a free account to unlock this list and practice real interview questions.

Get my prep plan
3
database optimization6 questions · ~120 min
Optimize a Slow SQL QueryHard
Practice
Recently asked

Rewrite a slow PostgreSQL loan payment query to reduce scanned rows while preserving the required aggregated results.

database optimizationJoinsData WranglingAmeripriseEEltro Cyberchrome PrivateEnergyHub
More database optimization questions with a free account
4
SQL & Data Manipulation4 questions · ~80 min
Analyze Customer Purchase Trends with Window FunctionsEasy
Practice
Recently asked

Calculate the monthly spending trends for customers using window functions and joins.

The Home DepotAvisoHewlett Packard Enterprise
More SQL & Data Manipulation questions with a free account
5
Ranking5 questions · ~100 min
Top Customers by Sales RevenueEasy
Practice
Recently asked

Use GROUP BY and SUM to rank the top 10 customers by total revenue from a single sales table.

RankingGroup ByAggregationsHousecall ProEquifaxXYZ
More Ranking questions with a free account
6
Joins5 questions · ~100 min
More Joins questions with a free account
7
More topics10 questions · ~200 min
Handling Missing DataEasy
Practice
Recently asked

Replace missing sales fields with defined defaults and return a consistently ordered dataset.

missing valuesdata cleaningnull handlingUniversity of MinnesotaThe Home DepotNationwide
More questions with a free account
The finish line: interview-readyComplete all 50 questions to finish this plan.