Skip to content
SQLSimplified
Data AnalystQuestion 6 of 57

Identifying Customer Churn

Problem

The marketing team wants to target lapsed customers. Find all customer_ids in the customers table who have not placed an order in the last 6 months (assume current date is '2022-01-01').

Database Schema

Table: customers

  • customer_id (INT): Unique identifier for the customer.
  • first_name (VARCHAR): First name.
  • last_name (VARCHAR): Last name.

Table: products

  • product_id (INT): Unique identifier for the product.
  • name (VARCHAR): Product name.
  • price (DECIMAL): Product price.
  • category (VARCHAR): Product category.

Table: orders

  • order_id (INT): Unique identifier for the order.
  • customer_id (INT): Foreign key referencing the customer.
  • order_date (DATE): Date of the order.
  • amount (DECIMAL): Total order amount.

Try It

Loading playground environment...

Hint

Solution