Topic
SQL & Data interview problems
Joins, window functions, aggregation and data cleaning in Python. 239 original problems, each with hidden test cases you can run in the browser.
27 easy200 medium12 hard
Showing 121–150 of 239 results
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.
Auto-gradedhash-mapaggregationdatetimecohort-analysisWrite 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.
Model answersqlwindow-functionsjoinsaggregationWrite analytical SQL queries using only window functions — no self-joins — to compute running totals, forward-fill sparse events, and rank users within groups.
Model answerwindow-functionsrankingrunning-totalforward-fillDesign functions to find the best-priced restaurant for a shopping cart, calculate revenue metrics over time windows, and identify top orders and items.
Model answerdata-structuresaggregationwindow-queriesheapTests group-by aggregation over a list-of-dict records, computing per-warehouse stock summaries and flagging items that need reordering.
Auto-gradeddata processinggroup-by aggregationdictionariesModel a university domain in 3NF, build a star schema with SCD Type 2 history, plan partitioning for 100M+ rows, and write two analytic queries.
Model answerdata-modelingstar-schemaSCDpartitioningGroup readings by account id, keep accounts whose unrounded mean CPU, memory, or disk usage tops 50, then emit half-up rounded, email-sorted records.
Auto-gradedaggregationgroupinghashingsortingBuild a clean user-week panel dataset for difference-in-differences analysis, handling treatment timing, household spillovers, and staggered adoption.
Model answerdifference-in-differencespanel-datacausal-inferencesql-aggregationTests table joins, state reconciliation, and handling baseline data overridden by timestamped events
Auto-gradeddata-manipulationjoinsstate-reconciliationAggregate event logs to compute shop exposure metrics, normalize by observation period, rank within categories using window functions, and segment user engagement by tenure.
Model answeraggregationwindow-functionsjoinscase-expressionsTests aggregation, running sums, and date-range densification without recursion—core skills for analytics pipelines.
Auto-gradedwindow-functionsaggregationdate-handlingTests 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.
Auto-gradedgroupingdense-ranksorting- MySQL Expression ResultsMedium
Tests understanding of MySQL type coercion, boolean evaluation, and string comparison functions.
Auto-gradedtype-coercionsqlboolean-logic Collapse an append-only subscription event log into one status row per user, picking the newest event per user with a deterministic tie-break.
Auto-gradedevent-logdeduplicationgroupingdatetime-parsingEvaluate a Python module that computes distances and clusters geographic points from CSV/GeoJSON sources, identifying bugs, performance issues, and production risks.
Model answercode-reviewgeospatialpythondata-processingRank the top daily advertisers with ties, then compute cost per KPI by goal using a launch-date filter and safe division.
Model answerwindow-functionsaggregationjoinsdivision-by-zeroTests ability to join two relational datasets, filter by year, and produce a complete 12-row monthly summary including zero-revenue months.
Auto-gradedaggregationjoindate-manipulationWrite two SQL queries against a payment dataset to find top vendors globally and per region using aggregation, joins, and window-based dense ranking.
Model answerwindow-functionsaggregationCTErankingCalculate a courier's total earnings per day from delivery records, applying distance rates, minimum guarantees, and optional surge multipliers for high-demand hours.
Model answerdata-processingbusiness-logictime-windowsTests relational data manipulation through joins, aggregations, filtering, and ranking across interconnected tables.
Auto-gradedaggregationjoinsfilteringsortingBuild SQL queries to analyze user engagement patterns across friend and non-friend content, handling temporal aggregation and interaction scoring.
Model answersqldata-aggregationwindow-functionsjoinsTests set-based deduplication and join logic to find unique users who interacted with products in a specific department during a time range.
Auto-gradeddata-manipulationset-operationsfilteringTests left-join logic, mode imputation for missing categorical fields, and null-safe row-level spend calculation using plain Python dicts.
Auto-gradeddata-manipulationjoinsnull-handlingDesign a layered set of data quality checks over transactions and vendors tables, with SQL for the failing rows.
Model answerdata-qualitysqlvalidationreferential-integrityGiven a table of time-bounded sessions, write SQL to find which session overlaps the largest number of other sessions and report that count.
Model answersqlinterval-overlapself-joinwindow-functionsTests conditional aggregation across multiple related tables, time-window filtering, fan-out avoidance, and safe division when computing per-day engagement rates.
Auto-gradedaggregationjoindata-manipulationBuild SQL reconciliation across two ledgers with as-of FX conversion, 48h late-arrival classification, an idempotent backfilling pipeline, and honest discrepancy reporting.
Model answersqldata-engineeringwindow-functionsetlWrite a SQL query to compute total city population by summing ZIP code records, handling joins and duplicate city names across regions.
Model answersqljoinsaggregationgroup-byTests data validation, numeric robustness, error handling, aggregation, and sorting in a billing calculation task
Auto-gradeddata-validationaggregationsortingExplain 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.
Model answersqljoinswindow-functionsdata-modeling