About the “Customer 30-Day Repeat Repurchase Rate” SQL Problem
Business Scenario
DTC e-commerce brands evaluate product stickiness by calculating what percentage of first-time buyers return to make a second purchase within 30 days of their initial order.
Expected Output & Criteria
Summary with total_customers, repeat_customers, and repeat_rate_pct within 30 days.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMThis challenge executes directly against the following relational schema in your browser:
CREATE TABLE orders_log (
order_id INT PRIMARY KEY,
customer_id INT NOT NULL,
order_date DATE NOT NULL,
order_total NUMERIC(10, 2) NOT NULL
);Target SQL Clauses & Operators
WITHCOUNTROUND
Want more CTEs practice?
Explore the full syllabus of 12 exercises, syntax guides, and interview pitfalls.