Difficulty: Easy
Correct Answer: CREATE INDEX idx_customer_name ON Customer(Name);
Explanation:
Introduction / Context:
Indexes improve lookup performance by maintaining an additional data structure keyed by one or more columns. Creating an index requires specifying a name, a target table, and the indexed column list.
Given Data / Assumptions:
Concept / Approach:
The canonical form is: CREATE [UNIQUE] INDEX index_name ON table_name (column1[, column2 ...]);. Some DBMSs also support vendor-specific ALTER or DROP variants, but the creation syntax is widely consistent. Statements like CHANGE INDEX or REMOVE INDEX are not part of ANSI SQL.
Step-by-Step Solution:
Verification / Alternative check:
Vendor docs (PostgreSQL, SQL Server, Oracle, MySQL) all accept a CREATE INDEX statement with ON table(column). Minor dialect differences exist, but the structure is the same.
Why Other Options Are Wrong:
CHANGE/ADD/REMOVE INDEX: Not standard creation syntax and missing table/column details; would fail in a compliant SQL engine.
Common Pitfalls:
Forgetting the ON table(column) part; creating overlapping or redundant indexes that harm write performance; not analyzing selectivity before indexing.
Final Answer:
CREATE INDEX idx_customer_name ON Customer(Name);
Discussion & Comments