Recall & Review
beginner
What is a primary index in a database?
A primary index is an index based on the primary key of a table. It uniquely identifies each record and is used to quickly locate data. It is usually automatically created when a primary key is defined.
Click to reveal answer
beginner
What is a secondary index in a database?
A secondary index is an index created on non-primary key columns. It helps speed up queries on those columns but does not enforce uniqueness or directly identify records.
Click to reveal answer
intermediate
How does a primary index differ from a secondary index?
A primary index is based on the primary key and uniquely identifies records, while a secondary index is based on other columns and may not be unique. Primary indexes are often clustered, meaning data is stored in the order of the index, but secondary indexes are usually non-clustered.
Click to reveal answer
beginner
Why are secondary indexes useful?
Secondary indexes allow faster searching and retrieval of data based on columns other than the primary key. They improve query performance when filtering or sorting by those columns.
Click to reveal answer
beginner
Can a table have multiple secondary indexes?
Yes, a table can have multiple secondary indexes on different columns to optimize various queries. However, each index adds some overhead for data updates.
Click to reveal answer
Which index uniquely identifies each record in a table?
✗ Incorrect
The primary index is based on the primary key and uniquely identifies each record.
What is true about secondary indexes?
✗ Incorrect
Secondary indexes are created on columns other than the primary key and may not be unique.
Which of the following is a benefit of secondary indexes?
✗ Incorrect
Secondary indexes help speed up queries on columns other than the primary key.
Can a table have more than one secondary index?
✗ Incorrect
Tables can have multiple secondary indexes on different columns.
Which index type is usually clustered, storing data in index order?
✗ Incorrect
Primary indexes are often clustered, meaning the data is stored in the order of the index.
Explain the main differences between primary and secondary indexes in a database.
Think about uniqueness and which columns the indexes are built on.
You got /5 concepts.
Describe why secondary indexes are important and when you would use them.
Consider queries that filter by columns other than the primary key.
You got /4 concepts.