Create an Index for a Query
Medium
DDL & Constraints
A query filters Orders by customer_id and a date range on order_date. Create the most suitable composite index and explain the column order.
Table schema
Orders(id INT PRIMARY KEY, customer_id INT, order_date DATE, amount INT)Sample data
Query: SELECT * FROM Orders WHERE customer_id = 5 AND order_date >= '2026-01-01'
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.