Recall & Review
beginner
What is an index in a database?
An index is like a shortcut in a book. It helps the database find data faster without looking at every row.
Click to reveal answer
beginner
How do you create a simple index on a column named 'name' in MySQL?
Use the command:
CREATE INDEX idx_name ON table_name(name); This makes searching by 'name' faster.Click to reveal answer
intermediate
What is the difference between a UNIQUE index and a regular index?
A UNIQUE index makes sure no two rows have the same value in the indexed column, while a regular index just speeds up searches.
Click to reveal answer
intermediate
Why should you not create too many indexes on a table?
Too many indexes slow down data changes like INSERT, UPDATE, DELETE because the database must update all indexes too.
Click to reveal answer
intermediate
What is a composite index?
A composite index is an index on multiple columns together. It helps speed up searches that use those columns combined.
Click to reveal answer
Which command creates an index on the 'email' column in MySQL?
✗ Incorrect
The correct syntax to create an index is CREATE INDEX index_name ON table_name(column_name);
What does a UNIQUE index ensure?
✗ Incorrect
A UNIQUE index prevents duplicate values in the indexed column.
Which is a downside of having many indexes on a table?
✗ Incorrect
More indexes mean the database must update them on data changes, slowing down INSERT, UPDATE, DELETE.
What is a composite index?
✗ Incorrect
A composite index covers multiple columns combined for faster searches using those columns.
Which of these is NOT a valid reason to create an index?
✗ Incorrect
Indexes slow down data insertion because they need updating; they do not make it faster.
Explain what an index is and why it is useful in a database.
Think about how you find a topic quickly in a book.
You got /3 concepts.
Describe how to create a simple index in MySQL and mention one important consideration when using indexes.
Remember the command and why too many indexes can be bad.
You got /3 concepts.