Bird
0
0

Given the table products(id INT, name VARCHAR, price DECIMAL), what will be the result of this SQL command?

medium📝 query result Q13 of 15
SQL - Indexes and Query Performance
Given the table products(id INT, name VARCHAR, price DECIMAL), what will be the result of this SQL command?
CREATE INDEX idx_price ON products(price);
AThe products table is duplicated with the name idx_price
BThe price column is deleted from the products table
CAn index named idx_price is created on the price column to speed up queries filtering by price
DSyntax error because price is not a primary key
Step-by-Step Solution
Solution:
  1. Step 1: Understand what the CREATE INDEX command does here

    The command creates an index named idx_price on the price column of products.
  2. Step 2: Identify the effect of the index

    This index helps speed up queries that filter or sort by price without changing the table structure.
  3. Final Answer:

    An index named idx_price is created on the price column to speed up queries filtering by price -> Option C
  4. Quick Check:

    CREATE INDEX adds search speed, no deletion [OK]
Quick Trick: CREATE INDEX speeds up search, does not delete or duplicate [OK]
Common Mistakes:
  • Thinking index creation deletes columns
  • Assuming index requires primary key
  • Confusing index with table duplication

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes