Summary - INDEX
- SQL course
- Intermediate
- Lesson 82/115
- 5 min
Speed up a search query with CREATE INDEX.
Summary - INDEX
An INDEX speeds up searches and slows writes. Added with CREATE INDEX, removed with DROP INDEX.
CREATE INDEX idx_name ON customers (name);Summary index query.
The index idx_name is created.
Practice Summary - INDEX
Summary: add a name index on customers.
Starter code
-- summary index
CREATE INDEXSample solution
CREATE INDEX idx_name ON customers (name);Expected output
İndeks oluşturuldu
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What does an INDEX do to writes?
- Slows them down Correct answer
- Speeds them up
- Has no effect
- Stops them
Explanation: An INDEX slows writes.
2 Summary - INDEX: match the terms
| Term | Meaning |
|---|---|
INDEX |
speeds up |
CREATE INDEX |
create |
DROP INDEX |
remove |
primary key |
automatic |