DataLane

SQL problem track

SQL Foundations

The eight-minute questions that open a screen: filtered aggregation, product joins, and the org-tree self-join.

5 problems · ~44 min total · Data Analyst · BI Analyst · Analytics Engineer · Data Engineer · Data Scientist

Track progress 0/5

0% complete

Start with problem 1
  1. Step 1 · ~10 min · Stripe, Shopify, Square

    Completed revenue by country

    Finance wants revenue by country, but only for orders that actually completed. Cancelled orders must not contribute a cent. Return one row per country with revenue rounded to 2 decimals, biggest country first.

    Aggregation
    mediumProNot started
  2. Step 2 · ~10 min · Amazon, Walmart, Instacart

    Top products by units sold

    Merchandising wants units sold per product. The quantity lives on the line items, not the order header — summing orders.amount here is the classic wrong answer because an order can carry several products.

    JoinsAggregation
    mediumProNot started
  3. Step 3 · ~6 min · Google, Meta, Microsoft

    Who reports to Ben

    The employees table is an org tree: manager_id points back at employee_id in the same table. Return Ben’s direct reports — one level down, not the whole subtree.

    Joins
    mediumProNot started
  4. Step 4 · ~8 min · Instacart, DoorDash, Shopify

    Orders with more than one line

    Multi-line orders are the ones that break naive revenue joins, so find them first. Return every order carrying more than one line item, with its line count and total quantity.

    Aggregation
    easyNot started
  5. Step 5 · ~10 min · Meta, Snap, Pinterest

    Event funnel by stage

    Product wants funnel volume per stage: how many events fired and how many distinct customers reached each one. Total events overstates reach because one customer can fire the same event repeatedly.

    Aggregation
    mediumProNot started

Other tracks

↑↓ navigate openesc close