⚑ Sangsakala Proxy 🏠 Home
Skip to content

About

99 SQL practice problems with online checking: SELECT, JOIN, GROUP BY, subqueries, CTEs, window functions. Practice SQL and prepare for interviews.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 

Repository files navigation

SQL Practice Problems with Online Checking

99 hands-on SQL exercises, from SELECT and WHERE to window functions, CTEs and table design. Use them to learn SQL from scratch, get comfortable with JOINs and GROUP BY, or prepare for a data analyst, developer or QA interview.

Every problem comes with a real-world scenario, the table schema and a sample of the expected output. The easiest way to solve them is the online trainer SQL Arena: write a query in your browser, press Submit, and your answer is checked right away against hidden data. Nothing to install β€” every problem runs on PostgreSQL, and many also on MySQL and ClickHouse.

Topics

Topic Problems
SELECT, WHERE, ORDER BY β€” filtering and sorting 20
Aggregate functions and GROUP BY 18
JOINs 18
Subqueries 9
CTEs (WITH clause) 8
Window functions 14
INSERT, UPDATE, DELETE β€” modifying data 6
CREATE and ALTER TABLE β€” table design 6

What a problem looks like

  • Statement β€” a short work scenario: what to find and how to present it.
  • Tables β€” columns, types, primary (πŸ”‘) and foreign (β†’) keys.
  • Expected columns and sample output β€” the fields the checker expects and the first rows of a correct result.
  • "Solve online" link β€” the problem in the trainer, with an editor, a sandbox with data and automatic checking.

There are no ready-made solutions here on purpose: a problem you peeked at teaches nothing. The trainer compares your query with the reference on data you cannot see and tells you what is off: extra rows, wrong columns, wrong order.

All problems

  1. Over-the-Counter Medications β€” easy
  2. Customers from Berlin β€” easy
  3. Platinum-Tier Members β€” easy
  4. Long-Haul Flights β€” easy
  5. Berlin Clubs β€” easy
  6. Premium Subscriptions β€” easy
  7. 5-Star Hotels β€” easy
  8. Rock Artists β€” easy
  9. Spacious Rooms β€” easy
  10. Festivals in 2024 β€” easy
  11. Endangered Species β€” easy
  12. Savanna Residents β€” easy
  13. Product Showcase: Rename the Columns β€” easy
  14. Products Under 1000 Rubles β€” easy
  15. Delivered Orders β€” easy
  16. Customer card: projection with aliases β€” easy
  17. Products from two warehouses β€” easy
  18. Catalog Without Archive β€” easy
  19. Warehouse shelf: SKU, weight and price under readable names β€” easy
  20. Drop Unrated Reviews, Replace Empty Comments β€” easy
  1. Monthly Sales Pulse β€” easy
  2. Listening Hours by Month β€” easy
  3. Store delivery scorecard β€” easy
  4. A Customer's First Digital Footprint β€” easy
  5. Duplicate Parcel Registrations β€” easy
  6. Purchase Frequency in an Audio App β€” easy
  7. Which Customers Need a Win-Back Campaign? β€” easy
  8. From KYC Submission to Approval β€” easy
  9. Most Read Books Lookup β€” easy
  10. Kotomarket monthly orders report β€” medium
  11. Top 3 categories by revenue β€” medium
  12. Average Salary of Employees by Departments for 2023 β€” medium
  13. Book Sales Split by Genre β€” medium
  14. Analysis of courier performance by delivered packages β€” medium
  15. Client Buying Behavior Study β€” medium
  16. Sales Split by Product Category β€” medium
  17. Box Office Revenue by Popular Genres β€” medium
  18. Most prolific authors with high ratings β€” medium
  1. Second-level shelves β€” easy
  2. One-to-one, one-to-many β€” easy
  3. Row fan-out after a JOIN β€” easy
  4. Comparable apartment pairs β€” easy
  5. Employees Shown with Their Departments β€” easy
  6. Popular vehicles with multiple bookings β€” easy
  7. Package delivery tracking by shipment codes β€” easy
  8. Top players with high average score β€” medium
  9. Analyzing Airline Route Profitability β€” medium
  10. High-Volume and Profitable Products β€” medium
  11. Most Active Authors by Published Articles Count β€” medium
  12. Overloaded Hospital Departments β€” medium
  13. Top hotel rooms by average rating and revenue β€” medium
  14. Top companies by average applicant review rating β€” medium
  15. Profitable room categories for the quarter β€” medium
  16. Doctors with the highest patient complexity β€” medium
  17. Analysis of insurance policy losses by region β€” medium
  18. Top farmers' yield by crops β€” medium
  1. Find the most expensive item β€” easy
  2. Pull orders from Russian customers only β€” easy
  3. Find orders bigger than average β€” easy
  4. Customers who already ordered something β€” easy
  5. Products that nobody bought β€” easy
  6. Show every customer's order count β€” easy
  7. Cheapest pick in every category β€” easy
  8. Parcel scans after the watermark β€” easy
  9. Documentary watchers β€” easy
  1. Top Bank Clients by Transaction Amount β€” hard
  2. Quarterly Performance of Sales Managers β€” hard
  3. Top Couriers by Deliveries with Urgency Priority β€” hard
  4. Employee Earnings Breakdown β€” hard
  5. Monthly Top Tracks in Playlists β€” hard
  6. Most-Played Artists Across Playlists β€” hard
  7. Student Performance Ranking by Department with Grade Dynamics β€” hard
  8. Revenue Month-on-Month Growth β€” hard
  1. Gaps between plays β€” easy
  2. Session-start flag in an online store β€” easy
  3. Neobank Operating Balance β€” easy
  4. Each Product's Share of Total Revenue via SUM() OVER () β€” medium
  5. Staff Salaries: How Far From the Average β€” medium
  6. Student Rating by Average Grade with Group Position β€” medium
  7. Crop Variety Yield Rankings by Plot β€” medium
  8. Genre Champions Among Library Readers β€” hard
  9. Payout Trends Across Insurance Policies β€” hard
  10. Gym Member Payment Momentum β€” hard
  11. Fleet Revenue Growth by Month β€” hard
  12. Monthly Box Office Peaks by Film β€” hard
  13. Rising Stars of the Travel Agency β€” hard
  14. Repeat Visit Intervals by Doctor β€” hard
  1. Discount on Action games β€” easy
  2. Seed a batch of test orders β€” easy
  3. Spring cleaning β€” drop everything unpinned β€” easy
  4. Save your first journal entry β€” easy
  5. Pin every January note for the new year β€” easy
  6. Add a test user β€” easy
  1. Drop the Departments Table β€” easy
  2. Add Email Column β€” easy
  3. Drop Salary Column β€” easy
  4. Rename Column name β€” easy
  5. Normalization: split a flat book catalog into authors + books (PK/FK) β€” medium
  6. Kotomarket: split an order into 3NF β€” medium

More problems

This repository holds 99 problems from the free part of the trainer. SQL Arena has more than 1,400: interview questions, a SQL course from scratch, courses on analytics, ClickHouse and Kafka, duels and a leaderboard.


Русская вСрсия β†’ sql-zadachi

Β© SQL Arena, sql.coderang.dev

About

99 SQL practice problems with online checking: SELECT, JOIN, GROUP BY, subqueries, CTEs, window functions. Practice SQL and prepare for interviews.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors