practice a little every day — you've got this ♡
SQL 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 31–60 of 239 results
- SQL & DataMediumModel answerBuild a Pandas Pipeline for Portfolio Returns and Risk Metrics
Design a pandas workflow that cleans price CSVs, builds portfolio returns under several rebalancing rules, and reports return, risk, Sharpe and drawdown metrics for multiple portfolios.
SQL & Datapandastime-seriesportfolio-analyticsdata-cleaning - SQL & DataMediumAuto-gradedTop Opening Film Across Subscriber Watch Logs
Find each user's earliest-watched title, then pick the title that opens the most users' histories, using deterministic tie-breaking rules.
SQL & Datahash-mapaggregationtie-breakinggroup-by - SQL & DataMediumAuto-gradedCheapest Top-Rated Purchase per Category
Join two tables as lists, filter on a strict rating threshold with missing values, and compute a per-group minimum with a default of 0 and sorted output.
SQL & Dataaggregationleft-joinnull-handlinggroup-by - SQL & DataEasyAuto-gradedDaily Spend Ranking for Frequent Payers
Filter users by total event count, then rank each user's payments within each calendar day by amount using competition ranking (ties share a rank, then a gap).
SQL & Datawindow-functionsgroupingrankingsorting - SQL & DataMediumModel answerFeature Activation, Time-to-First-Purchase, and Region Switching in SQL
Write SQL over users and transactions for regional activation and purchase rates, first-purchase latency with percentiles, and flagging purchases made outside a user's first-purchase region.
SQL & Datasqlwindow-functionspercentilescohort-metrics - SQL & DataMediumAuto-gradedDay-30 Cohort Retention from Signup and Activity Logs
Group users into signup-date cohorts and count who was active exactly 30 days later, using sets and date arithmetic with careful handling of duplicates.
SQL & Datahash-setdate-arithmeticaggregationcohort-analysis - SQL & DataMediumAuto-gradedTop Three Categories by Average October Sale Value
Filter records to one month, group by key, apply a minimum-count threshold, compute a rounded average, and return the top three groups, mirroring a SQL WHERE/GROUP BY/HAVING/ORDER BY/LIMIT pipeline.
SQL & Dataaggregationhash-mapgroup-bysorting - SQL & DataMediumModel answerMonthly Channel Cohorts: Measuring First-Month Account Usage
Write a SQL report of how many new banking users make three or more completed debits totaling at least $50 in their first 30 days, grouped by signup month and channel, excluding immature cohorts.
SQL & Datasqlcohort-analysisleft-joinconditional-aggregation - SQL & DataMediumModel answerQuarterly Revenue Query and Largest-File Shell Script
Write a SQL query that totals 2023 sales by quarter, and a robust bash script that finds the largest file under a directory, handling odd filenames and error cases.
SQL & Datasqlaggregationgroup-bybash - SQL & DataMediumAuto-gradedFind Bottom Three Active Regions by Unique User Count
Aggregate user log data to calculate distinct active users per country in 2023, then return the 3 least active countries.
SQL & Dataarrayshash-tablesortingaggregation - SQL & DataMediumModel answerRolling ETA median, DiD and CUPED uplift on ride-request data
Build a gap-free daily city series with a 7-day rolling median ETA and conversion in PostgreSQL, then estimate uplift with city-level DiD and a CUPED-adjusted, cluster-robust estimate in Python.
SQL & Datapostgresqlwindow-functionsdate-spinedifference-in-differences - SQL & DataMediumModel answerUser Spend Tiers in Pandas and Daily Platform Conversion in SQL
Build a per-user revenue and distinct-purchase table with tiers in Pandas, then write SQL for daily purchase-to-click conversion by platform over the last 30 days.
SQL & Datapandasgroupbysqlconditional-aggregation - SQL & DataHardModel answerAnalyzing Noisy A/B Experiment Metrics and SRM in SQL
Write SQL queries to censor crossover exposures, compute 14-day conversion metrics under blackout constraints, and calculate an SRM chi-square p-value.
SQL & DataSQLA/B TestingExperimentationWindow Functions - SQL & DataEasyAuto-gradedLoan Count Gap Between Newest Member and Their Sponsor
Tests table-style aggregation in Python: select the row with the highest key, count occurrences per key, and handle null or missing sponsor references with a default of zero.
SQL & Dataaggregationhash-mapnull-handlingjoins - SQL & DataMediumModel answerRolling Cold-Food Delivery Metric Calculation in PostgreSQL
Write PostgreSQL queries to flag cold food deliveries, calculate daily and rolling 7-day cold delivery rates, rank restaurants, and detect courier quality outliers with z-scores.
SQL & Datasqlwindow-functionsaggregationscte - SQL & DataMediumModel answerPower Sellers and Vehicle Share of New US Listing Engagement
Two SQL tasks on a marketplace: count sellers with many well-engaged products in a short window, and compute the Vehicle share of interactions on newly created US listings.
SQL & Datasqljoinsaggregationsnapshot-tables - SQL & DataMediumModel answerRadiology Claims Spend Summary with Fiscal-Month Mapping in pandas
Clean a small claims CSV in pandas: sum spend per procedure group, compute each group's share of the total, and derive an October-based fiscal month without row loops.
SQL & Datapandasdata-cleaninggroupbydatetime - SQL & DataMediumAuto-gradedRebuild a Seven-Day Account Exposure Report from Trade Feeds
Deduplicate late-arriving trade versions, filter by status, window and KYC, then aggregate per account and day into exposure, utilization and breach figures.
SQL & Datadata-manipulationdeduplicationaggregationjoins - SQL & DataEasyAuto-gradedFind Nth Highest Distinct Salary
Find the Nth highest unique value in a list of integers, returning None if N is out of valid bounds.
SQL & Dataarrayssortingsql - SQL & DataMediumModel answerLeveraging AI Assistance Responsibly in SQL Collaborative Coding
Learn how to conduct an AI-assisted SQL pair-programming session while demonstrating clear reasoning, strict data safety, step-by-step query construction, and rigorous verification.
SQL & DataSQLPair ProgrammingAI Coding ToolsCode Quality - SQL & DataMediumModel answerSeven-Day Return Rate from a Daily Posting Log
From a per-day post count table, find each user's first active date, their first-week post total, and the share of users who were active on the seventh day of their life on the platform.
SQL & Datasqlwindow-functionsretentioncohort-analysis - SQL & DataMediumAuto-gradedAnalyze Live Streaming Telemetry and Viewing Events
Process minute-level streaming activity and viewer events to calculate time-series metrics, category shares, month-over-month growth, and joined yearly summaries.
SQL & Datadata-aggregationtime-seriesjoinsanalytics - SQL & DataMediumModel answerGap Between a User's Two Latest Views of the Same Ad
Write one SQL query returning, per user and ad with at least two views, the newest and second-newest timestamps plus the gap between them in seconds.
SQL & Datasqlwindow-functionsrow-numbertimestamp-arithmetic - SQL & DataMediumModel answerSeller Enforcement Timeline and Repeat-Buyer Product Filters
Three SQL/pandas tasks: find sellers penalized after a reinstatement, get the first event after the latest reinstatement, and find customers who bought A in 2010 and B in 2018.
SQL & Datasqlwindow-functionsconditional-aggregationpandas - SQL & DataMediumModel answerEvaluating Content Performance by Audience Relationship Type
Analyze video engagement and interaction rates segmented by viewer relationship types over a rolling 7-day window using SQL aggregations and joins.
SQL & Datasqlaggregationjoins - SQL & DataMediumAuto-gradedDaily SHOP vs WEBSITE Revenue Mix and Efficiency Report
Aggregate two event tables over a 30-day window, fill missing rows with zeros, and compute safe-division shares and revenue-per-conversion per day and destination.
SQL & Dataaggregationhash-mapdate-windowdata-manipulation - SQL & DataHardModel answerMeasuring a Premium Plan Launch and Building Fraud Alert Rules
Define launch success for a new paid tier using only transaction and activity tables, then design a rule-based SQL alerting system for suspicious payments.
SQL & Dataproduct-analyticscohort-retentionsql-window-functionsfraud-rules - SQL & DataMediumModel answerDesign an Idempotent Incremental Data Pipeline for Big Data Tables
Explain how to build a robust, idempotent daily incremental ingestion workflow that handles duplicates, backfills, and schema validation on large relational tables.
SQL & Datadata-engineeringsqletldata-pipelines - SQL & DataMediumModel answerCalculating Monthly Theme Engagement and Revenue Trends in SQL
Define usage growth metrics and write SQL to analyze monthly active users, new user acquisition, and discrete monthly revenue for custom app themes.
SQL & Datasqltime-seriesaggregationwindow-functions - SQL & DataMediumModel answerTop Content Category by Country and Weekly Power-User Share
Write SQL to find each country's top-impression category and the share of weekly active users who were active on 4+ days and used 3+ distinct features on a single day.
SQL & Datasqlwindow-functionsaggregationcte