DROP INDEX
- SQL course
- Intermediate
- Lesson 80/115
- 4 min
Remove an index.
DROP INDEX
DROP INDEX removes an index. Unused indexes are cleaned up.
DROP INDEX idx_name;This query removes the index.
DROP INDEX — details
Some databases use DROP INDEX idx_name ON customers. Syntax may vary.
Dropping unused indexes speeds up writes and saves disk space.
Practice DROP INDEX
Remove the idx_name index with DROP INDEX.
Starter code
-- drop index
DROP INDEXSample solution
DROP INDEX idx_name;Expected output
İndeks kaldırıldı
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What does DROP INDEX do?
- Drops the table
- Deletes the data
- Removes the index Correct answer
- Stops the query
Explanation: DROP INDEX removes the index.
2 Add DROP INDEX
DROP ____ idx_name;
DROP INDEX idx_name;
Explanation: DROP INDEX removes the index; the table and data are not affected.
3 DROP INDEX: match the terms
| Term | Meaning |
|---|---|
DROP INDEX |
remove |
CREATE INDEX |
create |
unused |
clean |
data |
unaffected |