Exercises
Assess your understanding of SQL Server index optimization with this quiz on the fundamentals of faster query performance. Explore why indexes are used, how to create and remove them, and the differences between clustered and non-clustered indexes. Questions also cover composite indexes, covering indexes, filtered indexes for highly specific search conditions, storage considerations, and when a clustered index may not be the best choice. Ideal for database developers, SQL Server administrators, and learners who want to strengthen their indexing knowledge and make more informed query-tuning decisions.
Answer the questions below and check the explanation for each answer.
0/10 answered
Auto audio on: the next questions will be read aloud when you click Continue.
An index in SQL Server is primarily used to improve the performance of query processing. Indexes allow the database engine to quickly locate and access data without scanning each row in a table. This results in faster query execution times when retrieving data from large datasets. While other features such as compression or encryption serve different purposes, indexes mainly optimize the speed and efficiency of data retrieval.
In SQL Server, the command used to create an index is CREATE INDEX. This command allows you to create a new index on one or more columns of a table, which can improve the speed of data retrieval operations. Options 2 ADD INDEX and 3 SET INDEX are not valid SQL Server commands for index creation.
A Non-Clustered Index in SQL Server allows for faster data retrieval by creating an index tree separate from the actual data storage, which reference the data rows. However, it requires more storage space as it maintains the index data separately.
A Filtered Index is best for optimizing a frequently used, highly specific search condition because it creates an index with a filter, indexing only the rows that meet a defined criteria. This makes it more efficient and faster for queries that consistently target specific values, without indexing entire tables.
An Indexed View is a view for which a unique clustered index is created, and it may include columns from more than one table included in the view. This enables optimizations and faster queries since results are precomputed and stored as a physical object.
Option 1 is correct because a clustered index determines the physical order of data in a table. When the table is large and columns are often modified, clustered indexes can lead to high maintenance overhead. Modifying the indexed columns may require frequent rearrangement of the data, impacting performance.
A clustered index determines the physical order of data in a table and stores the actual data rows, making retrieval of data faster for that index. On the other hand, a non-clustered index contains a copy of the indexed data along with a pointer to the physical data row, which allows more flexibility but can be less efficient for certain queries compared to a clustered index.
In SQL Server, the correct command to remove an index is DROP INDEX. The DELETE INDEX and REMOVE INDEX commands do not exist in SQL Server, making option 2 the correct choice. The DROP INDEX statement is specifically used to delete an index from a table.
A covering index improves query performance by reducing the amount of data that needs to be scanned. It contains all the columns needed to satisfy the query, thus eliminating the need to fetch additional data from the table rows. This minimizes disk I/O and enhances performance.
A composite index in SQL Server is an index that includes more than one column from the same table. This type of index is useful for improving the performance of queries that filter on multiple columns.

Free CourseSQL Database Programming
4h28m
24 exercises

Free CourseLearn to use Google BigQuery for Beginners
1h17m
14 exercises

Free CourseDatabase Systems: SQL, Indexing, Query Optimization, Transactions and Distributed Databases
33h54m
23 exercises

Free CourseProgramming Databases
1h14m
7 exercises

Free CourseMongoDB Database
1h27m
10 exercises

Free CourseDatabase Management Systems
5h21m
27 exercises

Free CourseDatabase Systems
4h32m
44 exercises

Free CourseMongoDB Tutorial for Beginners
1h39m
14 exercises
Thousands of online courses in video, ebooks and audiobooks.
To test your knowledge during online courses
Generated directly from your cell phone's photo gallery and sent to your email
Download our app via QR Code or the links below:.
+ 10 million
students
Free and Valid
Certificate
60 thousand free
exercises
4.8/5 rating in
app stores
Free courses in
video and ebooks