100 Days of SQL

sql

Day 86 – Indexes

These are database objects that are used to improve the performance of queries by providing faster access to data. Indexes can be created on one or more columns of a table, and can be used to speed up searches, sorts, and joins.

CREATE INDEX idxCustomerName ON Customers (CustomerName)

SELECT * FROM Customers WHERE CustomerName = 'ABC Company'

In this example, an index named idxCustomerName is created on the CustomerName column of the Customers table. The index is then used to speed up a query that retrieves all customers with the name “ABC Company”.