The bank
255 SQL interview questions
Every question has a sample you can query and hidden datasets that catch the usual mistakes. 65 are free without an account. Filter by pattern, role or difficulty, and pick up where you left off.
- Billed, paid and outstanding by industryFinance wants a receivables summary by customer industry, using every invoice in invoices.
- First and last product name and launch date by categoryThe catalog team is tidying the product list and wants a quick profile of each category.
- First response times by priorityThe support lead wants a response-time summary for each ticket priority, using every row in tickets.
- Five-star trips per driver in June, idle drivers includedThe community team wants to thank drivers for great service and also see who got no recognition. For June 2025, count each driver's five-star trips.
- Monthly money in, money out and net flowFinance wants a monthly cash-flow table for the whole bank, using every row in transactions.
- Orders, coupon orders and customers by channelThe marketing lead wants one summary line per sales channel. Use every row in orders, whatever its status.
- Plays, listeners and hours by genreThe content team wants one line of listening stats per genre. A play belongs to the genre of its track's artist.
- Revenue by category, including empty onesFinance wants revenue for every product category in the catalog. Revenue is quantity * unit_price from order_items, counting completed orders only.
- Accounts with a high average invoiceThe revenue team wants a shortlist of big-ticket accounts. Use every invoice in invoices, paid or not.
- Artist catalog size and 2025 releasesThe label relations team wants a status line for every artist: how big the catalog is, and how much of it is new this year.
- Average order value by channelThe growth team tracks average order value (AOV) for each sales channel. Only completed orders count.
- Average rating per city, weighted by tripsThe quality team publishes one rider rating per city. A rider may skip the rating, so rider_rating is NULL on many completed trips.
- Busy accounts in May and the fees they paidThe pricing team is reviewing fees on very active accounts. Look at transactions with posted_at on or after 2025-05-01 00:00:00 and before 2025-06-01 00:00:00.
- Categories behind each agent's unhappy surveysThe support manager is preparing one-to-one meetings. For each agent she wants to see which ticket categories ended in an unhappy customer.
- Completed trips by driver tenure bandThe driver success team wants to know whether newer drivers earn less per trip. Use completed trips only.
- Customers grouped by how many orders they placedThe CRM team wants to split 2025 shoppers into three groups by how often they bought.
- Customers whose every account is closedThe retention team wants a list of customers who have left the bank entirely.
- Fare per kilometre by city and vehicle typeThe pricing team compares how much a kilometre earns in each city for each kind of vehicle. Use completed trips only.
- Resolution speed buckets and satisfactionThe support lead wants to know whether slow resolutions make customers unhappy.
- Riders whose first and last trips are 71 days apartThe lifecycle team wants to study riders who stayed around. For every rider, look at their completed trips and the calendar date of requested_at.
- Share of June plays by deviceProduct wants to know which devices people use for real listening in June 2025.
- Most played genre for each plan and deviceThe playlist team wants to know the most common genre for each kind of listening session.
- Overdue invoices by account managerCollections wants an overdue list by account owner. Today is 2025-06-30 for this report.
- Plan stretches and billing for accounts that changed planCustomer success is reviewing accounts that moved between plans.
- Spend mix by customer segmentThe product team wants to see how each customer segment splits its everyday spending.
- Units sold and units returned by categoryQuality wants to compare how many units each category sold with how many came back.
- April spend and cost per click for search and socialThe paid team reviews campaigns on the search and social channels for April 2025 (from 2025-04-01 to 2025-04-30 inclusive, by ad_daily.day).
- Email-referred customers and their completed ordersThe lifecycle team wants to see how well the email channel converts. Look at every customer whose referral_source is 'email'.
- Headcount by department, empty and unassigned includedThe people team needs a headcount table that accounts for every department and every person. Count current employees only: those whose termination_date is NULL.
- Plays in the first two weeks for April joinersThe growth team measures early engagement. Take every listener whose joined_on is in April 2025 (2025-04-01 to 2025-04-30 inclusive).
- Recurring revenue by plan on a given dayFinance asks what the subscription book looked like on 15 March 2025.
- Refund value of wrong-item returns by categoryCustomer care is costing out "wrong item" returns. Look at rows in returns whose reason is 'wrong_item'.
- Sign-ups per campaign who placed a large orderMarketing wants to know which campaigns bring in big spenders.
- Trips from brand-new riders, by cityThe city managers want to know how much of each city's volume comes from new riders.
- Urgent email and phone tickets by team, with unassignedThe support lead reviews urgent tickets that came in by email or phone (priority = 'urgent' and channel is 'email' or 'phone') and how happy customers were.
- Completed trips for every city and vehicle typeOperations is building a grid for a dashboard: one row for every combination of a city and a vehicle type, so that empty cells are visible.
- Each December rider's most recent completed tripRider care is writing to everyone who signed up in December 2024 (riders.signed_up_on from 2024-12-01 to 2024-12-31 inclusive) and wants to mention their...
- Free and paid listeners per genreThe product team wants to know which genres reach people on the free plan and which reach paying people.
- Invoiced amount by the plan active on the issue dateInvoices do not store a plan. To attribute revenue to plans, link each invoice to the subscription its account had on the invoice's issued_on day.
- Kitchen revenue by customer country, four tablesThe merchandising team wants to know where the Kitchen range sells. A customer's country is customers.country.
- Listeners who played both jazz and folkEditorial wants to build a crossover playlist and asks how many listeners already enjoy both worlds, by country.
- Organic sign-ups during each campaign's runThe growth team wants a rough sense of the background sign-up rate while each campaign ran. A campaign was live from started_on to ended_on, both days included.
- Premium customers, accounts and money inRelationship managers review every customer in the 'premium' segment. A customer can have several accounts, and each account has many transactions.
- Spending by merchant partner group, NULL merchants includedPartnerships keeps a small lookup of merchants and the group each belongs to.
- Tickets per response band from a band lookup tableThe support team reports how fast it answers. The response time of a ticket is the time from created_at to first_response_at, in minutes (fractions allowed).
- Tracks and plays per jazz artist without double countingThe label relations team reviews every artist whose genre is 'jazz'. For each one they want the size of the catalog and how much it is played.
- Units ordered and units returned per orderOperations reviews every completed order placed in August 2024 (from 2024-08-01 00:00 up to, but not including, 2024-09-01 00:00) for returns.
- Daily spend against sign-ups for one campaignThe growth team is reconciling two sources for the "Family meals video" campaign (campaign_id = 3) in May 2025: the ad platform's daily spend (ad_daily)...
- Open accounts at each month end, by account typeFinance reports the number of open accounts on the last day of every month, split by account type.
- Purchases after assignment in the one-tap checkout testThe growth team reads out the one_tap_checkout experiment. Everyone assigned to it is in experiment_assignments with their variant and assigned_at time.
- Salary in effect at review time, by ratingThe people team asks whether higher ratings go with higher pay.
- Spend and sign-ups per campaign from two sourcesThe marketing report builds one row per campaign from two separate sources: total spend from ad_daily, and the number of sign-ups credited to the campaign...
- Five longest-serving employees, keeping ties at the cut-offThe people team is planning a service-award event for the longest-serving current employees (termination_date is NULL). Rank them by hire_date, earliest first.
- Pay ladder with RANK and DENSE_RANK side by sideThe people team is drawing a pay ladder for every department and cannot decide how to number tied salaries, so they want both numberings next to each other.
- Products at the three highest price pointsMerchandising is building a "premium shelf" from the products at the three highest distinct list_price values in the whole catalog.
- Three slowest first responses in each channelThe support lead is reviewing the slowest first replies.
- Top earner in each department, with a tie-breakerThe people team wants a one-line profile of the best paid current employee in every department.
- Average first purchase value by campaign, organic includedThe growth team wants to compare how much users spend on their first order, by where they came from.
- Best seller on each sales channel in the first quarterThe channel managers want to know what sold best on their channel in the first quarter of 2025.
- Driver rating leaderboard, unrated drivers lastThe operations team of the pilot city (the city with city_id 1) wants a leaderboard of its drivers: every driver whose home city (drivers.city_id) is 1.
- Each customer's largest single expense, with tie-breakersThe fraud team wants to see each customer's biggest purchase. An expense is a transaction with a negative amount whose category is dining, groceries or travel.
- Employees in the top quarter of pay, by PERCENT_RANKCompensation wants to review the best paid people in each department. Use current employees only (termination_date is NULL) who belong to a department.
- First order value by acquisition channelMarketing wants to know which channel brings in the biggest first orders. A customer's first order is their earliest order with status completed.
- Genre of each listener's first playThe growth team wants to know which genre hooks new listeners.
- Listener quartiles by May listening timeThe product team wants to compare heavy and light listeners.
- Months each merchant ranked in the top three for spendThe cards team tracks which merchants dominate everyday spending. A transaction counts as everyday spending when its category is dining, groceries or travel.
- Second highest salary in each departmentThe people team is checking pay bands and wants the second highest salary in every department, looking only at current employees (termination_date is...
- The third longest completed trip in each cityOperations is reviewing long-distance trips and wants the third longest completed trip in every city, as a row position: sort the city's completed trips...
- Top three drivers in each city, ties at third place keptThe driver community team gives a monthly shout-out to the busiest drivers in each city.
- Top three products in each category, with tiesMerchandising wants the best sellers in each category. Rank products within their category by units sold on completed orders, most units first.
- Top two agents per team by satisfaction, with tie-breakersThe support lead wants to recognise the two happiest-making agents in each team. Use the surveys in satisfaction joined to their ticket's agent_id.
- Top two artists each month by listening timeThe editorial team picks two featured artists per month for the home screen.
- Two cheapest campaigns per month by cost per clickThe marketing team wants to see which campaigns bought clicks most cheaply each month.
- Favourite spending category per customer, counted by segmentThe marketing team wants to know which spending habit dominates each customer segment.
- How far each artist climbed or fell from April to MayThe charts team publishes a monthly artist ranking and wants to show movement.
- Repeat contact within 14 days of a first ticketThe support lead suspects some first-time issues are not really solved, because the customer comes back.
- Cumulative revenue by day, including quiet daysThe finance team plots cumulative purchase revenue for June 2025. The chart needs one point for every calendar day, even a day with no purchases.
- Invoices where the amount changedFinance wants to review every price change. Find each invoice whose amount is different from the same account's previous invoice.
- Percentage change from the previous salaryThe people team is reviewing pay changes since the start of 2024.
- Plays that were immediately replayedThe recommendations team wants to find tracks that listeners loved enough to play again straight away.
- Running balance for one bank accountA customer disputes their January statement for account 20. Rebuild it with a running balance. List every transaction on account 20 posted before 2025-02-01.
- Running earnings for two driversThe driver-support team is looking at how earnings build up for two long-serving drivers, driver 5 and driver 13.
- Dining spend that restarts each monthA budgeting feature shows how much a customer has spent on dining so far this month, and the figure starts again at the beginning of each month.
- Each day's rate next to the month-end rateAn analytics engineer is building a table that shows each exchange rate next to the closing rate of its month.
- Hours since the customer's previous ticketThe support lead wants to know how quickly customers come back.
- June purchases compared with the first purchaseThe lifecycle team wants to see how a customer's big June orders compare with the very first order they ever placed.
- Record click days with a running maximumThe paid-media team celebrates each campaign's best day so far. For every campaign, track its high-water mark of daily clicks during June 2025.
- Running count of distinct buyers by first purchase monthThe growth team charts how many different people have ever bought in the app. A user is a buyer once they have at least one purchase event.
- The invoice that takes an account past 5,000 billedSales ops wants to know when each account became a "5,000 customer": the first invoice that brings its lifetime billing to 5,000 or more.
- Time until a rider requests again after cancellingThe rides team wants to know whether riders who cancel try again soon.
- Events in the 10 minutes before each purchaseProduct wants to know how busy a user was just before buying.
- Products that make up 80 percent of revenueMerchandising wants a Pareto list: the smallest set of best-selling products that together reach at least 80% of completed-order revenue.
- Rolling seven-day spend when days are missingA pacing report shows, for campaign 1, how much it spent over the last 7 calendar days. A campaign that did not serve ads on a day has no row for that day.
- Seven-day moving average of sign-upsThe growth team charts daily sign-ups with a 7-day moving average. Build the June 2025 numbers.
- Agent share of their team's ticketsThe support lead wants to see how evenly work is spread inside each team.
- Employees paid above their department averageThe people team is reviewing pay inside each department.
- Months billed above the monthly averageFinance wants to flag the strong billing months.
- Average transactions per open accountThe product team wants to know how busy each kind of account is. Look only at open accounts (closed_on is NULL).
- Customers whose first order used a couponMarketing wants to know which coupons win new customers. A customer is "won by a coupon" when their very first order carried a coupon.
- Everyone who reports to a manager, at any depthWen Becker (employee_id 2) is leaving on sabbatical and the people team needs everyone in their organisation to hear about the cover plan.
- Listeners whose first play was on a speakerThe devices team thinks smart speakers bring in a different kind of listener.
- Orders above the customer's own average orderThe retention team wants to spot big-ticket moments for each customer: orders that are larger than that customer's usual order.
- Reporting chain from an employee up to the CEOAn approval request from employee 33 needs to be routed up the reporting line.
- Riders who came back after a driver cancelledThe trust team wants to thank riders who stayed loyal after a driver let them down.
- Ticket categories with an above-average urgent shareThe support lead wants to know which ticket categories are more urgent than the desk as a whole.
- Buyers whose latest purchase beat their earlier averageThe growth team wants to find shoppers who are spending more over time. Use events rows with event_name = 'purchase' and a non-NULL revenue.
- Campaigns cheaper per sign-up than their channelMarketing wants to know which campaigns beat the rest of their channel on cost per sign-up.
- Headcount by level below the CEOThe people team wants to know how deep the reporting line goes. The CEO is the one employee with no manager_id.
- Cancellation rate by cityCity managers want to know how often a ride request ends in a cancellation.
- Cost per click, with zero-click campaignsFinance wants the cost per click (CPC) of every campaign: all the money it spent divided by all the clicks it got, in US dollars.
- Share of revenue by categoryThe merchandising team wants to see how completed sales split across product categories.
- Share of users who purchased, by platformThe product team wants to know what share of users have ever bought something in the app.
- Click-through rate by campaignThe marketing team reports the click-through rate (CTR) of each campaign: all the clicks it received divided by all the impressions it served, over every...
- Driver cancellations among accepted ridesDriver operations wants to know how often a driver backs out after accepting a request.
- On-time payment rate by industryFinance wants to know which industries pay on time. An invoice was paid on time when paid_on is on or before due_on.
- Refund rate by count and by valueFinance tracks refunds in two ways: how many orders were refunded, and how much money they were worth.
- Sign-up to purchase conversion by campaignThe growth team judges each campaign by how many of its sign-ups ever bought something.
- Skip rate by genreThe content team wants to know which genres get skipped. A play is a skip when seconds_played is less than 30. A play of exactly 30 seconds is not a skip.
- Survey response rate and CSAT by teamThe support lead tracks two numbers for every team, and they have different denominators.
- Return rate by product categoryOperations wants to know which categories come back the most. For each category, the return rate is the units returned divided by the units sold.
- Revenue per account, including non-payersLeadership wants the average collected revenue per account for each industry.
- Share of sessions with a search, by platformProduct wants to know how often a visit to the app includes a search. A session is one distinct session_id, and every session belongs to a single user.
- Spending share by category within each segmentThe bank wants to see how each customer segment spends its money.
- Average fare for short and long tripsPricing wants to compare what short and long trips earn in each city. Only completed trips count (status = 'completed'). A short trip has distance_km under 5.
- Full-play rate by genreEditorial wants to know which genres hold a listener to the end of the track.
- Order status counts per channelThe operations lead wants one row per sales channel showing how its orders ended up.
- Plays per device for each planThe product team wants to know which devices each subscription plan listens on. A counted play is a row in plays with seconds_played of at least 30.
- Products per price band, empty bands includedMerchandising groups the catalog into four price bands by list_price in products.
- Rider cancellations per completed trip, by cityCity managers want to know how many riders cancel for every trip that actually happens.
- Active subscriptions by seat band and planSales ops wants a grid of live subscriptions on 30 June 2025: seat bands down the side, plans across the top.
- Customers who buy in the app but never on the webThe growth team wants a list of customers who shopped only in the app during the second quarter of 2025, so they can test a web-checkout nudge on them.
- Listener device habits by planThe product team wants to know, for each plan, how many listeners are active and how widely they use their devices. Count listeners, not plays.
- Money in and money out per savings accountRisk wants a February 2025 cash-flow summary for every savings account. In transactions, a positive amount is money in and a negative amount is money out.
- On-time, late and unpaid invoices by monthCollections wants to see how each month's invoices were settled.
- Repeat cart adders who never boughtLifecycle marketing wants to message users who keep putting items in their cart but never check out.
- Requests and completion rate by time of dayThe marketplace team splits the day into four parts using the hour of requested_at (UTC).
- First-response SLA by agentThe support lead scores agents on first-response speed.
- Seven-day buyer rate by campaignMarketing judges each campaign by how many of its sign-ups buy within a week.
- Active users in the 30 days before a dateThe product team reports thirty-day active users per platform, measured as of 2025-06-01.
- Average pickup wait and trip length in minutesOperations tracks how long riders wait and how long trips take.
- Customers by tier on a past dateA report needs the customer mix as it stood at 2025-05-01 00:00:00. dim_customers_history keeps one row per version of a customer.
- Listens by hour of dayThe music team plans playlist drops around when people listen. Look at May 2025 (from 2025-05-01 00:00:00 up to, not including, 2025-06-01 00:00:00).
- May trip requests by city, last day includedCity managers want the May 2025 request count for every city. Count the trips requested from 2025-05-01 00:00:00 through the end of 2025-05-31.
- Monthly cost per click by channelThe marketing team compares how much a click costs on each channel, month by month, for January to June 2025.
- Weekly ticket volume, weeks starting MondayThe support lead reports ticket volume per week for March 2025. Count the tickets created from 2025-03-01 00:00:00 up to and including the whole of 2025-03-31.
- First response within one hour, by channelThe support desk promises a first reply within one hour.
- Listener tenure in whole months by planThe retention team wants the average tenure of listeners on each plan, as of 2025-06-30. Tenure is the number of whole months between joined_on and 2025-06-30.
- Overdue invoices as of a fixed dateCollections reviews the books as they stood at the end of 2025-05-31.
- Subscriptions active on a given dateFinance asks for a snapshot of paying seats on 2025-03-15. A subscription is active on a date when it started on or before that date and has not ended by then.
- Weekend vs weekday revenue per calendar dayThe shopping app team wants to know whether weekends earn more than weekdays in May 2025.
- Live campaign days with no deliveryAd ops suspects some campaigns stopped serving on days they were supposed to be live.
- Month-end balance by account typeFinance reports the combined balance of each account type at the end of every month, from January to June 2025.
- Seats on the last day of each monthFinance reports month-end paying seats.
- Customer contact labels with missing emailsThe email tool wants one display label per customer.
- Customers by referral source, with unknown shownMarketing wants a headcount of customers by where they came from.
- Invoices issued, paid and unpaid by industryCollections wants a quick count per industry. An invoice is paid when paid_on is not NULL and unpaid when it is NULL.
- Orders that did not use a couponThe marketing team wants to see how many orders were placed without the WELCOME10 coupon.
- Total fare by city, including cities with no completed tripsThe finance team needs the money taken in each city. fare is NULL on any request that was not completed.
- Average fare per request and per completed tripThe city managers compare two averages. fare is only filled in for completed trips, and is NULL for cancelled requests and requests no driver took.
- Average satisfaction score by channelThe support lead wants the average satisfaction score by channel.
- Number campaigns by end date, running ones lastThe campaign dashboard lists campaigns by how recently they ended. Number the campaigns 1, 2, 3, ...
- Tickets by first response time bandThe support lead wants to see how long customers wait for a first reply.
- Tickets per agent, including unassigned onesThe support lead wants the workload on one list: how many tickets each agent has, how many are waiting with no agent at all, and which agents have nothing.
- Riders who got a different driver than last timeMarketplace ops wants to know how often a rider's outcome changes from one request to the next.
- Quarter-over-quarter invoiced revenueThe CFO reviews invoicing one quarter at a time. Calendar quarters start on 1 January, 1 April, 1 July and 1 October.
- Biggest month-over-month spending drop per categoryThe cards team wants to know in which month customers cut back the most in each everyday spending category.
- Channel share of ad spend, Q1 against Q2Marketing wants to see how the mix of ad spend moved between the first two quarters of 2025.
- Month-over-month change in invoicingFinance tracks the month-over-month change in invoiced amount.
- Monthly buyers and growth, with gap monthsThe growth team charts how many different users buy each month and how that changes.
- Week-over-week high-priority ticketsThe support lead watches how many serious tickets arrive each week. A serious ticket has priority of high or urgent.
- Year-over-year completed orders by monthFinance compares each month of 2025 with the same month of 2024. Count orders with status completed, assigned to the calendar month of ordered_at.
- Artist rank change from May to JuneEditorial publishes a "movers" list of artists whose chart position changed between May and June 2025.
- New and churned seats by monthFinance splits each month's movement in customers into new and churned. Take a snapshot of every account on the first day of each month.
- Year-to-date units against the same period last yearMerchandising tracks year-to-date unit sales and asks whether 2025 is ahead of 2024 at the same point in the year.
- Colleagues hired in the same month and departmentThe people team wants to pair up colleagues who started together, for an onboarding buddy programme.
- Repeat tickets from the same customer within a weekThe support lead suspects some customers write in again because their first ticket was not solved. Find tickets that look like repeats.
- Skip-level managers and how many people they coverThe people team plans skip-level one-on-ones. A skip-level manager is a person's manager's manager.
- Employees paid more than their managerThe people team is reviewing pay. Find employees who earn more than their manager. Consider only people still employed (termination_date is NULL).
- Products bought together in the same orderMerchandising wants to place related products next to each other. Find pairs of products that customers often put in the same basket.
- Trips between a rider and a driver they already knowThe marketplace team studies "regular pairings": the same rider riding again and again with the same driver. Look only at completed trips.
- Users whose carts turn into purchases within 30 minutesThe checkout team wants to find users who buy quickly after adding something to their cart.
- How many drivers in the same city rate higherDriver operations wants each driver's standing in their home city: how many other drivers there have a better average rating.
- Raises of 9.5 percent or more over the previous salaryCompensation is auditing large raises. salary_changes has one row for each salary an employee has had, starting on effective_on.
- Agents who got no urgent ticket in AprilThe support manager wants to know which agents were not given any urgent work in April 2025.
- Campaigns that never brought in a paying userA campaign brings in a user when the user's sign-up is credited to it (signups.campaign_id). Sign-ups with no campaign are organic.
- Customers with no completed order in MarchMarketing wants to send a "we miss you" email to customers who did not buy in March 2025.
- Products that sold but were never returnedMerchandising wants a list of "safe" products: ones that customers buy and keep.
- Accounts billed since May with no paid invoiceThe collections team wants the accounts that were billed recently and have paid nothing of it.
- Customers with savings but no open checking accountThe bank wants to offer a checking account to customers who save with them but do not have one to spend from. An account is open when closed_on is NULL.
- Listeners who played no jazz in JuneThe playlist team is building a jazz win-back campaign. It targets listeners who did not play any jazz in June 2025.
- Sign-ups who never bought, by sign-up monthGrowth wants to know how many sign-ups never turned into a customer, month by month.
- New riders with no completed trip in their first 14 daysThe rider growth team wants to nudge new riders who did not manage a ride in their first two weeks, and to see whether they at least tried.
- Customers with several accounts under one emailCustomer support wants to merge accounts that belong to the same person.
- Find exact duplicate rows in a raw order loadThe pipeline sometimes loads the same copy of an order twice.
- How many rows would deduplication remove?Before building the order model, the team plans to keep exactly one row for each order_id and updated_at pair in stg_orders and delete the rest.
- Emails shared by accounts that disagree on countryBefore merging duplicate customer accounts, the data team wants to find the ones that cannot be merged automatically: the same email is used by several...
- Events fired twice within ten secondsThe app sometimes sends the same event twice when a button is tapped quickly. The analytics team wants to know how many events to drop.
- Keep the first purchase event for each web userGrowth wants one row per user for their first purchase, to build a "first order" table. Use only users whose platform is web.
- Orders by current status from a raw loadstg_orders holds every copy of every order our pipeline has loaded.
- Repeat tickets from the same customerSupport managers count one problem once.
- Salary in effect on a date for each employeeFinance is rebuilding the mid-year headcount cost report.
- Current order copy when two copies share a timestampOperations wants the list of orders that are shipped but not yet delivered, taken from the raw load in stg_orders.
- Revenue to date per customer by sign-up quarterFinance wants a first look at customer lifetime value: how much each sign-up cohort has spent so far, per customer.
- Rolling retention after day 30 by first-order quarterThe store wants to know how many new customers order again after their first month.
- Week-two retention by acquisition channelMarketing wants to compare how well each acquisition channel keeps its users in their second week.
- Day 1 and day 7 retention by sign-up monthProduct reports classic "day 1" and "day 7" retention for each sign-up month.
- Listeners who came back after a gapThe retention team wants to find listeners who drift away and then return.
- Retention table for months 0 to 3The growth team wants the raw numbers behind a retention triangle, in long format: one row per sign-up cohort and month number.
- Weekly sign-up cohorts and next-week buyersThe marketing team tracks whether new sign-ups come back to buy. Group users into weekly cohorts and measure repeat buying in the following week.
- Month-one retention by sign-up cohortProduct wants month-one retention for each sign-up cohort. A user's cohort is the calendar month they signed up (users.signed_up_at).
- Month-over-month net revenue retentionFinance tracks net revenue retention (NRR): how much of last month's revenue is still there this month, counting upgrades, downgrades and cancellations...
- Monthly subscription churn rateThe finance team reports monthly logo churn: of the accounts that were paying at the start of a month, how many had stopped by the start of the next one?
- Customer activation funnel by segmentThe bank tracks how many new customers become active.
- Ad funnel from impressions to buyers by channelMarketing wants one funnel per channel for the whole period: impressions, clicks, sign-ups and buyers.
- Biggest drop-off step in the ride funnelOperations wants to know where each city loses the most ride requests.
- Conversion between each funnel stepThe shopping app has a four step funnel, in this order.
- Median hours from sign-up to first purchaseGrowth wants to know how long new users take to buy for the first time, by platform.
- Ordered purchase funnel by platformBuild a purchase funnel for each platform where every step has to happen after the step before it.
- Purchase funnel by experiment variantThe team tested a new onboarding flow (new_onboarding in experiment_assignments).
- Purchase funnel inside a single sessionThe product team wants a session-level funnel: how many browsing sessions turn into a purchase without the user leaving the session.
- Longest run of delivery days per campaignCampaign managers want to know the longest uninterrupted stretch each campaign served ads.
- Missing inventory snapshot ranges per SKUThe warehouse takes one inventory snapshot per product per day, but some days were skipped.
- Streaks of four or more days of opening the appThe engagement team wants to find habit-forming users. A user has an app-open day when they fire at least one app_open event on that UTC calendar day.
- Listening sessions split by a 30-minute gapThe product team defines a listening session from play timestamps alone.
- Longest run of consecutive driver cancellationsThe marketplace team wants to find drivers who cancel repeatedly in a row.
- Merge subscription rows into continuous customer stretchessubscriptions has one row per plan period, and a plan change creates a new row.
- Median listen length, continuous and discreteThe audio team reports a median listen length per device and wants to see how much the choice of percentile function matters.
- Median salary by departmentThe people team reports pay with the median, because a few very high salaries pull the average up.
- 90th percentile trip length by cityOperations plans driver shifts around the long trips, not the typical ones, so they track the 90th percentile of trip length.
- Purchase value spread (interquartile range) by platformThe pricing team wants to see how spread out order values are on each platform, without letting a few giant orders distort the picture.
- Median dining spend by month, without percentile functionsA reporting tool in your company only supports plain SQL: no percentile_cont, no percentile_disc.
- Customers by email domainThe email team wants to know which mailbox providers their customers use, but the email column was typed in by hand and is not always tidy.
- Names shared by several drivers and ridersThe support team searches by name, and shared names cause mix-ups between drivers and riders. Treat every row in drivers and every row in riders as one account.
- Browse-only sessions by platformThe product team wants to know on which platforms people browse without adding anything to the cart.
- Customers who bought from two categoriesMarketing plans a cross-sell email for customers who have already shown interest in both cooking and reading.
- A small data quality test suite as one queryThe data team runs these four checks on the HR tables every night.
- Current gold customers by region from type 2 historyThe loyalty team wants today's gold customers by region. dim_customers_history has one row per version of a customer.
- Data test for direct buyers with no usable emailThe shop's receipts are sent by email, so every customer who orders through the web or app channel must have an email.
- Grain check for a user by day purchase modelAn analytics model fct_user_day is meant to have one row per user per calendar day (UTC), built from purchases.
- Order copies that arrived more than 12 hours lateData quality wants to know which rows reach the warehouse late.
- Active accounts and seats per day from subscription datesThe finance dashboard shows, for each day, how many accounts had an active subscription and how many seats they paid for.
- Agent by month fact table of tickets created and resolvedSupport leaders want a monthly scorecard at the grain one row per agent per calendar month, for February to June 2025.
- Customer tier at a point in time from type 2 historyA campaign was sent at 2025-03-15 12:00:00 (UTC) and marketing wants to know which tier each customer was in at that moment, not today.
- Latest copy of each order loaded after a watermarkAn incremental model processes only new rows from stg_orders. The last run finished with the watermark 2025-06-15 00:00:00.
- Monthly recurring revenue by plan with empty monthsFinance reports monthly recurring revenue (MRR) as a snapshot on the first day of each month.
- One row per savings account per month, with zero fillBuild a monthly fact table for savings accounts at the grain one row per account per calendar month, for January to June 2025.
- Reconcile active subscriptions against February invoicesBilling wants to check that every account that should have been invoiced in February 2025 was, and that nobody was invoiced without a subscription.
- Salary validity ranges built with LEADThe HR warehouse needs a type 2 style table from the salary_changes log, so analysts can join pay to any date. Build it for employees of the Finance department.
- Turn stock snapshots into restock eventsThe warehouse stores a snapshot of stock per product at the end of each day. Operations wants an event table of restocks instead.
- Campaign by day fact table with cumulative spendMarketing wants a daily table at the grain one row per campaign per day it was live, for 2025-03-10 to 2025-03-16 inclusive.
- Daily end-of-day balance from transactions with a date spineThe bank wants a daily balance table for the savings accounts of its premium customers.
- Daily stock levels with a date spine and carry forwardThe planning dashboard needs a stock figure for every product on every day, even though some end-of-day snapshots are missing.
- Delivered revenue in USD with as-of exchange ratesFinance reports delivered revenue in US dollars by the month orders were placed. Build it from the raw order load.
- Merge unchanged versions in a type 2 historydim_customers_history has one row per version of a customer, but some versions changed only a column we do not track.
- Orders by the customer's tier when the order was placedMarketing wants to know how orders split by the tier the customer had when they ordered, not the tier they have today.