Functional index for case-insensitive search

Hard
2 views 23 Jan 2026
Create an index to speed up WHERE LOWER(name)=LOWER(?) on Customers....

Index a frequently filtered column

Easy
3 views 23 Jan 2026
Orders table is filtered by status a lot. Create an index on status....

Composite index for search

Easy
2 views 23 Jan 2026
Customers are searched by (city, name). Create a composite index....

Unique index example

Easy
2 views 23 Jan 2026
Prevent duplicate SKU in Products using a unique index....

Drop an index

Easy
2 views 23 Jan 2026
Drop index idx_orders_status....

Index for date range queries

Easy
3 views 23 Jan 2026
Create an index for faster queries on Orders(order_date)....

Choose the right index for a query

Medium
2 views 23 Jan 2026
Query: SELECT * FROM Orders WHERE customer_id=? AND order_date BETWEEN ? AND ?. Suggest an index and write it....

Covering index idea

Medium
2 views 23 Jan 2026
Query needs only (order_date, total_amount) for reports. Create an index that helps covering these columns....

Index for joins

Medium
2 views 23 Jan 2026
Orders joins OrderItems on order_id. Write index statements to support this join....

When not to index

Medium
2 views 23 Jan 2026
You have a column gender with only 2 values. Should you index it? Provide a practical answer in description, and give no index statement....

Partial index workaround using helper column

Medium
2 views 23 Jan 2026
You want index only on active rows (status='ACTIVE'). Create a helper column active_flag and index it with customer_id....

Find unused indexes (query)

Hard
4 views 23 Jan 2026
Write a query idea to list indexes that are not used often. Keep it simple and generic....

Design index for prefix search

Hard
2 views 23 Jan 2026
Customers are searched by name starting with 'ra'. Write an index and a matching query....

Avoid duplicate indexes

Hard
3 views 23 Jan 2026
You already have index on (city, name). Someone wants another on city only. How do you decide? Put reasoning in description and leave sample_solution as a metadata check query....

Rebuild index after heavy deletes

Hard
5 views 23 Jan 2026
After deleting millions of rows, you want to rebuild an index. Provide a generic rebuild statement....