SQL Practice Problems

Query relational data — the #1 data-analyst interview skill.

430Total problems
120Easy
187Medium
123Hard

SQL is one of the most frequently tested skills in data analyst, data engineer and data science interviews — Query relational data — the #1 data-analyst interview skill. Whether you're preparing for a timed technical screen or a take-home assignment, being able to write correct, efficient sql under pressure is often what separates candidates who move forward from those who get filtered out early. That's exactly what this page is built for: a permanent, focused practice ground for sql, not just another filter on a mixed list.

DataVix's SQL problem set is organised into three difficulty tiers — Easy, Medium and Hard — so you can follow a structured practice roadmap instead of solving questions at random. Start with the 120 Easy problems to get comfortable with core syntax and concepts, move on to the 187 Medium problems once you're confident, and finish with the 123 Hard problems that mirror the trickiest real interview rounds. Every problem runs entirely in your browser with instant feedback, hints you can reveal one at a time, and — for enrolled students — a fully worked official solution, so you always know not just whether your answer was right, but why.

Solving SQL problems repeatedly, rather than only reading about sql, is what actually moves the needle on interview performance: interviewers are evaluating how you think under pressure, not just whether you can recite syntax. Our questions are modeled on real interview patterns reported at companies including Amazon, Meta, Netflix, Google, Uber, Microsoft, so the practice you put in here transfers directly to the kind of prompts you'll actually be asked. Each problem also lists the topics and companies it's tagged with, so you can drill a specific weak spot — joins, window functions, string manipulation, whatever it may be — instead of solving everything in order.

Use the search, difficulty, topic and sort controls below to build your own sql practice session, or work straight down the list from Easy to Hard. New problems are added regularly, and this page updates automatically the moment they go live — no need to keep checking a separate list.

430 problems
Find Top Customers GROUP BYJOINORDER BY SQL Easy 82% 12K Customers From a City SELECTWHEREORDER BY SQL Easy 89% 15K Customers and Their Order Counts JOINGROUP BYAggregation SQL Medium 61% 8.3K Calculate Monthly Revenue GROUP BYDateAggregation SQL Medium 58% 8K Second Highest Salary SubqueryAggregation SQL Medium 47% 9.6K Average Salary by Department GROUP BYAggregation SQL Easy 85% 11K Products Never Ordered SubqueryJOINDISTINCT SQL Medium 63% 7.1K Employees Earning More Than Their Manager Self JoinJOIN SQL Medium 54% 6.8K Top Product Category by Sales JOINGROUP BYAggregation SQL Medium 57% 5.9K Running Total of Revenue Window FunctionsDateAggregation SQL Hard 33% 3.4K Each Customer's First Order Window FunctionsCTE SQL Hard 36% 3.1K Repeat Customer Retention CTEHAVINGAggregation SQL Hard 24% 2.3K List the Product Catalog SELECTORDER BY SQL Easy 75% 7.7K Cities We Serve SELECTDISTINCTORDER BY SQL Easy 89% 9.9K Electronics Price List with Aliases SELECTWHEREORDER BY SQL Easy 77% 9.8K Three Cheapest Products SELECTORDER BYLIMIT SQL Easy 85% 4.9K Line Totals for One Order SELECTWHERE SQL Easy 87% 4.7K Analytics Team Pay Sheet SELECTWHEREORDER BY SQL Easy 79% 4.9K High-Value Orders WHEREORDER BY SQL Easy 74% 4.7K Signups in H2 2023 WHEREDateORDER BY SQL Easy 74% 9.3K Mid-Range Products WHEREORDER BY SQL Easy 73% 6.8K Cancelled or Returned Orders WHEREORDER BY SQL Easy 89% 5K International Customers WHEREORDER BY SQL Easy 72% 7.1K Find the Desk Products WHEREString SQL Easy 74% 9K Five Newest Customers ORDER BYLIMIT SQL Easy 81% 5.5K Orders by Status, then Value ORDER BY SQL Easy 81% 7.3K The Founding Five ORDER BYLIMIT SQL Easy 89% 4.7K Catalog by Category and Price ORDER BY SQL Easy 79% 8.9K Order Count by Status GROUP BYAggregation SQL Easy 78% 8.1K Total Spend per Customer ID GROUP BYAggregation SQL Easy 84% 5.7K Payment Method Breakdown GROUP BYAggregation SQL Easy 88% 7K Products per Category GROUP BYAggregation SQL Easy 81% 9.5K Average Order Value by Month GROUP BYDateAggregation SQL Medium 57% 6.1K Department Headcount GROUP BYAggregation SQL Easy 84% 7.3K Units Sold per Product GROUP BYAggregation SQL Easy 82% 8.7K Customers per Country GROUP BYAggregation SQL Easy 74% 9.8K Largest Order per Customer GROUP BYAggregation SQL Easy 80% 6.2K Cities with Multiple Customers GROUP BYHAVING SQL Easy 78% 5.9K Payment Methods Moving Real Money GROUP BYHAVINGAggregation SQL Medium 54% 4.9K Premium Product Categories GROUP BYHAVINGAggregation SQL Medium 59% 4.1K Customers with 3+ Orders GROUP BYHAVING SQL Easy 79% 6.1K Departments Over Budget Threshold GROUP BYHAVINGAggregation SQL Medium 63% 6.4K Orders with Customer Names JOIN SQL Easy 78% 9.8K Order Lines with Product Names JOIN SQL Easy 73% 7.9K Customers Who Never Ordered JOINNULL Handling SQL Medium 51% 5.3K Orders with No Payment Record JOINNULL Handling SQL Medium 58% 5.9K Payments with Order Status JOIN SQL Easy 75% 6.9K Three-Way Order Report JOIN SQL Medium 46% 5.5K Revenue per Product JOINGROUP BYAggregation SQL Medium 63% 8K Orders from UK Customers JOINWHERE SQL Easy 89% 4.9K Customer Pairs in the Same City Self JoinJOIN SQL Hard 29% 6.4K Employees and Their Managers Self JoinJOIN SQL Medium 62% 7.5K Managers by Team Size Self JoinGROUP BY SQL Medium 54% 6.4K Items on Cancelled Orders JOINWHERE SQL Easy 77% 9.1K Delivered Revenue by Country JOINGROUP BYAggregation SQL Medium 55% 5.5K Line Count per Order JOINGROUP BYNULL Handling SQL Medium 55% 3.9K Orders Above the Average SubqueryAggregation SQL Medium 54% 6.2K Most Expensive Product per Category Subquery SQL Medium 51% 4.3K Customers Who Paid via UPI Subquery SQL Medium 50% 5.1K Paid Above Department Average Subquery SQL Medium 55% 5.5K Products Priced Above Average Subquery SQL Easy 86% 9.7K Each Customer's Latest Order Subquery SQL Medium 56% 6.4K Who Buys Electronics? SubqueryJOIN SQL Medium 63% 4.1K Each Order's Share of Revenue SubqueryAggregation SQL Medium 60% 8.1K Never Bought Furniture Subquery SQL Hard 25% 5.5K Monthly Order Volume via CTE CTEDateGROUP BY SQL Easy 88% 8.8K VIP Customers via CTE CTEJOINAggregation SQL Medium 61% 3.1K Salary vs Department Average CTEJOIN SQL Medium 63% 5.6K Average Customer Lifetime Value CTEAggregationBusiness Case SQL Medium 45% 3.5K Generate Numbers 1 to 10 CTE SQL Medium 62% 6.5K Everyone Under Meera CTESelf Join SQL Hard 32% 3.2K Order Size Buckets CTECASE WHENGROUP BY SQL Medium 57% 7.1K Repeat vs One-Time Customers CTECASE WHENBusiness Case SQL Medium 59% 4.9K Company-Wide Salary Rank Window FunctionsRanking SQL Medium 56% 8.1K Salary Rank Within Department Window FunctionsRanking SQL Medium 53% 3.7K Top 2 Earners per Department Window FunctionsCTERanking SQL Hard 37% 6.6K Dense-Rank Order Values Window FunctionsRanking SQL Medium 62% 3.2K Previous Order Amount (LAG) Window Functions SQL Medium 46% 6.2K Days Between Logins Window FunctionsDate SQL Hard 29% 2.5K 3-Order Moving Average Window Functions SQL Hard 36% 1.5K Share of Each Customer's Spend Window Functions SQL Hard 31% 3.6K Top Earner Name per Department Window Functions SQL Medium 52% 8.1K Salary Quartiles with NTILE Window FunctionsRanking SQL Medium 46% 5.2K Cumulative Order Count Window Functions SQL Medium 47% 3.1K Days Between Consecutive Orders Window FunctionsDate SQL Hard 25% 4K Q1 2024 Orders DateWHERE SQL Easy 87% 6.7K Signups by Month DateGROUP BY SQL Easy 74% 9.2K Orders by Day of Week DateGROUP BY SQL Medium 55% 3.9K Days from Signup to First Order DateCTEJOIN SQL Hard 28% 2.1K Active Days per User per Month DateGROUP BY SQL Medium 51% 6.6K Employee Tenure in Years Date SQL Medium 55% 3.6K Weekend Orders DateWHERE SQL Medium 52% 6.4K Names Up, Cities Down String SQL Easy 88% 4.4K Customers with Long Names StringWHERE SQL Easy 89% 4.7K Customer Display Labels String SQL Easy 89% 9.7K Customer Initials String SQL Easy 86% 7.3K Rename a Category Label StringDISTINCT SQL Easy 74% 8.6K Two-Word Product Names StringWHERE SQL Medium 51% 2.6K Formatted Order Codes String SQL Easy 88% 9.8K Label Orders by Size CASE WHEN SQL Easy 78% 4.8K Salary Bands CASE WHEN SQL Easy 85% 6.1K Pivot Order Statuses into Columns CASE WHENPivotAggregation SQL Medium 59% 5.1K Weekend vs Weekday Revenue CASE WHENDateGROUP BY SQL Medium 62% 7.7K Gold, Silver, Bronze Customers CASE WHENCTEBusiness Case SQL Medium 60% 7.5K Category-Based Sale Prices CASE WHEN SQL Medium 60% 7.8K Who Has No Manager? NULL HandlingWHERE SQL Easy 86% 7.5K Fill Missing Manager IDs NULL Handling SQL Easy 74% 6.3K Paid Amount per Order (0 if Unpaid) NULL HandlingJOIN SQL Medium 61% 8.3K Top 3 Spenders, Ranked RankingWindow FunctionsCTE SQL Medium 59% 6.4K Third Highest Salary RankingSubqueryLIMIT SQL Medium 54% 4.7K Products Ranked by Revenue RankingWindow FunctionsJOIN SQL Hard 33% 7.1K Median Employee Salary RankingWindow FunctionsCTE SQL Hard 30% 1.3K Average Order Value by Country Business CaseJOINGROUP BY SQL Medium 46% 5.7K Repeat Purchase Rate Business CaseSubqueryAggregation SQL Hard 34% 7.1K Monthly Cancellation Rate Business CaseCASE WHENDate SQL Hard 34% 5K Revenue Concentration Risk Business CaseCTEAggregation SQL Hard 31% 5.8K Category Revenue Mix Business CaseJOINSubquery SQL Hard 36% 3.2K Users with 3-Day Login Streaks Business CaseWindow FunctionsCTE SQL Hard 25% 3.2K Daily Active Users (DAU) Business CaseDateGROUP BY SQL Medium 50% 4.6K UPI vs Card, Month by Month Business CaseCASE WHENPivot SQL Hard 30% 6.2K Orders Matching a Price List WHEREORDER BY SQL Easy 86% 8.8K Names Starting with A WHEREString SQL Easy 84% 5.2K Catalog Pagination: Page 2 ORDER BYLIMIT SQL Easy 78% 8.1K The 2023 Hiring Class WHEREDate SQL Easy 79% 7K Salary Floor and Ceiling per Department GROUP BYAggregation SQL Easy 88% 8.1K Average Rating per Product GROUP BYAggregation SQL Easy 74% 5.1K Review Volume by Month GROUP BYDate SQL Easy 82% 6.5K Subscriptions per Plan GROUP BYAggregation SQL Easy 75% 8.3K Payments Processed per Month GROUP BYDate SQL Easy 82% 7.7K Products Reviewed More Than Once GROUP BYHAVING SQL Easy 89% 8.8K Products Averaging 4 Stars or Better GROUP BYHAVINGAggregation SQL Medium 56% 8K One-and-Done Customers GROUP BYHAVING SQL Easy 81% 4K Where Is Each Shipment Going? JOIN SQL Easy 84% 4.2K Reviews, Human-Readable JOIN SQL Easy 72% 6.3K Currently Active Subscribers JOINNULL Handling SQL Medium 45% 8.4K Monthly Recurring Revenue by Plan GROUP BYNULL HandlingBusiness Case SQL Medium 48% 2.8K Delivered Orders Missing a Shipment JOINNULL Handling SQL Medium 62% 3.3K Reviews Without a Purchase JOINSubquery SQL Hard 32% 7.1K Products Nobody Has Reviewed JOINNULL Handling SQL Easy 73% 8.5K Transit Time per Shipment DateNULL Handling SQL Medium 58% 2.8K Which Carrier Delivers Fastest? GROUP BYDateAggregation SQL Medium 59% 6.1K Order Fulfilment Timeline JOINDate SQL Easy 85% 7.4K Products Both Sold and Reviewed JOINDISTINCT SQL Medium 51% 7.5K Buyers Who Also Subscribe (INTERSECT) JOINDISTINCT SQL Medium 59% 3.3K Everyone Who Engaged (UNION) JOINDISTINCT SQL Easy 89% 6.1K Subscribers Who Never Ordered (EXCEPT) JOINSubquery SQL Medium 55% 6K Next Order Amount (LEAD) Window Functions SQL Medium 46% 2.7K ROW_NUMBER vs RANK vs DENSE_RANK Window FunctionsRanking SQL Medium 62% 7K Lowest Earner in Each Department Window FunctionsCTERanking SQL Medium 57% 7.1K Running Total of Spend per Customer Window Functions SQL Medium 54% 7.2K Most Recently Hired per Department (LAST_VALUE) Window Functions SQL Hard 36% 4.3K Order Amount vs Customer's Best Order Window Functions SQL Medium 48% 4.5K Rank a Customer's Own Reviews Window FunctionsRanking SQL Medium 60% 6.4K Sum of This and Previous 2 Orders Window Functions SQL Hard 28% 1.7K Salary Percentile Rank Window FunctionsRanking SQL Hard 33% 2.5K Cumulative Distribution of Order Value Window Functions SQL Hard 38% 4.3K Each User's First Login (Window Version) Window FunctionsCTE SQL Medium 45% 6.8K Customer Spend Deciles Window FunctionsCTERanking SQL Hard 25% 4.8K Did This Customer's Ratings Drop? Window FunctionsCASE WHEN SQL Hard 36% 3.7K Best-Seller per Category (Window Version) Window FunctionsJOINCTE SQL Hard 33% 1.6K Fee Change Between a Customer's Plans Window Functions SQL Medium 60% 6.6K Order Sequence Number per Customer Window Functions SQL Easy 82% 5.9K Each Customer's Second Order Window FunctionsCTE SQL Medium 63% 3.5K Salary Spread Within Department Window Functions SQL Medium 45% 7.9K Shipment Sequence per Carrier Window Functions SQL Easy 77% 8.8K Order Value Z-Score Window FunctionsBusiness Case SQL Hard 26% 5.5K Gap to the Next Highest Salary Window Functions SQL Medium 47% 6.6K Order's Share of Its Own Month Window FunctionsDate SQL Hard 38% 2.3K Customers Ordering More Than Average SubqueryCTE SQL Medium 50% 2.9K Employees Paid Above the Overall Average Subquery SQL Easy 75% 5.1K Customers Who Left a Top Rating Subquery SQL Easy 76% 6.5K Customers Who Never Reviewed Anything SubqueryNULL Handling SQL Medium 46% 5.8K Orders That Have Been Paid (EXISTS) Subquery SQL Medium 62% 8.3K Departments With Nobody Over ₹150k Subquery SQL Medium 45% 3.8K The Most-Reviewed Product SubqueryCTE SQL Medium 61% 4K Above This Customer's Own Average Subquery SQL Medium 50% 3.5K Bargain Products Below Category Average Subquery SQL Medium 54% 7.2K Customers Who Churned and Came Back Subquery SQL Hard 28% 5.9K Second Most Expensive Product SubqueryLIMIT SQL Medium 53% 6.5K Orders With the Most Line Items SubqueryCTE SQL Medium 64% 3.3K Carrier Performance Summary CTEDateAggregation SQL Medium 60% 8.3K Chained CTEs: Top 2 Products per Category CTEJOINRanking SQL Hard 25% 2.1K Compare Two Independent CTEs CTE SQL Medium 46% 5.6K Generate a 6-Month Calendar (Recursive CTE) CTEDate SQL Medium 46% 8.3K Subscription Tenure in Months CTEDate SQL Medium 51% 3.8K Flag At-Risk Subscribers CTECASE WHENBusiness Case SQL Hard 28% 4.9K Depth of Each Employee in the Org Chart CTESelf Join SQL Hard 39% 7K Average Rating from Repeat Reviewers Only CTEHAVING SQL Medium 64% 5.2K Orders in the Trailing 90 Days DateWHERE SQL Medium 47% 8.1K Subscription Renewal Month Date SQL Medium 60% 6.3K Which Quarter Was This Order? DateCASE WHEN SQL Medium 50% 5K Days Since Each User's Last Login DateGROUP BY SQL Medium 60% 3.5K Orders Placed on the Last Day of the Month DateWHERE SQL Hard 32% 1.5K Weekly Signup Cohorts DateGROUP BY SQL Medium 64% 3.4K Payment Lag from Order to Payment DateJOIN SQL Medium 62% 8.1K Normalize City Capitalization String SQL Medium 54% 7.7K Product Name Length Buckets StringCASE WHEN SQL Medium 47% 8.2K Mask Customer Names for a Support Ticket String SQL Medium 56% 3.3K Order Codes with Status Suffix StringCASE WHEN SQL Easy 73% 6.7K Generate Username Handles String SQL Medium 53% 2.8K How Many Words in Each Category Name? String SQL Hard 35% 5.5K Label Ratings as Sentiment CASE WHEN SQL Easy 82% 7.2K Numeric Rank of Subscription Plans CASE WHENORDER BY SQL Medium 64% 3.7K Label Shipment Speed CASE WHENDate SQL Medium 60% 8.2K Nested CASE: Customer Value Segment CASE WHENCTE SQL Hard 33% 2.2K Active or Ended, Explicitly NULL HandlingCASE WHEN SQL Easy 78% 7.9K Orders From Customers With Unknown City NULL HandlingJOIN SQL Medium 55% 5.9K Show Delivery Date or a Placeholder NULL Handling SQL Easy 87% 8.2K Guard Against Divide-by-Zero with NULLIF NULL Handling SQL Medium 52% 7.5K Top 3 Rated Products (Min 2 Reviews) RankingHAVINGCTE SQL Hard 27% 1.5K Rank Carriers by Shipment Volume RankingGROUP BY SQL Medium 56% 7.7K Monthly Active Subscribers Business CaseDateCTE SQL Hard 28% 5.2K Churn Rate by Plan Business CaseCASE WHENGROUP BY SQL Hard 27% 1.7K Week-1 Login Retention Business CaseDateSubquery SQL Hard 39% 7.1K Signup-to-Paid Conversion Funnel Business CaseSubquery SQL Hard 24% 6.7K LTV Proxy vs a Fixed Acquisition Cost Business CaseCTECASE WHEN SQL Hard 29% 4.9K Pivot Revenue by Quarter Business CasePivotCASE WHEN SQL Hard 37% 5.3K H1 vs H2 Revenue Comparison Business CaseCASE WHEN SQL Medium 62% 4.5K Longest Login Streak per User Business CaseWindow FunctionsCTE SQL Hard 27% 1.7K Users Inactive for 30+ Days Business CaseDateGROUP BY SQL Medium 50% 3.7K Average Basket Size Business CaseJOINAggregation SQL Medium 46% 8.2K Frequently Bought Together Business CaseSelf JoinGROUP BY SQL Hard 35% 3.6K Revenue from New vs Returning Customers Business CaseWindow FunctionsCASE WHEN SQL Hard 38% 4.7K Products at Stockout Risk Business CaseJOINGROUP BY SQL Medium 54% 5.8K Refund Exposure by Payment Method Business CaseJOINGROUP BY SQL Medium 47% 4.6K Projected Salary After a 10% Raise, Ranked Business CaseRanking SQL Medium 55% 5.3K Category with the Highest Return Rate Business CaseJOINGROUP BY SQL Hard 36% 4.7K First-Time Buyers per Month Business CaseWindow FunctionsDate SQL Hard 30% 5K Average Time from Delivery to Review Business CaseJOINDate SQL Hard 37% 2.2K Department Cost as % of Revenue Business CaseCTE SQL Medium 48% 5.7K High-Value, Low-Frequency Customers Business CaseCTEHAVING SQL Hard 28% 2.8K Week-over-Week Revenue Change Business CaseWindow FunctionsDate SQL Hard 34% 5.1K Employees Hired the Same Year as Their Manager Business CaseSelf Join SQL Medium 53% 5.5K Do the Top 20% of Customers Drive 80% of Revenue? Business CaseWindow FunctionsCTE SQL Hard 34% 1.5K List Every Ticket Subject SELECTORDER BY SQL Easy 89% 7.4K Computed Column: Is Ticket Urgent? SELECT SQL Easy 81% 5.1K Employee Roster, ID Second SELECTORDER BY SQL Easy 87% 4.7K Prices Converted to Paise SELECT SQL Easy 77% 6.6K What Order Statuses Exist? DISTINCTORDER BY SQL Easy 72% 9.9K Which Payment Methods Are Actually Used? DISTINCTORDER BY SQL Easy 84% 8.5K Priorities Seen Among Open Tickets DISTINCTWHERE SQL Easy 79% 5.9K Which Carriers Have We Used? DISTINCTORDER BY SQL Easy 84% 9.5K The Oldest Still-Open Ticket LIMITWHEREORDER BY SQL Easy 75% 10K Top 5 Priciest Orders LIMITORDER BY SQL Easy 75% 8.1K Employee Directory, Page 2 LIMITORDER BY SQL Easy 84% 7.1K The Single Highest-Rated Review (Earliest Tiebreak) LIMITORDER BY SQL Medium 48% 5.7K Tickets by Custom Priority Order ORDER BYCASE WHEN SQL Medium 47% 8.3K Catalog Sorted by Price, then Name ORDER BY SQL Easy 84% 6.6K Shipments, Delivered First ORDER BYNULL Handling SQL Medium 48% 6.9K Longest-Serving Employees First ORDER BY SQL Easy 85% 8.1K Urgent Tickets Still Open WHERE SQL Easy 88% 6K Everything Except Electronics and Furniture WHERE SQL Easy 73% 8.1K Orders Outside the Typical Range WHERE SQL Easy 74% 8.1K Tickets Resolved the Same Day They Opened WHERENULL Handling SQL Medium 57% 5.3K Customers Who've Filed 2+ Tickets GROUP BYHAVING SQL Medium 58% 8.3K Carriers Handling 3+ Shipments GROUP BYHAVING SQL Easy 76% 9.1K Products Generating Over ₹5000 in Total JOINGROUP BYHAVING SQL Medium 63% 8.3K Departments Averaging 2+ Years Tenure GROUP BYHAVINGDate SQL Hard 30% 3.7K Ticket Resolution Report JOIN SQL Easy 74% 5.4K Customers With Both a Ticket and an Order JOINDISTINCT SQL Medium 45% 7.5K Customers Who Never Filed a Ticket JOINNULL Handling SQL Easy 86% 4.5K Four-Table Order Detail Sheet JOIN SQL Hard 30% 6.1K Employees and Their Peers (Same Manager) Self Join SQL Hard 27% 6.9K Skip-Level Managers Self Join SQL Hard 37% 6.8K Same Country, Different City Self Join SQL Medium 50% 4.7K Products Priced Within ₹100 of Each Other Self Join SQL Medium 49% 5.2K Orders That Generated a Support Ticket JOIN SQL Hard 30% 3K Subscribers Who Also Made a Purchase JOINDISTINCT SQL Medium 49% 2.6K Shipment, Carrier and Payment in One Row JOIN SQL Medium 52% 5.1K Cross-Department Salary Twins Self Join SQL Hard 26% 2.5K Products Reviewed by Multiple Different Customers JOINGROUP BYHAVING SQL Medium 57% 4.5K What Was This Customer's Last Order Before the Ticket? JOINSubquery SQL Hard 37% 3.7K Do Subscribers Buy Physical Products Too? JOINBusiness Case SQL Medium 47% 6.8K Closed Tickets Alongside Order Value JOINSubquery SQL Medium 48% 7.5K Orders Verified to Have Exactly One Shipment JOINGROUP BYHAVING SQL Medium 48% 8K The Customer 360 Row JOINBusiness Case SQL Hard 28% 3K Did a Complaint Follow a Bad Review? JOINDate SQL Hard 34% 3.4K Which Carrier Reaches the Most Cities? JOINGROUP BY SQL Hard 24% 1.6K Fastest Ticket Resolutions, Ranked Window FunctionsRankingDate SQL Medium 45% 5.4K Rank Each Customer's Own Tickets by Age Window FunctionsRanking SQL Medium 59% 5.6K Busiest Carrier Each Month Window FunctionsRankingDate SQL Hard 31% 2.4K Order Rank and Spend Percentile Together Window FunctionsRankingCTE SQL Hard 30% 3.6K Salary Decile per Employee Window FunctionsRanking SQL Hard 28% 6.1K Order Amount vs Trailing 3-Order Average Window Functions SQL Hard 36% 3.2K Global Rating Leaderboard (Min 1 Review) Window FunctionsRankingCTE SQL Medium 58% 8.3K Each Customer's Plan History, Numbered Window Functions SQL Medium 58% 7.5K Top 2 Fastest Carriers RankingWindow FunctionsCTE SQL Medium 62% 8.1K Pivot Ticket Counts by Priority PivotCASE WHEN SQL Medium 50% 4.3K Pivot Delivered Revenue by Carrier PivotCASE WHENJOIN SQL Hard 38% 1.7K Pivot Order Counts: First 3 Months of 2024 PivotCASE WHENDate SQL Medium 51% 7.8K Salary Rank Within Hiring Year Window FunctionsRankingDate SQL Hard 37% 1.4K First and Last Order, Same Row Window Functions SQL Hard 25% 6.1K Rank Customers by Ticket Volume RankingCTE SQL Medium 47% 8.3K Pivot Employee Counts by Salary Band PivotCASE WHEN SQL Medium 62% 3.8K Rank Orders Within Their Own Month Window FunctionsRankingDate SQL Hard 29% 3.4K Longest-Open Tickets, Ranked Window FunctionsRankingDate SQL Medium 51% 4.2K Average Ticket Resolution Time Business CaseDateAggregation SQL Medium 54% 5.3K Resolution Time by Priority Business CaseGROUP BYDate SQL Medium 48% 3.5K SLA-Breaching Urgent Tickets Business CaseWHEREDate SQL Medium 53% 7K Support Burden vs Revenue per Customer Business CaseCTE SQL Hard 35% 2.3K Products Never Even Attempted (EXISTS Form) Subquery SQL Medium 51% 7.9K Above Their City's Average Spend SubqueryCTE SQL Hard 25% 5.6K ARPU Among Active Subscribers CTEBusiness Case SQL Medium 46% 4.8K City of the Single Biggest Spender SubqueryCTE SQL Medium 57% 8.4K Subscription-Only Customers CTESubquery SQL Medium 52% 3.5K Inventory Turnover Proxy by Category Business CaseJOINCTE SQL Hard 27% 6.3K Value of the 2024-Q1 Signup Cohort CTEBusiness CaseDate SQL Hard 37% 3.9K First 10 Fibonacci Numbers (Recursive CTE) CTE SQL Medium 59% 2.8K Revenue Lost to Cancellations Business CaseAggregation SQL Medium 64% 4.5K Customers Who Only Ever Give 5 Stars Subquery SQL Hard 24% 2.2K Support Tickets per 10 Orders Business CaseSubquery SQL Medium 62% 8.3K Simulate a Loyalty Discount CTECASE WHENBusiness Case SQL Hard 26% 6.8K Company Headcount Growth Over Time (Recursive) CTEWindow FunctionsBusiness Case SQL Hard 30% 4.7K Basic Subscribers Who Spend Like Premium Customers Business CaseCTEJOIN SQL Hard 29% 1.5K Second Most Common Customer City SubqueryCTE SQL Medium 48% 7.3K Orders With No Successful Payment After 14 Days Business CaseSubqueryDate SQL Hard 28% 3K Management Cost per Direct Report CTESelf JoinBusiness Case SQL Hard 26% 5.9K Basket Value: Subscribers vs Non-Subscribers Business CaseCTECASE WHEN SQL Hard 29% 5.4K Week-over-Week Ticket Volume Trend Business CaseWindow FunctionsDate SQL Hard 37% 6.2K List All Coupons SELECTORDER BY SQL Easy 77% 5.4K Discount as a Decimal Fraction SELECT SQL Easy 82% 6K Convert Monthly Salary Basis to Annual SELECT SQL Easy 83% 4.3K Order Amount Plus Estimated Tax SELECT SQL Easy 72% 9.2K Which Coupons Have Ever Been Redeemed? DISTINCTORDER BY SQL Easy 84% 6.3K Departments That Have a Manager Assigned DISTINCTJOIN SQL Medium 49% 6.2K Which Months Did We Ship In? DISTINCTDate SQL Easy 75% 7.2K Distinct Customer-City Pairs Present DISTINCT SQL Easy 77% 7.9K The Most Recent Coupon Redemption LIMITORDER BY SQL Easy 85% 9.7K Top 3 Highest-Value Shipped Orders LIMITJOINORDER BY SQL Medium 46% 2.6K Support Ticket Queue, First Page LIMITORDER BY SQL Easy 72% 4.2K Coupons Starting with a Season Prefix StringWHERE SQL Easy 76% 5.1K Tickets Mentioning Refunds StringWHERE SQL Easy 86% 8K Last-Letter Initials String SQL Medium 60% 3K Product Names Without Spaces String SQL Medium 50% 4.1K Abbreviate Ticket Priority StringCASE WHEN SQL Medium 55% 2.8K Shortest and Longest City Names StringDISTINCT SQL Medium 64% 8.3K Redemption Count per Coupon GROUP BYAggregation SQL Easy 75% 6.8K Orders and Their Coupon Savings JOIN SQL Medium 50% 4.2K Full-Price Orders (No Coupon Used) JOINNULL Handling SQL Easy 87% 9.6K Coupons Nobody Has Used JOINNULL Handling SQL Easy 76% 8.1K Coupon Misuse: Below the Minimum Order JOINBusiness Case SQL Hard 32% 2.1K Redemptions Outside the Coupon's Valid Window JOINDateBusiness Case SQL Hard 38% 4.6K Total Discount Given, by Month JOINDateGROUP BY SQL Hard 37% 2.2K Overall Coupon Redemption Rate Business CaseSubquery SQL Medium 48% 4.4K Tickets from Currently Active Subscribers JOIN SQL Medium 62% 4.9K Products Bought Only by High Spenders JOINSubqueryBusiness Case SQL Hard 33% 6.1K Employees Hired Before Their Manager (Data Check) Self Join SQL Medium 46% 8.2K Customer Pairs in the Same City, Different Signup Years Self JoinDate SQL Hard 24% 2.8K Carriers Serving the Same Customer Twice JOINGROUP BYHAVING SQL Hard 30% 5.2K Categories Bought by 3+ Distinct Customers JOINGROUP BYHAVING SQL Medium 56% 5.6K Managers With a Team of 3 or More Self JoinHAVING SQL Medium 61% 6K Cities Where Average Customer Spend Exceeds ₹2000 JOINGROUP BYHAVING SQL Hard 34% 1.4K Products with No Rating Below 4 GROUP BYHAVING SQL Medium 53% 8.2K Managers With an Above-Average Team Self JoinHAVINGSubquery SQL Hard 32% 4.7K Customers Who Ordered in Every Quarter of 2024 GROUP BYHAVINGDate SQL Hard 26% 3.3K Customers Whose Orders Used 2+ Different Carriers JOINGROUP BYHAVING SQL Hard 31% 3.7K Salary Values Shared Across Departments GROUP BYHAVINGSelf Join SQL Hard 39% 6.7K Interleaved Orders and Tickets per Customer JOIN SQL Hard 38% 2K Products Bought and Then Reviewed by the Same Order's Buyer JOIN SQL Hard 29% 2.8K Departments With 2+ Employees Above ₹100k GROUP BYHAVING SQL Medium 60% 4.8K Products This Customer Buys Every Single Time Self JoinGROUP BYHAVING SQL Hard 24% 4.7K Customers With Both High and Low Priority Tickets GROUP BYHAVING SQL Hard 31% 1.5K Redemption Order per Coupon Window Functions SQL Medium 57% 8K Days Between a Coupon's Consecutive Uses Window FunctionsDate SQL Hard 24% 6.8K Top 2 Busiest Carriers per Month Window FunctionsRankingCTE SQL Hard 36% 6.1K Salary Rank and Distance from Department Average, Together Window FunctionsRanking SQL Hard 34% 4.5K Pivot Coupon Redemptions by Quarter PivotCASE WHENDate SQL Hard 38% 5.9K Pivot Order Status Counts by Quarter PivotCASE WHENDate SQL Hard 31% 6.7K Rank Tickets by the Filer's Lifetime Value Window FunctionsRankingCTE SQL Hard 25% 5.3K Resolution-Speed Quartiles Window FunctionsRanking SQL Hard 29% 4.8K Each Customer's First-Ever Coupon Used Window FunctionsJOIN SQL Medium 53% 5.3K Rank Products by Rating Within Their Price Tier Window FunctionsRankingCASE WHEN SQL Hard 24% 2.7K Rank Cancelled/Returned Orders by Value RankingWindow Functions SQL Medium 51% 3.3K Pivot Headcount by Tenure Band PivotCASE WHENDate SQL Medium 64% 5.2K Compare Each Order to the Grand Total (No Self-Join) Window Functions SQL Medium 49% 6K Rank Customers by Support-to-Purchase Ratio Window FunctionsRankingCTE SQL Hard 38% 5.6K Coupon ROI: Revenue per Rupee Discounted Business CaseJOINCTE SQL Hard 24% 5K Customers Eligible for FLASH50 Who Never Used It SubqueryBusiness Case SQL Hard 39% 3K Net Revenue After All Discounts CTEBusiness Case SQL Medium 52% 2.8K Departments Larger Than the Company Average SubqueryCTE SQL Medium 52% 3K Value Density: Items per ₹1000 Spent Business CaseJOIN SQL Medium 45% 2.7K Customers Whose Spending Is Declining CTEWindow FunctionsBusiness Case SQL Hard 38% 1.4K How Fast Do Customers Pay After Ordering? Business CaseJOINDate SQL Medium 58% 5.2K Which Category Has the Highest Markup? SubqueryCTEBusiness Case SQL Hard 39% 4.2K Escalation List: High-Value, Unhappy, Vocal CTEBusiness CaseJOIN SQL Hard 26% 5.6K Does a Higher Plan Price Mean Shorter Tenure? Business CaseCTEDate SQL Hard 38% 3.2K Individual Contributors at the Top (Data Anomaly Check) Subquery SQL Medium 60% 4.3K Order Frequency: Subscribers vs Non-Subscribers Business CaseWindow FunctionsCTE SQL Hard 38% 1.9K Full Org Chart with Path CTESelf Join SQL Hard 33% 3.5K Average Discount Depth Across All Redemptions Business CaseJOIN SQL Easy 75% 4.2K Cost-to-Revenue Ratio, Company-Wide CTEBusiness Case SQL Medium 50% 8.5K Most Improved Carrier (H1 vs H2 Speed) SubqueryCTEBusiness Case SQL Hard 36% 3.3K What Share of Orders Led to a Support Ticket? Business CaseSubqueryDate SQL Medium 57% 3.2K Top Spender in Each Country CTEWindow FunctionsJOIN SQL Hard 27% 4.7K Did Coupon Orders Skew Smaller? Business CaseCASE WHENCTE SQL Hard 35% 6.3K Top Earner Flag per Department (Subquery Form) Subquery SQL Medium 61% 6.6K Do Cancelled-Order Customers File More Tickets? Business CaseCTECASE WHEN SQL Hard 31% 6.3K The Longest-Running Active Subscription CTEDate SQL Medium 53% 3.3K Basket Diversity: Gold vs Bronze Customers Business CaseCTECASE WHEN SQL Hard 37% 4.1K Carriers Slower Than the Network Average SubqueryCTE SQL Medium 56% 7.3K Net New Customers per Quarter of 2024 CTEDateBusiness Case SQL Medium 54% 5.8K Do Customers Rate Lower After Filing a Ticket? Business CaseJOINDate SQL Hard 28% 2.5K Do Premium Subscribers Prefer a Different Payment Method? CTEJOINBusiness Case SQL Hard 33% 1.4K Which Day of the Week Gets the Most Tickets? DateGROUP BY SQL Medium 58% 7.2K First 5 Products Alphabetically ORDER BYLIMIT SQL Easy 82% 7.6K Which Years Have We Had Signups? DISTINCTDate SQL Easy 82% 5.9K Full Employee Record, Renamed Columns SELECT SQL Easy 85% 8.9K Pivot: Delivered vs In-Transit Shipment Counts PivotCASE WHEN SQL Easy 85% 6.8K Cheapest Product in Each Category Subquery SQL Easy 89% 7.5K Cities With Exactly One Customer GROUP BYHAVING SQL Easy 73% 8.3K Employees Hired the Same Month (Any Year) Self JoinDate SQL Medium 57% 2.6K Ratings With the Order That Prompted Them JOINSubquery SQL Medium 56% 7.6K Top 3 Most Frequent Ticket Filers LIMITGROUP BYORDER BY SQL Easy 87% 6.5K Coupon Code Lengths String SQL Easy 85% 7.2K Tickets With No Closure Yet NULL HandlingWHERE SQL Easy 74% 9K Classify Orders by Currency Tier CASE WHEN SQL Easy 84% 6.2K Rank Managers by Team Size RankingSelf JoinCTE SQL Medium 55% 6.5K Running Count of Orders Over Time Window Functions SQL Easy 79% 6K Tickets Filed by the Top 3 Spenders SubqueryCTE SQL Medium 60% 7.2K 3-Month Rolling AOV Trend Business CaseWindow FunctionsDate SQL Hard 39% 7.2K Who Used Each Coupon? JOIN SQL Easy 81% 6.1K How Many Distinct Categories Do We Sell? DISTINCTAggregation SQL Easy 81% 5.1K Shipments by Carrier, Fastest First, Undelivered Last ORDER BYNULL Handling SQL Medium 64% 2.9K Categories Spanning a Wide Price Range GROUP BYHAVING SQL Medium 56% 7K What Share of Orders Even Qualify for a Coupon? Business CaseSubquery SQL Medium 63% 6.7K Time Until This Customer's Next Ticket Window FunctionsDate SQL Medium 63% 2.6K Rank Coupons by Total Discount Cost RankingJOINCTE SQL Medium 46% 6.6K Rough NPS Proxy from Ratings Business CaseCASE WHEN SQL Medium 56% 4.6K Which Coupons Are Valid Right Now? WHEREDate SQL Easy 83% 9.9K Top 10% of Earners Company-Wide RankingWindow Functions SQL Medium 48% 4.5K

Latest Problems

Popular Problems

Related Categories