practice a little every day — you've got this ♡
SQL & Data Interview Problems
Practice 5969 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.
- 5969
- Problems
- 2211
- Auto-graded
- 15
- Topics
- 273
- Added today
Showing 61–90 of 139 results
- SQL & DataMediumModel answerCleaning Account Data in R and Selecting Top Half of Students in SQL
Clean a customer CSV with ordered null-handling rules and compute two averages in tidyverse R, then write one MySQL 8 query returning the top half of students by average grade.
SQL & Datasqlrtidyversewindow-functions - SQL & DataMediumModel answerApproved-Profile Daily Snapshot with Country Rollup and Checks
Build a point-in-time snapshot of profiles whose latest version has an approved final review, add 7-day engagement and country rollups, and write data-quality and rerun-safety checks.
SQL & Datasqlwindow-functionspoint-in-time-snapshotdata-validation - SQL & DataMediumModel answerFlagging Heavy VR Headset Users: Streak Detection in SQL
Define a precise rule for excessive headset use, then write SQL that counts flagged users, active users, and the flagged share over a trailing 30-day window.
SQL & Datasqlgaps-and-islandswindow-functionsmetric-definition - SQL & DataMediumModel answerRank Advertisers by User Complaint Rate Over a 7-Day Window
Write SQL that finds the worst advertisers by report-to-visit rate, picks each one's worst ad, and builds a daily leaderboard without double-counting visits or reports.
SQL & Datasqlwindow-functionsaggregationjoins - SQL & DataMediumModel answerWeekly Ad Click Rate: Overall and Per Campaign Category
Write SQL that deduplicates ad event logs, restricts them to a one-week UTC window, and computes click-through rate overall and per campaign type, with safe handling of zero impressions.
SQL & Datasqlaggregationdeduplicationconditional-aggregation - SQL & DataHardModel answerTableau Blend vs Join: Targets Against Sales Walkthrough
Work out exact join and blend results on two small tables, then explain how filter order, fan-out and granularity change the numbers and when blending is the better choice.
SQL & Datatableaudata-blendingjoinsorder-of-operations - SQL & DataEasyModel answerWhy a Garden Mulch Report Loses Its Non-Promo Days
Diagnose a multi-join SQL report that undercounts mulch sales, trace the lost rows step by step, and rewrite it to return all 30 days with correct totals.
SQL & Datasqlleft-joinwhere-vs-ondate-spine - SQL & DataMediumModel answerWhy Does This Hive INSERT...SELECT Fail or Load Bad Data?
Diagnose a failing Hive INSERT...SELECT into a partitioned ACID ORC table and explain, in order, the fixes for syntax, alignment, casts, partitions, settings and format.
SQL & Datahiveinsert-selectdynamic-partitionstype-casting - SQL & DataMediumModel answerBest Video Category by Mean Watch Time in pandas
Compute which category has the highest mean watch time across valid video rows, with null and nonpositive filtering, name lookup, lexicographic tie-breaks, and rounding.
SQL & Datapandasaggregationhash-mapdata-cleaning - SQL & DataMediumModel answerStaggered-Rollout Panel and Weekly Rollup in SQL
Write warehouse SQL that turns daily participation logs into a treatment-aware employee-day panel and a site-week participation table for a staggered-rollout DiD analysis.
SQL & Datasqldifference-in-differencespanel-dataleft-join - SQL & DataMediumModel answerHow a Three-Column MySQL Index Serves Different Queries
Analyze how one composite InnoDB index handles three query shapes, covering leftmost-prefix seeks, ordering, range limits, index condition pushdown, and the cost of row lookups.
SQL & Datamysqlinnodbcomposite-indexcovering-index - SQL & DataMediumModel answerQuarterly Take-Home Pay and Latest-Period Drop Report
Write a query that totals each employee's first-quarter take-home pay and flags those whose most recent paycheck fell below the one before it, with the percentage drop.
SQL & Datasqlwindow-functionsaggregationcte - SQL & DataEasyModel answerSeries vs DataFrame, WHERE vs HAVING, and Finding Repeated Emails
Three short data-engineering questions: contrast pandas Series and DataFrame, explain when SQL applies WHERE versus HAVING, and write a query that reports emails occurring more than once.
SQL & Datasqlpandasgroup-byhaving - SQL & DataMediumModel answerDaily New, Retained and Churned Devices by Platform
Write one SQL query that classifies devices as new, retained or churned for 2025-09-01 from a raw event log, and reports net growth overall and per platform.
SQL & Datasqlcteretentiondeduplication - 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 & 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 & 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 & 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 & 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 & 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 & 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 & 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 & 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 & 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