KatInterview

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

SQL Interview Problems

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

5971
Problems
2211
Auto-graded
15
Topics
272
Added today

Showing 61–90 of 100 results

  • SQL & DataMediumAuto-graded
    Aggregate Transactions by Country for Most Recent Active Period

    Tests date handling, filtering, and grouped aggregation to find the latest month with successful records and summarize by region.

    SQL & Dataaggregationdate-manipulationfiltering
  • SQL & DataMediumAuto-graded
    User Signup and Follower Metrics Report

    Simulate three SQL analytics queries in Python: total users, busiest signup month (with tie-break), and the most-followed usernames including ties.

    SQL & Dataaggregationgroupingcountingties
  • SQL & DataMediumAuto-graded
    Weekly Cohort Activity Retention Analysis

    Group users by signup week, compute seven-day activity retention rates, and handle zero-retention cohorts correctly.

    SQL & Datadata-analysiscohort-analysisretentionaggregation
  • SQL & DataMediumAuto-graded
    Classify Risky Transactions and Dispute History

    Tests multi-window aggregation, business-rule encoding, and precise date/time boundary handling across three related data tables.

    SQL & Datadata-manipulationdatetimebusiness-rules
  • SQL & DataMediumAuto-graded
    Conditional Sum Aggregation with Group Filtering

    Compute filtered totals two ways and group-then-threshold results, mirroring SQL conditional aggregation semantics.

    SQL & Dataconditional-aggregationgroupingsimulationpython
  • SQL & DataMediumAuto-graded
    Reconcile Ledger and Bank Snapshots for a Month

    Join two per-month balance datasets on account id, classify each account as match, mismatch, or missing on one side, handling true zero balances correctly.

    SQL & Datahashingjoindata-manipulationedge-cases
  • SQL & DataMediumAuto-graded
    Distinct Content Categories per Reader

    Tests two-level aggregation: counting distinct content categories per reader on a target date, then bucketing those counts into a frequency histogram across all dates.

    SQL & Datagroupingaggregationhistogramhashing
  • 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 & 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 & 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 & 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 & 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 & 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
  • 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 & 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 & 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 & 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 & 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