0
0
DBMS Theoryknowledge~20 mins

Index selection guidelines in DBMS Theory - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Index Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
When to use an index on a database column?
Which situation is the best reason to create an index on a database column?
AThe column stores large text data that is rarely searched.
BThe column is updated very frequently but never used in queries.
CThe column is frequently used in WHERE clauses to filter rows.
DThe column contains unique values but is never queried.
Attempts:
2 left
💡 Hint
Think about when indexes help speed up data retrieval.
query_result
intermediate
2:00remaining
Effect of index on query execution
Given a table Employees with an index on DepartmentID, what is the expected output of this query's execution plan?
DBMS Theory
EXPLAIN SELECT * FROM Employees WHERE DepartmentID = 5;
AThe query sorts all rows by DepartmentID before filtering.
BThe query performs a full table scan ignoring the index.
CThe query returns an error because indexes cannot be used in WHERE clauses.
DThe query uses the index to quickly find rows with DepartmentID = 5.
Attempts:
2 left
💡 Hint
Indexes help speed up searches on indexed columns.
📋 Factual
advanced
2:00remaining
Correct syntax to create a composite index
Which SQL statement correctly creates a composite index on columns LastName and FirstName in the Customers table?
ACREATE INDEX idx_name ON Customers (LastName FirstName);
BCREATE INDEX idx_name ON Customers (LastName, FirstName);
CCREATE INDEX idx_name ON Customers LastName, FirstName;
DCREATE INDEX idx_name (LastName, FirstName) ON Customers;
Attempts:
2 left
💡 Hint
Check the order of keywords and parentheses in CREATE INDEX syntax.
optimization
advanced
2:00remaining
Choosing the best index for query optimization
You have a query filtering on City and Age columns. Which index choice will most likely improve performance best?
AA composite index on (City, Age).
BSeparate indexes on City and Age columns.
CNo index, rely on full table scan.
DAn index only on Age column.
Attempts:
2 left
💡 Hint
Think about how composite indexes help with multiple column filters.
🔍 Analysis
expert
3:00remaining
Why does this index not improve query speed?
A table has an index on LastName. The query is:
SELECT * FROM Users WHERE UPPER(LastName) = 'SMITH';
Why might the index not be used?
ABecause the query applies a function (UPPER) on the indexed column, preventing index use.
BBecause the index is only for numeric columns, not text.
CBecause the query is missing an ORDER BY clause.
DBecause the table has too few rows to use indexes.
Attempts:
2 left
💡 Hint
Consider how functions on columns affect index usage.