practice a little every day — you've got this ♡
SQL Interview Problems
Practice 5972 original coding, SQL, system design, machine learning and behavioral problems across 15 topics. Coding and SQL problems run against hidden test cases right in your browser; every problem has hints and a worked solution, free.
- 5972
- Problems
- 2212
- Auto-graded
- 15
- Topics
- 273
- Added today
Showing 121–150 of 239 results
- SQL & DataMediumAuto-gradedVariant-Level Tutorial Finish Rate Within a One-Week Window
Join users to step events, cap each user's progress at a 7-day window, infer each variant's final step, and compute per-variant completion shares.
SQL & Datahash-mapaggregationdatetimecohort-analysis - SQL & DataMediumModel answerTrust & Safety Exposure Queries on Daily Post Views
Write three SQL queries over daily post views and per-policy risk scores: a windowed view threshold, nudity exposure share, and a monthly flagged-type mix.
SQL & Datasqlwindow-functionsjoinsaggregation - SQL & DataMediumModel answerMaster SQL Window Functions: Ranking, Running Totals, and Gap-Fill
Write analytical SQL queries using only window functions — no self-joins — to compute running totals, forward-fill sparse events, and rank users within groups.
SQL & Datawindow-functionsrankingrunning-totalforward-fill - SQL & DataMediumModel answerFood Platform Analytics: Basket Pricing and Order Metrics
Design functions to find the best-priced restaurant for a shopping cart, calculate revenue metrics over time windows, and identify top orders and items.
SQL & Datadata-structuresaggregationwindow-queriesheap - SQL & DataHardAuto-gradedCompute Per-Warehouse Reorder Alerts from Inventory Logs
Tests group-by aggregation over a list-of-dict records, computing per-warehouse stock summaries and flagging items that need reordering.
SQL & Datadata processinggroup-by aggregationdictionaries - SQL & DataHardModel answerDesign a University Enrollment Schema, Warehouse, and SQL
Model a university domain in 3NF, build a star schema with SCD Type 2 history, plan partitioning for 100M+ rows, and write two analytic queries.
SQL & Datadata-modelingstar-schemaSCDpartitioning - SQL & DataMediumAuto-gradedPer-Account Usage Means Above a Threshold
Group readings by account id, keep accounts whose unrounded mean CPU, memory, or disk usage tops 50, then emit half-up rounded, email-sorted records.
SQL & Dataaggregationgroupinghashingsorting - SQL & DataMediumModel answerUser-Week Panel Construction and DiD Analysis in SQL
Build a clean user-week panel dataset for difference-in-differences analysis, handling treatment timing, household spillovers, and staggered adoption.
SQL & Datadifference-in-differencespanel-datacausal-inferencesql-aggregation - SQL & DataEasyAuto-gradedReconcile User Settings from Snapshot and Activity Log
Tests table joins, state reconciliation, and handling baseline data overridden by timestamped events
SQL & Datadata-manipulationjoinsstate-reconciliation - SQL & DataMediumModel answerE-commerce Event Aggregation: Metrics and Ranking
Aggregate event logs to compute shop exposure metrics, normalize by observation period, rank within categories using window functions, and segment user engagement by tenure.
SQL & Dataaggregationwindow-functionsjoinscase-expressions - SQL & DataMediumAuto-gradedPlayer Activity Running Totals with Date Gaps
Tests aggregation, running sums, and date-range densification without recursion—core skills for analytics pipelines.
SQL & Datawindow-functionsaggregationdate-handling - SQL & DataMediumAuto-gradedPer-Group Top-3 Distinct Values with Tie Handling
Tests whether you can isolate the three highest distinct numeric values within each group and return all records that match those values, preserving correct sort order.
SQL & Datagroupingdense-ranksorting - SQL & DataMediumAuto-gradedMySQL Expression Results
Tests understanding of MySQL type coercion, boolean evaluation, and string comparison functions.
SQL & Datatype-coercionsqlboolean-logic - SQL & DataMediumAuto-gradedReduce Subscription Events to Latest User Status
Collapse an append-only subscription event log into one status row per user, picking the newest event per user with a deterministic tie-break.
SQL & Dataevent-logdeduplicationgroupingdatetime-parsing - SQL & DataMediumModel answerCode Review: Geospatial Data Processing Pipeline
Evaluate a Python module that computes distances and clusters geographic points from CSV/GeoJSON sources, identifying bugs, performance issues, and production risks.
SQL & Datacode-reviewgeospatialpythondata-processing - SQL & DataMediumModel answerDaily Spend Leaders and Cost-Efficiency by Campaign Goal
Rank the top daily advertisers with ties, then compute cost per KPI by goal using a launch-date filter and safe division.
SQL & Datawindow-functionsaggregationjoinsdivision-by-zero - SQL & DataMediumAuto-gradedAggregate Sales Totals by Month Across a Full Year
Tests ability to join two relational datasets, filter by year, and produce a complete 12-row monthly summary including zero-revenue months.
SQL & Dataaggregationjoindate-manipulation - SQL & DataMediumModel answerRetail Spend Analytics: Aggregation and Regional Rankings
Write two SQL queries against a payment dataset to find top vendors globally and per region using aggregation, joins, and window-based dense ranking.
SQL & Datawindow-functionsaggregationCTEranking - SQL & DataMediumModel answerDaily Driver Earnings with Time-Based Bonuses
Calculate a courier's total earnings per day from delivery records, applying distance rates, minimum guarantees, and optional surge multipliers for high-demand hours.
SQL & Datadata-processingbusiness-logictime-windows - SQL & DataMediumAuto-gradedMulti-Table Sales Analytics with Referral Tracking
Tests relational data manipulation through joins, aggregations, filtering, and ranking across interconnected tables.
SQL & Dataaggregationjoinsfilteringsorting - SQL & DataMediumModel answerSocial Network Feed Analytics with SQL Aggregation
Build SQL queries to analyze user engagement patterns across friend and non-friend content, handling temporal aggregation and interaction scoring.
SQL & Datasqldata-aggregationwindow-functionsjoins - SQL & DataMediumAuto-gradedCount Distinct Users by Department and Time Window
Tests set-based deduplication and join logic to find unique users who interacted with products in a specific department during a time range.
SQL & Datadata-manipulationset-operationsfiltering - SQL & DataMediumAuto-gradedJoin User Profiles and Purchase Records, Fill Gaps, Compute Line Spend
Tests left-join logic, mode imputation for missing categorical fields, and null-safe row-level spend calculation using plain Python dicts.
SQL & Datadata-manipulationjoinsnull-handling - SQL & DataMediumModel answerAuditing a Credit-Card Ledger: Validation Rules and Failing-Row Queries
Design a layered set of data quality checks over transactions and vendors tables, with SQL for the failing rows.
SQL & Datadata-qualitysqlvalidationreferential-integrity - SQL & DataMediumModel answerFind the Meeting Slot That Conflicts With the Most Others
Given a table of time-bounded sessions, write SQL to find which session overlaps the largest number of other sessions and report that count.
SQL & Datasqlinterval-overlapself-joinwindow-functions - SQL & DataMediumAuto-gradedDaily Campaign Performance Summary Over a Rolling Window
Tests conditional aggregation across multiple related tables, time-window filtering, fan-out avoidance, and safe division when computing per-day engagement rates.
SQL & Dataaggregationjoindata-manipulation - SQL & DataMediumModel answerDaily Ledger Reconciliation with FX Rates and Late Postings
Build SQL reconciliation across two ledgers with as-of FX conversion, 48h late-arrival classification, an idempotent backfilling pipeline, and honest discrepancy reporting.
SQL & Datasqldata-engineeringwindow-functionsetl - SQL & DataEasyModel answerAggregate ZIP-Level Population Data with SQL Joins
Write a SQL query to compute total city population by summing ZIP code records, handling joins and duplicate city names across regions.
SQL & Datasqljoinsaggregationgroup-by - SQL & DataMediumAuto-gradedPurchase Line-Item Cost Calculator with Validation
Tests data validation, numeric robustness, error handling, aggregation, and sorting in a billing calculation task
SQL & Datadata-validationaggregationsorting - SQL & DataEasyModel answerKeeping LEFT JOIN Intact While Picking One Shipment per Order
Explain why moving a shipment predicate from ON to WHERE turns a LEFT JOIN into an INNER JOIN, then write a query that keeps every qualifying order and attaches only its latest expedited shipment.
SQL & Datasqljoinswindow-functionsdata-modeling