KatInterview

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

SQL 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 181–210 of 239 results

  • SQL & DataMediumModel answer
    Filter users by location and rank forums by activity

    Write SQL to classify users as US-based using profile and IP data, then identify the top forums by post volume and distinct contributors over a rolling 30-day window.

    SQL & Datasqlaggregationjoinswindow-functions
  • SQL & DataMediumModel answer
    SQL Net Revenue Rankings and Transaction Data Quality Checks

    Write SQL queries to rank vendors by net revenue globally and by city/state, then design and implement data quality checks on a transaction table.

    SQL & Datasqlwindow-functionsdata-qualityaggregation
  • SQL & DataMediumModel answer
    Freight Analytics: Top States, Daily Rates, and Running Totals

    Join three logistics tables to rank states by completed jobs, compute daily average rates, and build a running cumulative count using window functions.

    SQL & Datawindow-functionsaggregationjoinscte
  • SQL & DataMediumModel answer
    Compute Daily Conversion and User Order History with Deduplication

    Write SQL to calculate daily conversion metrics and per-user order summaries over a week, handling event deduplication and missing days.

    SQL & Datawindow-functionsaggregationdeduplicationdate-ranges
  • SQL & DataMediumModel answer
    Build Candlestick Bars from a Raw Price Feed

    Parse a string of price-timestamp ticks, bucket them into fixed-width time windows, compute OHLC stats, and forward-fill any empty windows.

    SQL & Datatime-seriesaggregationdata-manipulationpython
  • SQL & DataEasyAuto-graded
    Co-Access Analytics on Document Usage Logs

    Tests data deduplication, self-joins, metric definition, and grouped aggregation over access logs with user metadata.

    SQL & Datadata-manipulationaggregationjoinsdeduplication
  • SQL & DataMediumAuto-graded
    Monthly Revenue Summary by Product Category

    Tests group-by aggregation over a list of transaction records to compute per-category monthly revenue, count, and average order value.

    SQL & Datagroup-by aggregationdata cleaningdictionaries
  • SQL & DataMediumAuto-graded
    Daily Session Starters: Count Users Who Opened the App First

    Tests window-function thinking, tie-breaking logic, and grouped aggregation by finding users whose very first recorded action each day was opening the app.

    SQL & Datasimulationhash-mapsorting
  • SQL & DataMediumAuto-graded
    Carrier Defect Metrics and High-Risk Shipping Routes

    Aggregating shipment quality metrics by carrier and time period, computing period-over-period changes, and ranking routes by defect frequency.

    SQL & Dataaggregationjoinswindow-functionsdata-analysis
  • SQL & DataMediumModel answer
    Retrieve and rank teams from a paginated REST API

    Build a client that fetches all pages of team records, handles retries and rate limits, then returns the top n teams sorted by wins descending and name ascending.

    SQL & Datapaginationapierror-handlingsorting
  • SQL & DataMediumModel answer
    Resilient Paginated API Client with Aggregation

    Build a robust script that authenticates against a paginated REST API, handles rate limits and bad records, and produces serialized output plus top-k category aggregates.

    SQL & Datapythonrest-apipaginationdata-pipeline
  • SQL & DataMediumAuto-graded
    Calculate Engaged User Percentage by Region

    Classify users as engaged based on activity frequency and device diversity, then compute the engaged-user rate per region.

    SQL & Datadata-manipulationaggregationfiltering
  • 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 & DataMediumAuto-graded
    Multi-Year Sales Analysis by Customer Demographics

    Tests data joining, deduplication, cohort segmentation, conditional aggregation, and percentage calculations across multiple tables.

    SQL & Datadata-manipulationaggregationcohort-analysis
  • 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 & DataMediumAuto-graded
    Top 5 Delivery Routes by Fuel Efficiency

    Tests aggregating trip data across two tables, guarding against division by zero, and ranking results with a deterministic tie-break.

    SQL & Dataaggregationfilteringsorting
  • 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 & DataMediumAuto-graded
    Top Destination by Clear-Day Frequency

    Tests grouping, filtering categorical records, and correctly handling ties when aggregating a frequency count across multiple keys.

    SQL & Dataaggregationgroupingfilteringdictionaries
  • SQL & DataMediumAuto-graded
    Rolling-Window Post Engagement: Reach, Length Percentiles, Self-Replies

    Tests SQL/Python analytics skills: filtering soft-deleted records, distinct-count aggregation, linear-interpolation percentiles, time-windowed grouping, and tie-breaking sort logic.

    SQL & Datasqlaggregationpercentiles
  • SQL & DataMediumAuto-graded
    Regional Notification Performance Summary

    Tests join, filter, and conditional aggregation logic to compute per-region metrics with threshold filtering and safe division.

    SQL & Dataaggregationjoinsconditional-logicdata-analysis
  • 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 & DataMediumAuto-graded
    Highest Revenue Product per Category with Returns

    Tests data aggregation, join logic, net-revenue calculation accounting for returns, and ranking with tie-breaking.

    SQL & Dataaggregationjoinsrankingwindow-functions
  • SQL & DataEasyAuto-graded
    Compute Running Departmental Budget Consumed

    Tests ability to implement window-style running totals by computing each row's cumulative spend within its department, ordered by date then transaction ID.

    SQL & Datawindow functionsrunning totalsdata processing