Bird
0
0

Consider a table inventory with 1 million rows and an index on item_category. What is the expected behavior of this query?

medium📝 query result Q4 of 15
SQL - Indexes and Query Performance
Consider a table inventory with 1 million rows and an index on item_category. What is the expected behavior of this query?
SELECT * FROM inventory WHERE item_category = 'electronics';
AThe query will return no results because indexes filter data
BThe query will perform a full table scan ignoring the index
CThe query will fail due to index corruption
DThe query will use the index to quickly find matching rows
Step-by-Step Solution
Solution:
  1. Step 1: Understand index usage

    An index on item_category allows the database to quickly locate rows matching the condition.
  2. Step 2: Analyze query behavior

    The query filters by item_category, so the index will be used to speed up retrieval.
  3. Final Answer:

    The query will use the index to quickly find matching rows -> Option D
  4. Quick Check:

    Indexed columns speed up WHERE clause filtering [OK]
Quick Trick: Queries filter on indexed columns run faster [OK]
Common Mistakes:
  • Assuming indexes are ignored automatically
  • Believing indexes cause query failure
  • Thinking indexes filter out data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes