Complete the code to create an index on the email column of the users table.
CREATE INDEX [1] ON users(email);The index name idx_email is a common and clear naming convention for an index on the email column.
Complete the code to select all rows from orders where customer_id equals 5, using an index if available.
SELECT * FROM orders WHERE [1] = 5;
The query filters by customer_id, so an index on this column helps speed up the search.
Fix the error in the index creation statement by completing the blank.
CREATE INDEX [1] users(email);The CREATE INDEX syntax requires the keyword ON before specifying the table name.
Fill both blanks to create a unique index named uniq_order on the order_number column of the orders table.
CREATE [1] INDEX [2] ON orders(order_number);
The keyword UNIQUE creates a unique index, and uniq_order is the index name.
Fill all three blanks to write a query that selects product_id and price from products where category equals 'Books', using an index if available.
SELECT [1], [2] FROM products WHERE [3] = 'Books';
The query selects product_id and price columns and filters rows where category is 'Books'. An index on category helps speed up this filter.