SQL practice online
Free SQL practice questions and query exercises. Write a query against real tables: Run checks it on sample data, and Submit also checks hidden databases with edge cases like NULLs and ties. Preparing for an interview? Read the SQL interview questions and answers or take the SQL MCQ test.
Easy 15Medium 20Hard 10
- Account Balance TiersCase When · Null Handlingeasy
- Average Score per SubjectAggregation · Null Handling · Sortingeasy
- Campaign Click-Through RateSelect Filter · Null Handlingeasy
- Customer Email DomainsStrings · Group By · Sortingeasy
- Customers Who Never OrderedJoins · Null Handlingeasy
- Department HeadcountJoins · Aggregation · Sortingeasy
- Duplicate Signup EmailsGroup By · Having · Stringseasy
- Employees Without a ManagerSelect Filter · Null Handlingeasy
- High-Value Delivered OrdersSelect Filter · Sortingeasy
- Late ShipmentsDates · Select Filter · Sortingeasy
- Monthly Signup CountsDates · Group Byeasy
- Open Tickets by PriorityAggregation · Group Byeasy
- Total Successful PaymentsAggregation · Group By · Sortingeasy
- User Display NamesNull Handling · Strings · Case Wheneasy
- Wishlist Items Also in CartSet Operationseasy
- Campaign Click-to-ConversionJoins · Subqueries · Ctesmedium
- Class Rank by Total ScoreRanking · Null Handling · Group Bymedium
- Cumulative Hires by YearRunning Totals · Dates · Group Bymedium
- Daily Active Users with a 3-Day AverageWindow functions · Dates · Aggregationmedium
- Deduplicate Marketing LeadsDeduplication · Window functions · Stringsmedium
- Employees Who Out-Earn Their ManagerSelf Joinmedium
- Latest Status per ShipmentWindow functions · Deduplicationmedium
- Ledger Running BalanceRunning Totals · Window functionsmedium
- Loans by Missed InstallmentsJoins · Case When · Aggregationmedium
- Month-over-Month RevenueWindow functions · Dates · Aggregationmedium
- Orders by Day of WeekDates · Case When · Group Bymedium
- Products Sold but Never ReturnedSet Operations · Null Handling · Subqueriesmedium
- Quarterly Sales PivotPivot · Case When · Datesmedium
- Repeat Buyers Within 30 DaysWindow functions · Datesmedium
- Salary Share of DepartmentWindow functions · Aggregationmedium
- Second-Highest Salary per DepartmentRanking · Window functionsmedium
- Students Above Their Class AverageSubqueries · Null Handlingmedium
- Subscription Churn by PlanAggregation · Case When · Null Handlingmedium
- Ticket First Response TimeJoins · Dates · Null Handlingmedium
- Top Two Products per CategoryTop N Per Group · Window functions · Joinsmedium
- Bill of Materials ExplosionRecursive Cte · Aggregationhard
- Customers Driving 80% of RevenueRunning Totals · Window functions · Cteshard
- Daily Revenue with Missing Days FilledRecursive Cte · Dates · Running Totalshard
- Longest Login StreakGaps And Islands · Window functions · Dateshard
- Median Delivery Days per CarrierWindow functions · Dates · Aggregationhard
- Next-Month Retention by Signup CohortCtes · Dates · Subquerieshard
- Org Chart Reporting ChainRecursive Cte · Stringshard
- Overlapping Driver DeliveriesSelf Join · Dateshard
- Price Effective at Order TimeSubqueries · Dates · Joinshard
- Sessionize App EventsGaps And Islands · Window functions · Dateshard