KatInterview

practice a little every day — you've got this ♡

SQL & Data Interview Problems

Practice 5966 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.

5966
Problems
2209
Auto-graded
15
Topics
271
Added today

Showing 31–60 of 139 results

  • SQL & DataMediumModel answer
    Evaluating Content Performance by Audience Relationship Type

    Analyze video engagement and interaction rates segmented by viewer relationship types over a rolling 7-day window using SQL aggregations and joins.

    SQL & Datasqlaggregationjoins
  • SQL & DataHardModel answer
    Measuring a Premium Plan Launch and Building Fraud Alert Rules

    Define launch success for a new paid tier using only transaction and activity tables, then design a rule-based SQL alerting system for suspicious payments.

    SQL & Dataproduct-analyticscohort-retentionsql-window-functionsfraud-rules
  • SQL & DataMediumModel answer
    Design an Idempotent Incremental Data Pipeline for Big Data Tables

    Explain how to build a robust, idempotent daily incremental ingestion workflow that handles duplicates, backfills, and schema validation on large relational tables.

    SQL & Datadata-engineeringsqletldata-pipelines
  • SQL & DataMediumModel answer
    Calculating Monthly Theme Engagement and Revenue Trends in SQL

    Define usage growth metrics and write SQL to analyze monthly active users, new user acquisition, and discrete monthly revenue for custom app themes.

    SQL & Datasqltime-seriesaggregationwindow-functions
  • SQL & DataMediumModel answer
    Top Content Category by Country and Weekly Power-User Share

    Write SQL to find each country's top-impression category and the share of weekly active users who were active on 4+ days and used 3+ distinct features on a single day.

    SQL & Datasqlwindow-functionsaggregationcte
  • SQL & DataMediumModel answer
    Calculate Early User Retention Rates by Subscription Tier

    Compute 7-day retention rates across user subscription plans using PostgreSQL, handling distinct user counts, edge cases, and four-decimal precision.

    SQL & Datasqlpostgresqlaggregationsjoins
  • SQL & DataMediumModel answer
    Dropping Ever-Free Companies Before Monthly YoY Signup Counts

    Rework a monthly new-customer and year-over-year report so companies listed in a free-plan table vanish from every month, using a duplicate-safe anti-join applied before aggregation.

    SQL & Datasqlanti-joinnot-existscte
  • SQL & DataMediumModel answer
    Monthly Country Dashboard: Signups, Conversion, Retention, GMV, Campaign

    Write a single SQL query that builds a month-by-country report covering signups, 7-day conversion, day-7 retention, valid GMV, and last-touch top campaign, with dedup and UTC handling.

    SQL & Datasqlcohort-analysisretentionwindow-functions
  • SQL & DataMediumModel answer
    Calculate Trailing 12-Month Segment Default Rates

    Write SQL to aggregate defaults and accounts over a trailing 12-month window for each customer segment, correctly handling non-consecutive dates and zero division.

    SQL & Datasqlwindow-functionstime-seriesaggregation
  • SQL & DataMediumModel answer
    Mean Imputation of Numeric Columns in a pandas DataFrame

    Replace NaNs in numeric DataFrame columns with column means, then extend it to in-place updates, per-group means and all-NaN columns, with non-numeric columns left alone.

    SQL & Datapandasmissing-dataimputationgroupby
  • SQL & DataEasyModel answer
    Daily Revenue from Impression-Active Ads, Split by Origin

    Write a SQL query that reports, per UTC day and ad origin, how many ads were active and how much revenue those ads earned on days they were active.

    SQL & Datasqljoinsaggregationfan-out
  • SQL & DataEasyModel answer
    Pivot Quarterly Crypto Sales and Yearly Totals in SQL

    Write an efficient SQL query to aggregate quarterly activity and overall yearly stats per cryptocurrency, preserving coins with zero transactions.

    SQL & Datasqlaggregationjoinspivoting
  • SQL & DataMediumModel answer
    Shared-Document Analytics: Sources, Partners, and Country Rates

    Use deduplicated user-document pairs to analyze how collaborators arrive, who works most with a given user, and which country has the highest share of users who collaborate.

    SQL & Datasqlpandasself-joindeduplication
  • SQL & DataHardModel answer
    Detect Suspicious Annotators in Data Pipelines

    Process crowd-sourced label data to compute consensus metrics and flag underperforming annotators at scale.

    SQL & Datapandasdata-cleaningdata-analysisgroup-by
  • SQL & DataMediumModel answer
    Exposure Rate of Violating Content: Ex-ante vs Ex-post Views

    Write SQL that labels each view by the moderation decision known at view time and by the final decision, computes daily prevalence per country, and ranks the top creators by violating share.

    SQL & Datasqlwindow-functionsas-of-joinlateral-join
  • SQL & DataMediumModel answer
    Trailing Week Totals of Voice Assistant Replies per Device

    Write a query that gives each device's total replies over the current day and the six days before it, handling duplicate rows and missing dates correctly.

    SQL & Datasqlwindow-functionstime-seriespandas
  • SQL & DataMediumModel answer
    Video Call Metrics: Regional Reach and Per-User Talk Time

    Write two SQL queries over daily call and profile tables: the share of French users on a call yesterday, and total U.S. call time divided by the number of U.S. daily-active users today.

    SQL & Datasqljoinsaggregationdeduplication
  • SQL & DataMediumModel answer
    Courier Earnings Report from a Paginated Payments Feed

    Aggregate per-courier earnings for a pay period from a paginated, time-zoned event feed, handling corrections, cancellations, and rounding, with itemized totals.

    SQL & Datapythondata-aggregationpaginationtimezones
  • SQL & DataMediumModel answer
    Row Removal, Saved Queries and Pairing Every Row in SQL

    Explain how DELETE and TRUNCATE differ, when a view beats a stored table, and how a CROSS JOIN builds full combination grids, using a small employee and department schema.

    SQL & Datasqldelete-vs-truncateviewscross-join
  • SQL & DataMediumModel answer
    Weekly Top Dialers and Share of French Video Participants

    Write two SQL queries on a call-log table: rank the ten users who placed the most calls in the past week, and compute the share of yesterday's French users who joined a video call.

    SQL & Datasqlaggregationdate-filteringconditional-aggregation
  • SQL & DataMediumModel answer
    CTR Metrics with Deduplication Windowing and PR Model Evaluation

    Evaluate A/B experiment unique CTR using windowed SQL deduplication and analyze model precision-recall performance with weighted sample thresholds in Python.

    SQL & DataSQLWindow FunctionsPandasPrecision-Recall
  • SQL & DataMediumModel answer
    Find Highest Weighted Venue Locations with Data Cleaning

    Compute top venue locations by summing vote weights using SQL and Python, while handling missing values, text normalization, and ties.

    SQL & DataSQLPythonData CleaningAggregation
  • SQL & DataMediumModel answer
    Weekly Revenue Aggregation and Regional Drop Attribution

    Aggregate weekly revenue in SQL using ISO weeks, calculate period-over-period performance, and attribute regional drop drivers with guardrails against incomplete weeks.

    SQL & Datasqltime-seriesaggregationwindow-functions
  • SQL & DataMediumModel answer
    Banner CTR and Session Change Analysis in Pandas

    Clean a click-stream with pandas to compute daily banner CTR without bots or accidental clicks, user-level CTR by signup cohort, and per-user session-length change around a feature launch.

    SQL & Datapandasmerge_asofsessionizationctr
  • SQL & DataMediumModel answer
    Designing a Scalable Event Data Analytics Warehouse

    Architect an end-to-end data warehouse for high-throughput event logs, detailing schema design, idempotent deduplication, metric modeling, and performance optimization.

    SQL & Datadata-warehousingschema-designsqlevent-data
  • SQL & DataMediumModel answer
    Iterative Nested List Flattening and UTC Active User Metrics

    Implement an iterative nested list flattener in Python with edge-case handling, and construct a SQL query to compute Daily Active Users (DAU) using strict UTC date casting.

    SQL & Datapythonsqlstacks-queuesdata-manipulation
  • SQL & DataMediumModel answer
    Multi-Task SQL Analytics for On-Demand Logistics

    Solve multi-part SQL analytics queries covering sparse dimensions, gap-and-island sequences, conversion metrics, and latency percentiles.

    SQL & Datasqlwindow-functionsgaps-and-islandspercentiles
  • SQL & DataMediumModel answer
    Single Funnel Score for Ads from Impression and Click Logs

    Design one metric that blends click-through and purchase quality, then write SQL that attributes clicks to impressions and reports it per ad for the past week.

    SQL & Datasqljoinswindow-functionsmetrics
  • SQL & DataMediumModel answer
    Pooled Reply Rates per Category with Wilson Intervals in pandas

    Clean a job-postings table, compute invitation-weighted reply rates per category with 95% Wilson intervals, rank the top 5, and check the weighting identity numerically.

    SQL & Datapandasgroupbywilson-intervaldata-cleaning
  • SQL & DataMediumModel answer
    Revenue Rollups, a 2x2 Pivot and a VIP Flag in pandas

    Join two small tables in pandas, then build channel revenue totals, a member-by-channel pivot, per-state order and buyer counts, and a rule-based high-value flag.

    SQL & Datapandasmergegroupbypivot_table