logo

Oracle NextGen

score

SQL Challenge

Challenge #13 – Customer Retention Rate

Challenge Overview
Calculate the month-over-month retention rate: the percentage of customers who made purchases in both the current and previous month.

Requirements

  • Return columns: month, retention_rate.
  • Compare each month with the previous month.
  • Calculate percentage of returning customers.
  • Round retention_rate to 2 decimal places.
  • Order by month chronologically.
Sample Dataset
Preview the schema and seeded rows you can query against.

purchases

Customer purchase history.

Columns
NameTypeNotes
purchase_idINTPrimary key
customer_idINTCustomer ID
purchase_dateDATEPurchase date
Sample Rows
purchase_idcustomer_idpurchase_date
112024-01-15
222024-01-20
312024-02-10
432024-02-15
512024-03-05
622024-03-10
732024-03-20
SQL Playground
Loading editor…

Result Preview

Awaiting Run

Run your query to see the dataset preview.