SQL Index Interview Questions

    Question 1Creating a Basic Index

    You want to improve the performance of queries that search for customers by their last name in a customers table. Which SQL statement correctly creates an index on the last_name column?

    Question 2Index Purpose and Benefits

    What is the primary purpose of an index in SQL?

    Question 3Clustered vs Non-Clustered Indexes

    What is the difference between clustered and non-clustered indexes?

    Question 4Creating a Composite Index

    Your queries often filter results based on a combination of country and city from the users table. Which query correctly creates a single index to optimize these types of searches?

    Question 5Composite Index Usage

    What is a composite index and when should it be used?

    Question 6Index Maintenance and Updates

    How are indexes maintained when table data changes?

    Question 7Creating a Unique Index

    You need to ensure that the combination of product_id and supplier_id in a product_suppliers table is always unique, while also improving query performance on these columns. Which statement achieves both goals?

    Question 8Index Scan vs Index Seek

    What is the difference between index scan and index seek?

    Question 9When to Drop or Rebuild Indexes

    When should indexes be dropped or rebuilt?

    Question 10When an Index is Ignored

    You have an index on the last_name column of the customers table. Why might the following query not use that index?
    SELECT * FROM customers WHERE UPPER(last_name) = 'SMITH';