Complete the code to create a covering index on columns 'name' and 'age'.
CREATE INDEX idx_name_age ON users([1]);The covering index includes both 'name' and 'age' columns, so the query can be answered using only the index.
Complete the query to select 'name' and 'age' using the covering index.
SELECT [1] FROM users WHERE age > 30;
Selecting 'name' and 'age' matches the covering index columns, allowing efficient retrieval.
Fix the error in the index creation by choosing the correct syntax for including columns.
CREATE INDEX idx_user_info ON users([1]);Columns in an index must be comma-separated without parentheses.
Fill both blanks to create a covering index on 'email' and include 'last_login' as an included column.
CREATE INDEX idx_email ON users([1]) INCLUDE ([2]);
The index is on 'email' and includes 'last_login' to cover queries needing both without extra lookups.
Fill all three blanks to write a query that uses the covering index on 'email' and 'last_login' to find users who logged in after 2023-01-01.
SELECT [1], [2] FROM users WHERE [3] > '2023-01-01';
Selecting 'email' and 'last_login' matches the covering index columns, and filtering by 'last_login' uses the index efficiently.