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 61–90 of 239 results
- SQL & DataMediumModel answerCalculate Early User Retention Rates by Subscription Tier
Compute 7-day retention rates across user subscription plans using PostgreSQL, handling distinct user counts, edge cases, and four-decimal precision.
SQL & Datasqlpostgresqlaggregationsjoins - SQL & DataMediumModel answerDropping Ever-Free Companies Before Monthly YoY Signup Counts
Rework a monthly new-customer and year-over-year report so companies listed in a free-plan table vanish from every month, using a duplicate-safe anti-join applied before aggregation.
SQL & Datasqlanti-joinnot-existscte - SQL & DataMediumModel answerMonthly Country Dashboard: Signups, Conversion, Retention, GMV, Campaign
Write a single SQL query that builds a month-by-country report covering signups, 7-day conversion, day-7 retention, valid GMV, and last-touch top campaign, with dedup and UTC handling.
SQL & Datasqlcohort-analysisretentionwindow-functions - SQL & DataMediumAuto-gradedFlag Account Takeovers: New Login Followed by a Large Transfer
Join logins, users and transfers to flag logins from a new device or IP that are followed within two hours by a large transfer to a first-time recipient.
SQL & Datadata-manipulationtime-windowsjoinsfraud-detection - SQL & DataMediumModel answerCalculate Trailing 12-Month Segment Default Rates
Write SQL to aggregate defaults and accounts over a trailing 12-month window for each customer segment, correctly handling non-consecutive dates and zero division.
SQL & Datasqlwindow-functionstime-seriesaggregation - SQL & DataMediumModel answerMean Imputation of Numeric Columns in a pandas DataFrame
Replace NaNs in numeric DataFrame columns with column means, then extend it to in-place updates, per-group means and all-NaN columns, with non-numeric columns left alone.
SQL & Datapandasmissing-dataimputationgroupby - SQL & DataEasyModel answerDaily Revenue from Impression-Active Ads, Split by Origin
Write a SQL query that reports, per UTC day and ad origin, how many ads were active and how much revenue those ads earned on days they were active.
SQL & Datasqljoinsaggregationfan-out - SQL & DataMediumAuto-gradedStandardize Global Compensation and Rank Top Earners
Deduplicate employee records across regions, convert local salaries to USD using historical exchange rates, and rank the top earners.
SQL & Datadata-manipulationhash-mapsortingsql - SQL & DataEasyModel answerPivot Quarterly Crypto Sales and Yearly Totals in SQL
Write an efficient SQL query to aggregate quarterly activity and overall yearly stats per cryptocurrency, preserving coins with zero transactions.
SQL & Datasqlaggregationjoinspivoting - SQL & DataMediumModel answerShared-Document Analytics: Sources, Partners, and Country Rates
Use deduplicated user-document pairs to analyze how collaborators arrive, who works most with a given user, and which country has the highest share of users who collaborate.
SQL & Datasqlpandasself-joindeduplication - SQL & DataHardModel answerDetect Suspicious Annotators in Data Pipelines
Process crowd-sourced label data to compute consensus metrics and flag underperforming annotators at scale.
SQL & Datapandasdata-cleaningdata-analysisgroup-by - SQL & DataMediumAuto-gradedPark Ticket Revenue and Pass-Holder Visit Averages
Aggregate ticket revenue and shares, then compute average distinct in-period visits per annual-pass period, including zero-visit passes, to project total entries.
SQL & Dataaggregationjoinsdate-range-filteringhash-map - SQL & DataMediumModel answerExposure Rate of Violating Content: Ex-ante vs Ex-post Views
Write SQL that labels each view by the moderation decision known at view time and by the final decision, computes daily prevalence per country, and ranks the top creators by violating share.
SQL & Datasqlwindow-functionsas-of-joinlateral-join - SQL & DataMediumModel answerTrailing Week Totals of Voice Assistant Replies per Device
Write a query that gives each device's total replies over the current day and the six days before it, handling duplicate rows and missing dates correctly.
SQL & Datasqlwindow-functionstime-seriespandas - SQL & DataMediumModel answerVideo Call Metrics: Regional Reach and Per-User Talk Time
Write two SQL queries over daily call and profile tables: the share of French users on a call yesterday, and total U.S. call time divided by the number of U.S. daily-active users today.
SQL & Datasqljoinsaggregationdeduplication - SQL & DataMediumModel answerCourier Earnings Report from a Paginated Payments Feed
Aggregate per-courier earnings for a pay period from a paginated, time-zoned event feed, handling corrections, cancellations, and rounding, with itemized totals.
SQL & Datapythondata-aggregationpaginationtimezones - SQL & DataMediumAuto-gradedCalculate Monthly Subscription Churn and Revenue Retention
Process monthly user subscription snapshots to compute customer churn rate, gross revenue churn, and net revenue retention metrics.
SQL & Datadata-manipulationaggregationssaas-metricssql - SQL & DataEasyAuto-gradedCalculate Call Answer Metrics for Active Users
Process call records and lifecycle logs to compute the success rate of answered calls for eligible users within a specific time frame.
SQL & Datasqlarrayshash-table - SQL & DataMediumModel answerRow Removal, Saved Queries and Pairing Every Row in SQL
Explain how DELETE and TRUNCATE differ, when a view beats a stored table, and how a CROSS JOIN builds full combination grids, using a small employee and department schema.
SQL & Datasqldelete-vs-truncateviewscross-join - SQL & DataMediumModel answerWeekly Top Dialers and Share of French Video Participants
Write two SQL queries on a call-log table: rank the ten users who placed the most calls in the past week, and compute the share of yesterday's French users who joined a video call.
SQL & Datasqlaggregationdate-filteringconditional-aggregation - SQL & DataMediumAuto-gradedSegment Survey Ratings by User Tenure and Region
Filter invalid responses, categorize users by signup tenure, and aggregate satisfaction metrics by region and cohort.
SQL & Datadata manipulationaggregationgroupingfiltering - SQL & DataMediumAuto-gradedFind Top-Funded Municipalities and Their Leading Projects
Aggregate relational records over a specific date window to identify peak entities with tie preservation at multiple hierarchical levels.
SQL & Dataarrayshash-tablesortingdate-parsing - SQL & DataMediumModel answerCTR Metrics with Deduplication Windowing and PR Model Evaluation
Evaluate A/B experiment unique CTR using windowed SQL deduplication and analyze model precision-recall performance with weighted sample thresholds in Python.
SQL & DataSQLWindow FunctionsPandasPrecision-Recall - SQL & DataMediumModel answerFind Highest Weighted Venue Locations with Data Cleaning
Compute top venue locations by summing vote weights using SQL and Python, while handling missing values, text normalization, and ties.
SQL & DataSQLPythonData CleaningAggregation - SQL & DataMediumModel answerWeekly Revenue Aggregation and Regional Drop Attribution
Aggregate weekly revenue in SQL using ISO weeks, calculate period-over-period performance, and attribute regional drop drivers with guardrails against incomplete weeks.
SQL & Datasqltime-seriesaggregationwindow-functions - SQL & DataMediumModel answerBanner CTR and Session Change Analysis in Pandas
Clean a click-stream with pandas to compute daily banner CTR without bots or accidental clicks, user-level CTR by signup cohort, and per-user session-length change around a feature launch.
SQL & Datapandasmerge_asofsessionizationctr - SQL & DataMediumModel answerDesigning a Scalable Event Data Analytics Warehouse
Architect an end-to-end data warehouse for high-throughput event logs, detailing schema design, idempotent deduplication, metric modeling, and performance optimization.
SQL & Datadata-warehousingschema-designsqlevent-data - SQL & DataMediumModel answerIterative Nested List Flattening and UTC Active User Metrics
Implement an iterative nested list flattener in Python with edge-case handling, and construct a SQL query to compute Daily Active Users (DAU) using strict UTC date casting.
SQL & Datapythonsqlstacks-queuesdata-manipulation - SQL & DataMediumAuto-gradedLongest Average Calls Leaderboard Since a Cutoff
Filter call records by start time, group by user to get average duration in minutes, then rank with a deterministic tie-break and keep the top 10.
SQL & Datagroup-byaggregationdatetimesorting - SQL & DataMediumModel answerMulti-Task SQL Analytics for On-Demand Logistics
Solve multi-part SQL analytics queries covering sparse dimensions, gap-and-island sequences, conversion metrics, and latency percentiles.
SQL & Datasqlwindow-functionsgaps-and-islandspercentiles