Find At-Risk Customers

Business problem: the marketing team wants to target a loyalty offer at customers based in London or Manchester who currently have fewer than 200 loyalty points.

What data is needed: each customer's city and loyalty_points. How tables relate: this needs only the customers table. Write a query returning each qualifying customer's name, city and loyalty_points, sorted by loyalty_points ascending (lowest first). Verify: check your result against the customers table by eye before trusting it.

query.sql
Loading editor…

Test cases

  • Full result: matches every qualifying customer, in order
  • Returns exactly one qualifying customer

Use Run to explore freely against the sample database. Use Submit to grade your query against every test case, including any hidden ones.