Complete the code to create a B-tree index on the column 'name' in the 'employees' table.
CREATE INDEX idx_name ON employees ([1]);The index is created on the 'name' column to speed up searches based on employee names.
Complete the SQL query to use the index on 'name' to find employees named 'Alice'.
SELECT * FROM employees WHERE [1] = 'Alice';
The query filters employees by the 'name' column, which matches the indexed column.
Fix the error in the SQL query to use the index correctly for a range search on 'age'.
SELECT * FROM employees WHERE age [1] 30;
Using '>' allows the query to find employees older than 30, which can use a B-tree index on 'age' for range searches.
Fill both blanks to create a B-tree index on 'department' and use it in a query filtering by 'department'.
CREATE INDEX idx_dept ON employees ([1]); SELECT * FROM employees WHERE [2] = 'Sales';
The index is created on 'department' and the query filters by 'department' to use the index efficiently.
Fill all three blanks to create a B-tree index on 'salary', select employees with salary greater than 50000, and order results by salary.
CREATE INDEX idx_salary ON employees ([1]); SELECT * FROM employees WHERE [2] [3] 50000 ORDER BY salary;
The index is on 'salary'. The query filters employees with salary greater than 50000 and orders by salary to use the index efficiently.