Orders in a price range

filtering

Orders in a price range

Stripe SQL Interview Question

Stripe's risk team reviews mid-sized payments for one online store, which it defines as orders worth from 100 to 500.

List the order_id and amount of every mid-sized order. Orders worth exactly 100 or exactly 500 count as mid-sized.

Asked of

  • Data Analyst
  • Business Analyst
  • BI Analyst
  • Product Analyst
  • Analytics Engineer
  • Data Engineer
  • Data Scientist
  • ML Engineer
  • AI Engineer

ordersTable35 rows

Column NameType
order_idBIGINT
customer_idBIGINT
order_dateDATE
statusVARCHAR
amountDOUBLE

ordersExample Input

order_idcustomer_idorder_datestatusamount
100112024-01-05completed120.5
100222024-01-07completed2400
100312024-01-11completed89.99
100432024-01-15canceled45
100542024-01-18completed610.75
100622024-01-22completed1850.25
100752024-01-29completed3200
100812024-02-02refunded75
100962024-02-06completed55.4
101032024-02-09completed132.6

Example Output

order_idamount
1001120.5
1010132.6

Explanation

Order 1001, worth 120.50, and order 1010, worth 132.60, are in the range. Order 1003, at 89.99, is too small, and order 1005, at 610.75, is too large.

The example above is a small slice of the data. Your query runs against the full tables.