SQL Practice Logo

SQLPractice Online

Level 6 - ExpertDebugging Questionsm1 data modeling

Repair Overlapping Temporal Ranges

Fix the validation query. It should detect overlapping validity windows per customer but currently misses edge overlaps: SELECT a.customer_id FROM customer_plan_history a JOIN customer_plan_history b ON a.customer_id = b.customer_id AND a.id <> b.id WHERE a.effective_from BETWEEN b.effective_from AND b.effective_to;