About the “Customer Lifetime Value Decile Segmentation” SQL Problem
Business Scenario
E-commerce CRM marketing divides customers into 4 spend tiers (quartiles) to direct high-touch concierge support to the top 25% of spenders.
Expected Output & Criteria
Customer lifetime spend with quartile segmentation.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMThis challenge executes directly against the following relational schema in your browser:
CREATE TABLE ecom_orders (
order_id INT PRIMARY KEY,
customer_id INT NOT NULL,
order_amount NUMERIC(10, 2) NOT NULL
);Target SQL Clauses & Operators
WITHNTILEGROUP BY
Want more CTEs practice?
Explore the full syllabus of 12 exercises, syntax guides, and interview pitfalls.