Complete the code to create an index on the 'email' column of the 'users' table.
CREATE INDEX [1] ON users(email);The index name should be descriptive and unique. 'users_email_idx' clearly indicates the table and column indexed.
Complete the code to create a composite index on 'last_name' and 'first_name' columns.
CREATE INDEX [1] ON employees(last_name, first_name);'idx_employees_name' clearly indicates the table and columns involved in the composite index.
Fix the error in the code to create a unique index on the 'username' column.
CREATE [1] INDEX idx_username ON users(username);The keyword 'UNIQUE' ensures that the index enforces uniqueness on the 'username' column.
Fill both blanks to create an index on the 'order_date' column in descending order.
CREATE INDEX idx_order_date ON orders(order_date [1]); -- [2]
The correct SQL keyword for descending order is 'DESC'. The comment uses 'ASC' as a distractor but the code requires descending order.
Fill all three blanks to create a partial index on the 'status' column where status is 'active'.
CREATE INDEX idx_active_users ON users([1]) WHERE [2] = '[3]';
The partial index is created on the 'status' column, filtering rows where status equals 'active'.