0 day streak
sql / beginner
Snippet

Speeding Up Database Searches with Indexes

An index acts like a book index for a table, allowing the database engine to find specific rows much faster without scanning every record.

snippet.sql
sql
1
2
CREATE INDEX idx_customers_email
ON customers (email);
Breakdown
1
CREATE INDEX idx_customers_email
Defines a new index named idx_customers_email.
2
ON customers (email);
Specifies that the index should be built on the email column of the customers table.