SQL Practice Logo

SQLPractice Online

Level 3 - IntermediateOptimization Questions

Optimization: Date Predicate and Projection

Choose the better query for performance and maintainability, then provide the final SQL. Query A: SELECT * FROM orders WHERE DATE(created_at) = '2026-04-01' AND customer_id = 120; Query B: SELECT id, customer_id, created_at, total_amount FROM orders WHERE created_at >= '2026-04-01' AND created_at < '2026-04-02' AND customer_id = 120;