Top 50 SQL Interview Questions
The most frequently asked questions on this topic across all roles and companies, ranked by real interview frequency. Updated weekly.
Find the second highest salary in each department without using aggregate functions.
Micron Memory Malaysia Sdn Bhd
Informatica
ExusiaFind the second highest distinct salary from a single table using basic PostgreSQL ordering and limiting.
Antra
WNS
State StreetCalculate the monthly spending trends for customers using window functions and joins.
The Home Depot
Hewlett Packard Enterprise
ConvoySign up to see every question
Create a free account to unlock this list and practice real interview questions.
Compute daily active users and a 7-day rolling average using a CTE, distinct counts, and window functions.
Meta
Acumen
CorningAggregate user activity by week, then use LAG to compare sessions and watch time versus the prior active week.
Publishers Clearing House
NBCUniversal
Interactive Process TechnologyUse GROUP BY and SUM to rank the top 10 customers by total revenue from a single sales table.
Mastek
Sage
Thornburg InvestmentFind the top 10 products by total sales revenue using joins, aggregation, and a CTE.
RTX
Blend360
1010dataFind duplicate customer profiles by grouping on identifying fields and returning only repeated records.
University of Southern California
Circle Internet Financial
Revature