Skip to content

Customers who buy in the app but never on the web

MediumFreeConditional aggregationGroup and aggregate12 min2 hidden datasets

The task

The 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.

Only completed orders placed from 2025-04-01 up to but not including 2025-07-01 count in this question. Return every customer who has at least one such order with channel = 'app' and none with channel = 'web'. Orders on other channels, orders outside the quarter and orders that were cancelled or refunded do not change whether a customer qualifies.

Return:

  • customer_id
  • full_name
  • app_orders: how many qualifying app orders the customer has

Sort by app_orders descending, then customer_id ascending.

Expected output

customer_idfull_nameapp_orders
  • Sorted by app_orders descending, then customer_id ascending.
  • Checked on the sample and on 2 hidden datasets. How grading works

Tables Online store · click a name to insert it

customers150 rows in the sample

One row per customer account. Key: customer_id.

intUnique id.
textName on the account.
textNULL when the customer never gave one (marketplace buyers).
textTwo-letter country code.
dateDay the account was created.
textorganic, paid_search, social, referral or email. NULL when unknown.
products36 rows in the sample

The catalog. Key: product_id.

intUnique id.
textDisplay name.
textKitchen, Home, Outdoors, Books, Beauty or Toys.
numeric(10,2)Current list price in USD.
dateFirst day on sale.
orders700 rows in the sample

One row per order. Key: order_id.

intUnique id.
intWho placed it.
timestampWhen it was placed (UTC).
textcompleted, cancelled or refunded.
textweb, app or marketplace.
numeric(10,2)Shipping charged, USD.
textCoupon used, NULL if none.
order_items1,266 rows in the sample

One row per product in an order. Key: order_id, product_id.

intThe order.
intThe product.
intUnits bought.
numeric(10,2)Price paid per unit, after discounts, USD.
returns79 rows in the sample

Items sent back. Key: return_id.

intUnique id.
intThe original order.
intThe product returned.
dateDay the return arrived.
intUnits returned.
textdamaged, wrong_item, not_as_described or changed_mind. NULL when not given.

Related questions

Loading the editor and PostgreSQL