KatInterview

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.

Problems239

27 easy200 medium12 hard

Showing 211–239 of 239 results

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

    Auto-gradedaggregationjoinswindow-functionsdata-analysis
  • Analyzes reply patterns in social media data using temporal filtering, joins, and aggregation to compute engagement metrics.

    Auto-gradeddata-analysisaggregationfiltering
  • 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.

    Auto-gradeddata cleaningdeduplicationaggregation
  • 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 ...).

    Auto-gradedwindow functionsrunning totalsdata processing
  • Fix defects in a CSV processing script, refactor for testability with type hints and input checks, write unit tests, and package with Conda.

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

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

    Auto-gradedsetssimilarity-metricsdata-manipulation
  • Calculate the percentage of total usage time for each application category across the most recent seven days of user sessions.

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

    Model answersqljoinswindow-functionsaggregation
  • 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.

    Auto-gradedgroup-by aggregationdata cleaninglist of dicts
  • 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.

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

    Model answerpandasaggregationgroupbydata-analysis
  • Tests ability to assign sequential positions to records within partitions using sorting and grouping logic.

    Auto-gradedwindow-functionssortinggrouping
  • Identify users who recorded at least one activity exactly seven calendar days after joining.

    Auto-gradeddata-analysisdate-manipulationset-operations
  • Build a pay calculator that validates delivery records, merges overlapping time windows, and computes driver earnings using configurable rate rules.

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

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

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

    Auto-gradedaggregationmulti-tabledate-filteringconditional-logic
  • Build SQL queries to calculate rolling 7-day caller engagement rates and single-day participation thresholds for geo-filtered active users.

    Model answersqlaggregationwindow-functionstimezone-handling
  • Compute the projected total loss from each policy renewal onward, summing the current period's loss with all subsequent renewal periods.

    Model answerwindow-functionsaggregationinsurance
  • 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.

    Auto-gradedwindow functionsrunning totalsaggregationdata processing
  • 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.

    Auto-gradedwindow functionsrunning totalsdata cleaningsimulation
  • Tests the ability to join two lists of dicts (orders + products) on a key, aggregate per customer, and return a cleaned, sorted summary.

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

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

    Auto-gradeddata manipulationgroup-byaggregation
  • 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.

    Auto-gradeddata manipulationaggregationgroup-bydictionaries
  • 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.

    Auto-gradedwindow functionsrunning totalsdata aggregationpandas-style logic
  • Tests ability to clean a list of raw customer record dicts by resolving duplicates, normalizing fields, and returning one canonical record per customer.

    Auto-gradeddata cleaningdeduplicationdictionariessorting
  • 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.

    Auto-gradeddata manipulationjoiningaggregation

More topics