About the “Sequential Customer Order Indexing & First-Time Flag” SQL Problem
Business Scenario
Growth analytics pipelines index customer transaction streams chronologically to flag whether an order represents a new customer acquisition (Order #1) or repeat retention.
Expected Output & Criteria
Customer orders indexed chronologically with first-time acquisition flag.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMCREATE TABLE customer_purchases (
order_id VARCHAR(16) PRIMARY KEY,
customer_id INT NOT NULL,
order_time TIMESTAMP NOT NULL,
amount NUMERIC(10, 2) NOT NULL
);Target SQL Clauses & Operators
Want more Window Functions practice?
Explore the full syllabus of 18 exercises and syntax guides.