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 151–180 of 239 results
Design a relational database schema for a large-scale video platform, addressing scalability, GDPR compliance, and analytics requirements.
Model answerdatabase-designschema-modelingindexingpartitioningCalculate a 7-day moving average for each date using calendar intervals, not row counts, handling gaps and NULL values correctly.
Model answerwindow-functionsdate-arithmeticaggregationCalculate hourly CTR and currency-adjusted revenue per country from event logs, joining latest exchange rates and handling time bucketing and safe division.
Model answeraggregationjoinswindow-functionsdate-timeFlag each order as a customer's first in a category or overall, then aggregate to compute new-buyer proportions by day and category.
Model answersqlpandaswindow-functionsaggregationQuery an event-log table to produce one row per listing showing its most recent status and total lifespan in hours.
Model answerwindow-functionsaggregationtimestamp-arithmeticTests date handling, filtering, and grouped aggregation to find the latest month with successful records and summarize by region.
Auto-gradedaggregationdate-manipulationfilteringSimulate three SQL analytics queries in Python: total users, busiest signup month (with tie-break), and the most-followed usernames including ties.
Auto-gradedaggregationgroupingcountingtiesGroup users by signup week, compute seven-day activity retention rates, and handle zero-retention cohorts correctly.
Auto-gradeddata-analysiscohort-analysisretentionaggregationWrite ANSI-SQL to build a windowed conversion funnel, attribute acquisition channels, flag bot-like campaigns, deduplicate near-duplicate events, and compute rolling unique viewers.
Model answerfunnel-analysiswindow-functionsCTEsdeduplicationBuild a validated event layer, then compute daily funnel counts, per-user first-event dates, and a one-day retention rate using SQL and pandas.
Model answersqlpandasfunnelretentionExplain how ROW_NUMBER, RANK, and DENSE_RANK behave differently when ties exist, and which to use depending on what "top N" actually means.
Model answerwindow-functionsrankingtiestop-kRead a multi-clause SQL query against two small tables and state exactly which rows come back, with each column value, traced stage by stage.
Model answersqljoinswindow-functionsnullsDesign attributable, time-bounded conversion metrics for a marketing campaign and implement the SQL to measure, baseline, and diagnose them across a five-table schema.
Model answersqlmetricsattributionwindow-functionsWork through ten interconnected SQL and pandas tasks spanning aggregations with NULL handling, join types, set operations, window functions, views, duplicate management, and indexing strategy.
Model answersqlpandaswindow-functionsFilter users into mutually exclusive content-type cohorts, then compute activity counts, median active days, a 10-day threshold rate, and per-user average minutes.
Model answercohort-analysisaggregationwindow-functionsdata-qualityTests multi-window aggregation, business-rule encoding, and precise date/time boundary handling across three related data tables.
Auto-gradeddata-manipulationdatetimebusiness-rulesCompute filtered totals two ways and group-then-threshold results, mirroring SQL conditional aggregation semantics.
Auto-gradedconditional-aggregationgroupingsimulationpythonAnalyze a payments table to rank users by declined volume, flag burst activity in 24-hour windows, and classify each transaction by amount using conditional logic.
Model answerwindow-functionsaggregationcase-whennull-handlingDemonstrate SQL window functions, join semantics, ranking functions, string aggregation, and Python dict-based accumulation over transactional row data.
Model answerwindow-functionsjoinsaggregationpythonWrite SQL to profile marketing channels across four dimensions: user counts, top spenders, cohort retention, and 90-day ARPU.
Model answerwindow-functionscohort-analysisaggregationjoinsProfile a subscription events table to verify data integrity, then compute the earliest active date and most recent inactive date per subscription.
Model answersqlpandasdata-validationtime-seriesBuild a SQL query that compares quarterly performance across different time periods, handling store openings/closings and computing both total and same-store growth rates.
Model answersqlaggregationtime-seriesanalyticsJoin two per-month balance datasets on account id, classify each account as match, mismatch, or missing on one side, handling true zero balances correctly.
Auto-gradedhashingjoindata-manipulationedge-casesWrite a SQL query ranking the top 10 items by revenue within each category and compute what fraction of each category's total revenue those items represent.
Model answerwindow-functionsaggregationCTEsrankingWrite SQL to find countries where the most creators posted significantly less in the recent week than their baseline, accounting for local time zones.
Model answersqlwindow-functionstime-seriesaggregationTests two-level aggregation: counting distinct content categories per reader on a target date, then bucketing those counts into a frequency histogram across all dates.
Auto-gradedgroupingaggregationhistogramhashingWrite SQL queries to identify top apps and compute category distributions, then design a statistical test to compare engagement frequency across user segments.
Model answersqlaggregationwindow-functionsstatistical-testingIdentify which user spent the most money during the initial ten-year period starting from the company's very first transaction.
Model answersqlaggregationwindow-functionsdate-filteringDiagnose and repair a multi-table SQL query that loses rows due to a NULL-breaking join, UTC date bucketing, and promotion fan-out inflation.
Model answerjoinsdatetimewindow-functionsdebuggingCompute impression rankings, conversion rates by format, per-user revenue, and peak traffic hours from ad event tables using SQL aggregation and joins.
Model answersqlaggregationjoinswindow-functions