Recall & Review
beginner
What is the purpose of the
CREATE INDEX statement in SQL?It creates an index on one or more columns of a table to speed up data retrieval.
Click to reveal answer
beginner
Write the basic syntax of
CREATE INDEX.CREATE INDEX index_name ON table_name (column1, column2, ...);
Click to reveal answer
intermediate
Can you create an index on multiple columns? How?
Yes, by listing multiple columns separated by commas inside parentheses after the table name.
Click to reveal answer
intermediate
What is a unique index and how do you create it?
A unique index ensures all values in the indexed column(s) are distinct. Use
CREATE UNIQUE INDEX instead of just CREATE INDEX.Click to reveal answer
intermediate
Does creating an index affect data insertion speed? Why or why not?
Yes, because the database must update the index every time data is inserted, which adds overhead.
Click to reveal answer
What does the
CREATE INDEX statement do?✗ Incorrect
CREATE INDEX creates an index to speed up searching data in a table.
Which of the following is the correct syntax to create an index on the column
name in the table users?✗ Incorrect
The correct syntax is CREATE INDEX index_name ON table_name (column_name);
How do you create a unique index?
✗ Incorrect
The correct syntax places UNIQUE right after CREATE: CREATE UNIQUE INDEX.
Can you create an index on more than one column?
✗ Incorrect
You can create a multi-column index by listing columns inside parentheses separated by commas.
What is a downside of creating many indexes on a table?
✗ Incorrect
Indexes must be updated on data changes, so many indexes slow down insert and update operations.
Explain the syntax and purpose of the
CREATE INDEX statement.Think about how you tell the database to make searching faster.
You got /5 concepts.
Describe the trade-offs of using indexes in a database.
Consider both benefits and costs of indexes.
You got /4 concepts.