CodeBlanks Logo Icon CodeBlanks

DROP INDEX

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

query.sql
-- drop index
DROP INDEX

Sample solution

query.sql
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

Question
DROP ____ idx_name;
Answer
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

All lessons in Intermediate