diff --git a/schema.sql b/schema.sql index fb0a83c..f5bc611 100644 --- a/schema.sql +++ b/schema.sql @@ -1013,4 +1013,9 @@ insert into Orders (CustomerID, OrderDate, ProductID, Quantity) values (1000, '2 -- Write query to create the index that you will create to optimize a query like -- SELECT * FROM Orders WHERE CustomerID = {abc} AND OrderDate > '{abc}'; +-- we can't be able to search faster by using this reason behind it will sort the data based on customerId and their is no tie betweem customerId, orderDate we couldn't able to make use of orderDate. +--CREATE INDEX idx_CustomerID_OrderDate ON Orders (CustomerID, OrderDate); +-- Better approach we can apply index on customerId it would be much faster in that case. +CREATE INDEX idx_CustomerID_OrderDate ON Orders (CustomerID); +