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 121–139 of 139 results

  • SQL & DataMediumModel answer
    Build a Region-Level Revenue Summary with Pandas

    Merge two DataFrames on a shared key, then aggregate transaction amounts by region to produce a sorted summary of total and average spend.

    SQL & Datapandasgroupbymergeaggregation
  • SQL & DataMediumModel answer
    Rebooking Rate After Initial Cancellation

    Calculate what fraction of users whose earliest appointment was cancelled never scheduled another confirmed or returned appointment afterward.

    SQL & Datasqlwindow-functionsctecohort-analysis
  • SQL & DataMediumModel answer
    Pairing Clock-In and Clock-Out Records Across Calendar Days

    Calculate daily hours worked per employee from timestamp-based clock events, handling midnight transitions and data anomalies.

    SQL & Datasqlwindow-functionstime-seriesdata-quality
  • SQL & DataMediumModel answer
    Calculate Contributor Type Distribution from Activity Logs

    Clean and aggregate edit logs to compute daily percentages of documents edited by owners versus anonymous users.

    SQL & Datadata-cleaningaggregationjoinspandas
  • SQL & DataMediumModel answer
    Aggregate Event Signal Quality Across Advertiser Pixels

    Compute pixel-level signal metrics aggregated to advertiser-day grain, then correlate data quality scores with conversion and revenue performance.

    SQL & Datasqlaggregationjoinsweighted-averages
  • SQL & DataMediumModel answer
    Survey Response Rates and Rating Comparison by User Tenure

    Compute an overall survey response rate and compare average notification ratings across user tenure cohorts using SQL joins, aggregation, and bucketing.

    SQL & Datasqlaggregationcohort-analysisjoins
  • SQL & DataMediumModel answer
    SQL Window Functions: Streaks, Daily Metrics, and Inactivity Gaps

    Use window functions to detect consecutive-day activity streaks, compute rolling DAU and revenue metrics, and identify post-order inactivity gaps across three related tables.

    SQL & Datawindow-functionsgap-and-islandrolling-aggregatesdate-arithmetic
  • SQL & DataMediumModel answer
    Multi-Part SQL Challenge on a Food Delivery Schema

    Write six targeted SQL queries spanning window functions, event anomalies, time-based filtering, and promo uplift analysis on a realistic food delivery dataset.

    SQL & Datawindow-functionsaggregationjoinstime-series
  • SQL & DataMediumModel answer
    Ad Group Funnel Metrics with Below-Mean CTR Filter

    Write a single SQL query that computes cost, CTR, and conversion metrics per ad group, then returns only those with CTR below the unweighted average.

    SQL & Datasqlctewindow-functionsnull-handling
  • SQL & DataMediumModel answer
    Detect and Remove Daily Revenue Outliers by Product

    Build a pandas pipeline that aggregates raw sales records, flags per-product outliers using IQR or Z-score, then plots the distribution before and after cleaning.

    SQL & Datapandasoutlier-detectiondata-cleaningmatplotlib
  • SQL & DataMediumModel answer
    Event Stream Analytics: Sessions, Funnels, and Segment Performance

    Process user activity logs to build sessions, compute conversion metrics by segment, construct a deduplicated funnel, and identify high-performing segments with confidence intervals.

    SQL & Datapandasdata-analysissessionizationmetrics
  • SQL & DataMediumModel answer
    Improve a Pandas Pipeline: Validation, Testing, and Packaging

    Fix defects in a CSV processing script, refactor for testability with type hints and input checks, write unit tests, and package with Conda.

    SQL & Datapandasrefactoringtestingdata-validation
  • SQL & DataMediumModel answer
    Design and Query a Retail Order Database

    Build a PostgreSQL schema for orders, write insert statements, compute revenue aggregates with outer joins, filter recent purchases, and update coupon fields.

    SQL & Datasqlschema-designaggregationjoins
  • SQL & DataMediumModel answer
    Aggregate Session Time by Category Over a Rolling Week

    Calculate the percentage of total usage time for each application category across the most recent seven days of user sessions.

    SQL & Datasqldata-analysisaggregationjoins
  • SQL & DataMediumModel answer
    Analyzing User Activity and Engagement Patterns with SQL

    Write SQL queries to analyze user engagement, including identifying inactive users, calculating monthly aggregates, segmenting by usage frequency, and tracking retention.

    SQL & Datasqljoinswindow-functionsaggregation
  • SQL & DataMediumModel answer
    Extract User Metrics and Daily Summaries from Order Data

    Perform three pandas aggregations: identify each user's highest-value order, calculate mean order value, and generate per-day order statistics.

    SQL & Datapandasaggregationgroupbydata-analysis
  • SQL & DataMediumModel answer
    Driver Earnings Calculator with Time Overlap Handling

    Build a pay calculator that validates delivery records, merges overlapping time windows, and computes driver earnings using configurable rate rules.

    SQL & Datadata-validationtime-intervalsaggregation
  • SQL & DataHardModel answer
    Rolling Window Metrics and Multi-Role Activity Analysis

    Build SQL queries to calculate rolling 7-day caller engagement rates and single-day participation thresholds for geo-filtered active users.

    SQL & Datasqlaggregationwindow-functionstimezone-handling
  • SQL & DataMediumModel answer
    Cumulative Loss Projection Across Policy Renewals

    Compute the projected total loss from each policy renewal onward, summing the current period's loss with all subsequent renewal periods.

    SQL & Datawindow-functionsaggregationinsurance