Bird
0
0

Which SQL statement correctly creates an index named idx_email on the email column of the customers table?

easy📝 Syntax Q3 of 15
SQL - Indexes and Query Performance
Which SQL statement correctly creates an index named idx_email on the email column of the customers table?
AALTER TABLE customers ADD INDEX idx_email(email);
BCREATE TABLE idx_email ON customers(email);
CCREATE INDEX idx_email ON customers(email);
DCREATE UNIQUE INDEX idx_email ON customers(email);
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct syntax

    The standard SQL syntax to create an index is CREATE INDEX index_name ON table(column);
  2. Step 2: Evaluate options

    CREATE INDEX idx_email ON customers(email); matches the correct syntax. CREATE TABLE idx_email ON customers(email); is invalid syntax. ALTER TABLE customers ADD INDEX idx_email(email); is MySQL-specific but not standard and may not always be correct. CREATE UNIQUE INDEX idx_email ON customers(email); creates a unique index, which is different from a normal index.
  3. Final Answer:

    CREATE INDEX idx_email ON customers(email); -> Option C
  4. Quick Check:

    Standard index creation uses CREATE INDEX [OK]
Quick Trick: Use CREATE INDEX index_name ON table(column) [OK]
Common Mistakes:
  • Confusing CREATE TABLE with CREATE INDEX
  • Using ALTER TABLE incorrectly for index creation
  • Mistaking unique index for regular index

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SQL Quizzes