Bird
0
0

Consider this SQL statement to create an index:

medium📝 Debug Q14 of 15
SQL - Indexes and Query Performance

Consider this SQL statement to create an index:

CREATE INDEX idx_price ON products price;

What is wrong with this statement?

ATable name should come after the column name
BIndex name cannot start with 'idx_'
CMissing parentheses around the column name
DCREATE INDEX cannot be used on numeric columns
Step-by-Step Solution
Solution:
  1. Step 1: Check the syntax for CREATE INDEX

    The column name must be inside parentheses after the table name.
  2. Step 2: Identify the syntax error

    The statement is missing parentheses around price. It should be ON products(price).
  3. Final Answer:

    Missing parentheses around the column name -> Option C
  4. Quick Check:

    Column name needs parentheses = C [OK]
Quick Trick: Column name must be in parentheses after table [OK]
Common Mistakes:
  • Omitting parentheses around column
  • Misplacing table and column names
  • Thinking index names have restrictions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes