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.

  1. Average Order Value per CustomerPractice · SQL · +10 XPeasy
  2. Find Active InternsPractice · SQL · +10 XPeasy
  3. Find Customers Who Placed Orders Above a Certain AmountPractice · SQL · +10 XPeasy
  4. Find Employees Working on ProjectsPractice · SQL · +10 XPeasy
  5. Find High-Scoring Students in PythonPractice · SQL · +10 XPeasy
  6. Find Products Below a Certain PricePractice · SQL · +10 XPeasy
  7. Find Students from a Specific CollegePractice · SQL · +10 XPeasy
  8. Find Students with Missing Contact InfoPractice · SQL · +10 XPeasy
  9. Find Students with Missing EmailPractice · SQL · +10 XPeasy
  10. Find Students with Missing Email AddressesPractice · SQL · +10 XPeasy
  11. Find Students with Scores Above 80Practice · SQL · +10 XPeasy
  12. Find Unique Course EnrollmentsPractice · SQL · +10 XPeasy
  13. Format College NamesPractice · SQL · +10 XPeasy
  14. Format Customer NamesPractice · SQL · +10 XPeasy
  15. Format Player NamesPractice · SQL · +10 XPeasy
  16. List Employees with No DepartmentPractice · SQL · +10 XPeasy
  17. List Unique Customer CitiesPractice · SQL · +10 XPeasy
  18. List Unique Product CategoriesPractice · SQL · +10 XPeasy
  19. List Unique Student MajorsPractice · SQL · +10 XPeasy
  20. Number of Students per CollegePractice · SQL · +10 XPeasy
  21. Student Performance CategoriesPractice · SQL · +10 XPeasy
  22. Top 5 Highest Paid InternsPractice · SQL · +10 XPeasy
  23. Top 5 Most Expensive GadgetsPractice · SQL · +10 XPeasy
  24. Total Items Sold by ProductPractice · SQL · +10 XPeasy
  25. Total Orders per CustomerPractice · SQL · +10 XPeasy
  26. Total Salary Expenditure by DepartmentPractice · SQL · +10 XPeasy
  27. Total Sales per Product CategoryPractice · SQL · +10 XPeasy
  28. Unique Course EnrollmentsPractice · SQL · +10 XPeasy
  29. Active Interns in the Last 30 DaysPractice · SQL · +20 XPmedium
  30. Average Score per Student GroupPractice · SQL · +20 XPmedium
  31. CTE: Top Employee Performance RankingPractice · SQL · +20 XPmedium
  32. Customers with No OrdersPractice · SQL · +20 XPmedium
  33. Delivery Performance RankingPractice · SQL · +20 XPmedium
  34. Dishes Present in Only One Cuisine TypePractice · SQL · +20 XPmedium
  35. Find Departments with Above Average Salary SpendingPractice · SQL · +20 XPmedium
  36. Find Employee's Manager NamePractice · SQL · +20 XPmedium
  37. Find Employees With No Direct ReportsPractice · SQL · +20 XPmedium
  38. Find Interns with Above Average SalaryPractice · SQL · +20 XPmedium
  39. Find Students with Above-Average GPA in Their DepartmentPractice · SQL · +20 XPmedium
  40. Intern Stipend by Department and Start DatePractice · SQL · +20 XPmedium
  41. Internship Offers by Company and DepartmentPractice · SQL · +20 XPmedium
  42. Internship Offers by Department and SalaryPractice · SQL · +20 XPmedium
  43. Internship Offers by Status and DepartmentPractice · SQL · +20 XPmedium
  44. Internship Performance by DepartmentPractice · SQL · +20 XPmedium
  45. Order Delivery Time CalculationPractice · SQL · +20 XPmedium
  46. Rank Sales by Consecutive DaysPractice · SQL · +20 XPmedium
  47. Rank Student Scores in Each SubjectPractice · SQL · +20 XPmedium
  48. Rank Students by Cumulative Score in Each CollegePractice · SQL · +20 XPmedium
  49. Student Course Ranking by SemesterPractice · SQL · +20 XPmedium
  50. Students with Above Average GPA in Their DepartmentPractice · SQL · +20 XPmedium
  51. Top 2 Interns by Monthly Stipend in Each DepartmentPractice · SQL · +20 XPmedium
  52. Top 3 Interns by Monthly Stipend in Each DepartmentPractice · SQL · +20 XPmedium
  53. Top 3 Most Frequent Items per CustomerPractice · SQL · +20 XPmedium
  54. Consecutive Delivery DelaysPractice · SQL · +30 XPhard
  55. Cricket Performance: Consecutive Matches Above AveragePractice · SQL · +30 XPhard
  56. Cumulative Sales Over Time with LagPractice · SQL · +30 XPhard
  57. E-commerce Sessionization: Time Between PurchasesPractice · SQL · +30 XPhard
  58. Find All Ancestors of a ProductPractice · SQL · +30 XPhard
  59. Median Customer Order Value by RegionPractice · SQL · +30 XPhard
  60. Median Order Value Per Customer GroupPractice · SQL · +30 XPhard
  61. Organizational Hierarchy with TenurePractice · SQL · +30 XPhard
  62. Running Total of Delivery Charges per CityPractice · SQL · +30 XPhard
  63. Sales Performance: Rank by Consecutive UpswingPractice · SQL · +30 XPhard
  64. Top Salaries per DepartmentPractice · SQL · +30 XPhard