SQL and Databases coding problems
SQL questions are in almost every data, backend and analyst interview. Practise SELECT and filters, GROUP BY and HAVING, every kind of JOIN, subqueries and CTEs, then window functions, running totals and gaps and islands, checked on real PostgreSQL with hidden datasets.
64 problems: 28 easy, 25 medium, 11 hard. Free to read; a free account solves them and earns XP and Aura.
- Average Order Value per CustomerPractice · SQL · +10 XP · group by, sql, aggregationeasy
- Find Active InternsPractice · SQL · +10 XP · select and filter, sql, internshipeasy
- Find Customers Who Placed Orders Above a Certain AmountPractice · SQL · +10 XP · select and filter, sql, aggregateeasy
- Find Employees Working on ProjectsPractice · SQL · +10 XP · inner join, sql, employeeseasy
- Find High-Scoring Students in PythonPractice · SQL · +10 XP · select and filter, sql, studentseasy
- Find Products Below a Certain PricePractice · SQL · +10 XP · select and filter, sql, basic queryeasy
- Find Students from a Specific CollegePractice · SQL · +10 XP · select and filter, sql, filteringeasy
- Find Students with Missing Contact InfoPractice · SQL · +10 XP · null handling, sql, filteringeasy
- Find Students with Missing EmailPractice · SQL · +10 XP · null handling, sql, filteringeasy
- Find Students with Missing Email AddressesPractice · SQL · +10 XP · null handling, sql, filteringeasy
- Find Students with Scores Above 80Practice · SQL · +10 XP · select and filter, sql, where clause1 solvedeasy
- Find Unique Course EnrollmentsPractice · SQL · +10 XP · distinct values, sql, enrollmentseasy
- Format College NamesPractice · SQL · +10 XP · string functions, sql, formattingeasy
- Format Customer NamesPractice · SQL · +10 XP · string functions, sql, formattingeasy
- Format Player NamesPractice · SQL · +10 XP · string functions, sql, formattingeasy
- List Employees with No DepartmentPractice · SQL · +10 XP · null handling, sql, employeeseasy
- List Unique Customer CitiesPractice · SQL · +10 XP · distinct values, sql, customerseasy
- List Unique Product CategoriesPractice · SQL · +10 XP · distinct values, sql, productseasy
- List Unique Student MajorsPractice · SQL · +10 XP · distinct values, sql, universityeasy
- Number of Students per CollegePractice · SQL · +10 XP · group by, sql, countingeasy
- Student Performance CategoriesPractice · SQL · +10 XP · case expressions, sql, studentseasy
- Top 5 Highest Paid InternsPractice · SQL · +10 XP · sorting and limits, sql, rankingeasy
- Top 5 Most Expensive GadgetsPractice · SQL · +10 XP · sorting and limits, sql, gadgetseasy
- Total Items Sold by ProductPractice · SQL · +10 XP · aggregates, sql, group byeasy
- Total Orders per CustomerPractice · SQL · +10 XP · aggregates, sql, group byeasy
- Total Salary Expenditure by DepartmentPractice · SQL · +10 XP · aggregates, sql, group byeasy
- Total Sales per Product CategoryPractice · SQL · +10 XP · aggregates, sql, group byeasy
- Unique Course EnrollmentsPractice · SQL · +10 XP · distinct values, sql, enrollmenteasy
- Active Interns in the Last 30 DaysPractice · SQL · +20 XP · date functions, sql, internshipsmedium
- Average Score per Student GroupPractice · SQL · +20 XP · common table expressions, sql, aggregationmedium
- CTE: Top Employee Performance RankingPractice · SQL · +20 XP · common table expressions, sql, rankingmedium
- Customers with No OrdersPractice · SQL · +20 XP · anti join, sql, left joinmedium
- Delivery Performance RankingPractice · SQL · +20 XP · window functions, sql, rankingmedium
- Dishes Present in Only One Cuisine TypePractice · SQL · +20 XP · set operations, sql, subquerymedium
- Find Departments with Above Average Salary SpendingPractice · SQL · +20 XP · subqueries, sql, aggregationmedium
- Find Employee's Manager NamePractice · SQL · +20 XP · self join, sql, hierarchymedium
- Find Employees With No Direct ReportsPractice · SQL · +20 XP · self join, sql, hierarchymedium
- Find Interns with Above Average SalaryPractice · SQL · +20 XP · subqueries, sql, aggregationmedium
- Find Students with Above-Average GPA in Their DepartmentPractice · SQL · +20 XP · subqueries, sql, aggregationmedium
- Intern Stipend by Department and Start DatePractice · SQL · +20 XP · multi-table joins, sql, aggregationmedium
- Internship Offers by Company and DepartmentPractice · SQL · +20 XP · multi-table joins, sql, aggregationmedium
- Internship Offers by Department and SalaryPractice · SQL · +20 XP · multi-table joins, sql, aggregationmedium
- Internship Offers by Status and DepartmentPractice · SQL · +20 XP · conditional aggregation, sql, internshipsmedium
- Internship Performance by DepartmentPractice · SQL · +20 XP · multi-table joins, sql, aggregationmedium
- Order Delivery Time CalculationPractice · SQL · +20 XP · date functions, sql, deliverymedium
- Rank Sales by Consecutive DaysPractice · SQL · +20 XP · window functions, sql, rankingmedium
- Rank Student Scores in Each SubjectPractice · SQL · +20 XP · window functions, sql, rankingmedium
- Rank Students by Cumulative Score in Each CollegePractice · SQL · +20 XP · window functions, sql, rankingmedium
- Student Course Ranking by SemesterPractice · SQL · +20 XP · window functions, sql, rankingmedium
- Students with Above Average GPA in Their DepartmentPractice · SQL · +20 XP · subqueries, sql, aggregationmedium
- Top 2 Interns by Monthly Stipend in Each DepartmentPractice · SQL · +20 XP · top n per group, sql, window functionsmedium
- Top 3 Interns by Monthly Stipend in Each DepartmentPractice · SQL · +20 XP · top n per group, sql, window functionsmedium
- Top 3 Most Frequent Items per CustomerPractice · SQL · +20 XP · top n per group, sql, window functionsmedium
- Consecutive Delivery DelaysPractice · SQL · +30 XP · lag and lead, sql, window functionshard
- Cricket Performance: Consecutive Matches Above AveragePractice · SQL · +30 XP · window functions, sql, streakshard
- Cumulative Sales Over Time with LagPractice · SQL · +30 XP · running totals, sql, window functionshard
- E-commerce Sessionization: Time Between PurchasesPractice · SQL · +30 XP · sessionization, sql, analyticshard
- Find All Ancestors of a ProductPractice · SQL · +30 XP · recursive cte, sql, hierarchyhard
- Median Customer Order Value by RegionPractice · SQL · +30 XP · percentiles and medians, sql, window functionshard
- Median Order Value Per Customer GroupPractice · SQL · +30 XP · percentiles and medians, sql, window functionshard
- Organizational Hierarchy with TenurePractice · SQL · +30 XP · recursive cte, sql, hierarchyhard
- Running Total of Delivery Charges per CityPractice · SQL · +30 XP · running totals, sql, window functionshard
- Sales Performance: Rank by Consecutive UpswingPractice · SQL · +30 XP · window functions, sql, rankinghard
- Top Salaries per DepartmentPractice · SQL · +30 XP · window functions, ranking, sqlhard
Solve these free. Get paid in XP and Aura.
One tap with Google, no card. Every first accepted solve pays XP for the leaderboards and Aura for real goodies.
Other topics
Hash Map and Hashing101Arrays88Prefix Sums64Beginner Coding Problems60Graphs, BFS and DFS45Greedy41Sliding Window39Dynamic Programming37Sorting36Math and Number Theory36Strings35Two Pointers35Stack29Binary Search25Simulation25Recursion22Linked List20Trees20Heap and Priority Queue18Matrix and Grid18Bit Manipulation18Queue and Deque16