Problem Statement
What is a covering index?
Explanation
If the index contains the filter, join, and select columns, the engine can answer the query from the index alone. That avoids extra lookups and reduces I/O.
In some engines you add non-key INCLUDE columns to achieve coverage without bloating the key.
Code Solution
SolutionRead Only
CREATE INDEX idx_orders_customer_date ON orders(customer_id, order_date) INCLUDE (total_amount);
Practice Sets
This question appears in the following practice sets:
