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 211–239 of 239 results

  • SQL & DataMediumAuto-graded
    Aggregating Safety and Activity Metrics Across Multiple Entities

    Tests proficiency in multi-table aggregation, ratio computation, windowed moving averages, and handling edge cases with missing data.

    SQL & Dataaggregationjoinswindow-functionsdata-analysis
  • SQL & DataEasyAuto-graded
    Social Media Reply Analytics

    Analyzes reply patterns in social media data using temporal filtering, joins, and aggregation to compute engagement metrics.

    SQL & Datadata-analysisaggregationfiltering
  • SQL & DataMediumAuto-graded
    Deduplicate and Reconcile Customer Records

    Tests the ability to clean a list of messy customer records by deduplicating on a canonical key, resolving field conflicts with explicit priority rules, and returning a sorted, normalized result.

    SQL & Datadata cleaningdeduplicationaggregation
  • SQL & DataMediumAuto-graded
    Compute Running Department Salary Budget with Resets

    Tests the ability to implement window-style running totals that accumulate within groups and reset at group boundaries, mimicking SQL's SUM() OVER (PARTITION BY ... ORDER BY ...).

    SQL & Datawindow functionsrunning totalsdata processing
  • 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 & DataMediumAuto-graded
    Find Most Similar Item Collections

    Tests set operations, pairwise comparison, and tie-breaking logic to identify the pair of collections with maximum item overlap.

    SQL & Datasetssimilarity-metricsdata-manipulation
  • 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 & DataMediumAuto-graded
    Aggregate Sales Report from Transaction Records

    Tests the ability to perform group-by aggregation (sum, count, average) over a list of dicts, mimicking SQL GROUP BY with multiple metrics and tie-breaking output order.

    SQL & Datagroup-by aggregationdata cleaninglist of dicts
  • SQL & DataEasyAuto-graded
    Summarize Monthly Sales by Region from Transaction Records

    Tests group-by aggregation: given a list of transaction dicts, compute total revenue and order count per region per month, returned as a sorted list of summary records.

    SQL & Datadata aggregationdictionariessorting
  • 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 & DataMediumAuto-graded
    Sequence Numbering Within Grouped Records

    Tests ability to assign sequential positions to records within partitions using sorting and grouping logic.

    SQL & Datawindow-functionssortinggrouping
  • SQL & DataMediumAuto-graded
    Day-7 User Activity Counter

    Identify users who recorded at least one activity exactly seven calendar days after joining.

    SQL & Datadata-analysisdate-manipulationset-operations
  • 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 & DataMediumAuto-graded
    Ranking Actors by Film Count in a Unified Object Database

    Tests filtering credits by role, deduplicating person-movie pairs, validating object types in a shared ID space, and applying a deterministic tie-breaking policy.

    SQL & Datadata-aggregationfilteringdeduplication
  • SQL & DataMediumAuto-graded
    Build a Deterministic Top-10 Leaderboard with Tie-Breaking

    Tests your ability to produce a fixed-size ranked list when scores contain ties, using a stable secondary sort key.

    SQL & Datarankingsortingtie-breakingleaderboard
  • SQL & DataMediumAuto-graded
    Filter Hosts by Property Count, Rating, and Review Recency

    Tests multi-table aggregation with date-windowed filtering, distinct counting, and host-level qualification across inventory, ratings, and coverage.

    SQL & Dataaggregationmulti-tabledate-filteringconditional-logic
  • 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
  • SQL & DataHardAuto-graded
    Compute Per-Group Running Revenue Share with Reset

    Tests window-style running totals and per-group aggregation by computing a cumulative percentage-of-group-total that resets for each new group, given pre-sorted row data.

    SQL & Datawindow functionsrunning totalsaggregationdata processing
  • SQL & DataHardAuto-graded
    Compute Per-Category Running Revenue with Reset on Loss

    Tests ability to implement window-style running totals that accumulate per category but reset to zero whenever a loss (negative value) would pull the running total below zero.

    SQL & Datawindow functionsrunning totalsdata cleaningsimulation
  • SQL & DataMediumAuto-graded
    Reconcile Orders with Product Catalog via Inner Join

    Tests the ability to join two lists of dicts (orders + products) on a key, aggregate per customer, and return a cleaned, sorted summary.

    SQL & Datadata manipulationjoinsaggregation
  • SQL & DataMediumAuto-graded
    Reconcile Sales Orders with Product Catalog

    Tests joining two lists of dicts (orders + products) on a key, then aggregating revenue and applying data-cleaning rules.

    SQL & Datadata manipulationjoinsaggregation
  • SQL & DataEasyAuto-graded
    Summarize Monthly Sales by Region

    Tests ability to perform group-by aggregation over a list of transaction records, computing per-region monthly totals and counts.

    SQL & Datadata manipulationgroup-byaggregation
  • SQL & DataMediumAuto-graded
    Summarise Monthly Revenue by Region from Transaction Records

    Tests group-by aggregation over a list-of-dict dataset, requiring candidates to compute per-region monthly totals, fill gaps, and apply a tie-break for ranking.

    SQL & Datadata manipulationaggregationgroup-bydictionaries
  • SQL & DataMediumAuto-graded
    Running Department Budget Balance by Month

    Tests the ability to compute a month-over-month running total (cumulative sum) of expenses per department, mimicking a SQL window function with PARTITION BY and ORDER BY.

    SQL & Datawindow functionsrunning totalsdata aggregationpandas-style logic
  • SQL & DataMediumAuto-graded
    Deduplicate and Canonicalize Customer Records

    Tests ability to clean a list of raw customer record dicts by resolving duplicates, normalizing fields, and returning one canonical record per customer.

    SQL & Datadata cleaningdeduplicationdictionariessorting
  • SQL & DataMediumAuto-graded
    Reconcile Employee Project Hours Across Two Tables

    Tests the ability to join two lists of dicts (employees and time-log entries) and compute per-employee aggregated project statistics, mimicking a SQL left join + GROUP BY.

    SQL & Datadata manipulationjoiningaggregation