Bird
0
0

If a B-tree index exists on the column category, what will happen when running:

medium📝 query result Q5 of 15
SQL - Indexes and Query Performance
If a B-tree index exists on the column category, what will happen when running:
SELECT * FROM products WHERE category > 'Electronics';?
AThe index will cause the query to return no results
BThe query will ignore the index and scan the entire table
CThe database will only use the index if the query includes an equality condition
DThe index will be used to efficiently find rows where category is greater than 'Electronics'
Step-by-Step Solution
Solution:
  1. Step 1: Understand range queries

    B-tree indexes support range conditions like greater than.
  2. Step 2: Query execution

    The index helps locate the starting point and scan forward for matching rows.
  3. Final Answer:

    The index will be used to efficiently find rows where category is greater than 'Electronics' -> Option D
  4. Quick Check:

    Range queries benefit from B-tree indexes [OK]
Quick Trick: B-tree indexes speed up range queries like greater than [OK]
Common Mistakes:
  • Thinking indexes only help equality conditions
  • Assuming full table scan for range queries
  • Believing indexes exclude range results

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes