About the “Average Days Elapsed Between First and Second Order” SQL Problem
Business Scenario
E-commerce retention marketers measure the velocity of repeat buyer conversion by calculating the exact calendar days between customer Order #1 and Order #2.
Expected Output & Criteria
Customer latency in days between first and second e-commerce purchases.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMCREATE TABLE customer_orders (
order_id INT PRIMARY KEY,
customer_id INT NOT NULL,
order_date DATE NOT NULL
);Target SQL Clauses & Operators
Want more CTEs practice?
Explore the full syllabus of 16 exercises and syntax guides.