SQL practice
Write real PostgreSQL in your browser and check your answer against the expected result. Free, no account needed.
59 questions
Big delivered orders
Filtering & sorting · Filtering and sorting · E-commerce
EasyOrders by status
Aggregation · Aggregation · E-commerce
EasyRepeat buyers
Aggregation · GROUP BY and HAVING · E-commerce
EasySpend per customer
Joins · Joins · E-commerce
MediumCustomers who never ordered
NULLs & CASE · NULLs and anti-joins · E-commerce
MediumEmployee and manager
Joins · Self joins · HR analytics
MediumTop earner per department
Window functions · Window functions · HR analytics
MediumVisit → signup → purchase funnel
Cohorts & funnels · CTEs and funnels · SaaS / product
MediumRunning total per customer
Window functions · Window functions · E-commerce
HardMonth-over-month growth
Window functions · LAG and growth rates · SaaS / product
HardList every coupon
Filtering & sorting · SELECT basics · Food delivery
EasyWhich payment methods are used?
Filtering & sorting · SELECT DISTINCT · Food delivery
EasyBig refunds
Filtering & sorting · WHERE with AND · Food delivery
EasyBig card orders in December
Filtering & sorting · WHERE with AND · Food delivery
EasyFlagged customers, or any big order
Filtering & sorting · WHERE with OR · Food delivery
EasyEvery paneer dish
Filtering & sorting · LIKE and wildcards · Food delivery
EasyIndore restaurants, most expensive first
Filtering & sorting · ORDER BY · Food delivery
EasyRestaurants per cuisine
Aggregation · GROUP BY · Food delivery
EasyDo longer trips get longer promises?
Aggregation · Aggregate functions · Food delivery
EasyCustomers with 25+ orders
Aggregation · HAVING · Food delivery
EasyLabel Indore restaurants
NULLs & CASE · CASE · Food delivery
EasyPremium vs regular customers by city
NULLs & CASE · Pivoting with COUNT and CASE · Food delivery
MediumProject 1 · Q1: Indore delivery partners
Filtering & sorting · Project 1 · Food delivery
EasyProject 1 · Q2: Restaurants per city
Aggregation · Project 1 · Food delivery
EasyProject 1 · Q3: Premium members per city
Aggregation · Project 1 · Food delivery
EasyProject 1 · Q4: How complete are ratings?
NULLs & CASE · Project 1 · Food delivery
EasyProject 1 · Q5: Menu variety
Aggregation · Project 1 · Food delivery
EasyProject 1 · Q6: Price range of restaurants
Aggregation · Project 1 · Food delivery
EasyProject 1 · Q7: Typical and largest order
Aggregation · Project 1 · Food delivery
EasyProject 1 · Q8: The 15 busiest customers
Aggregation · Project 1 · Food delivery
EasyNew Year's Eve orders with restaurant names
Joins · INNER JOIN · Food delivery
EasyOrders per Pune restaurant, including none
Joins · LEFT JOIN · Food delivery
EasyWhat was ordered on New Year's Eve?
Joins · Bridge tables · Food delivery
MediumDesserts on sale in Indore
Joins · Multi-condition joins · Food delivery
MediumOne invite list for the Indore event
Joins · UNION · Food delivery
MediumProject 2 · Q1: Jaipur restaurants with location
Joins · Project 2 · Food delivery
EasyProject 2 · Q2: Delivered revenue by city
Joins · Project 2 · Food delivery
MediumProject 2 · Q3: Food rating by cuisine
Joins · Project 2 · Food delivery
MediumProject 2 · Q4: Most valuable customers
Joins · Project 2 · Food delivery
MediumProject 2 · Q5: Best-selling dishes
Joins · Project 2 · Food delivery
MediumProject 2 · Q6: Deliveries by vehicle
Joins · Project 2 · Food delivery
EasyProject 2 · Q7: How many customers used each coupon?
Joins · Project 2 · Food delivery
MediumProject 2 · Q8: Holiday customers
Joins · Project 2 · Food delivery
MediumPremium members by city
Joins · Joins and aggregation · Food delivery
EasyBig orders in the Diwali rush
Filtering & sorting · Filtering dates and sorting · Food delivery
EasyMenu prices by category
Aggregation · Aggregation · Food delivery
EasyCoupon performance, including unused coupons
Joins · LEFT JOIN and COALESCE · Food delivery
MediumCancellation rate by payment method
Aggregation · Conditional aggregation · Food delivery
MediumAverage order value by city
Joins · Joins and aggregation · Food delivery
MediumPeak ordering hours
Dates & time · Dates and LIMIT · Food delivery
MediumRestaurants with no December orders
Joins · Anti-joins · Food delivery
MediumOn-time delivery rate by city
Dates & time · Timestamps and intervals · Food delivery
MediumDelivery time by month
Dates & time · Timestamps and intervals · Food delivery
MediumRepeat rate by acquisition channel
CTEs & subqueries · CTEs and NULLs · Food delivery
MediumDo late deliveries get worse ratings?
NULLs & CASE · CASE and NULLs · Food delivery
MediumBest-selling dish in each cuisine
Window functions · Window functions · Food delivery
HardFirst-month retention by signup cohort
Cohorts & funnels · Cohorts · Food delivery
HardTop 3 restaurants in each city
Window functions · Window functions · Food delivery
HardDid WELCOME50 bring customers back?
CTEs & subqueries · Window functions and EXISTS · Food delivery
Hard
Stored on this device only. “Solved” marks come from this browser only and don’t sync between devices.