Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Create an Index for a Query

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.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.