Complete the code to select rows from the table using a sequential scan.
EXPLAIN ANALYZE SELECT * FROM employees WHERE salary > [1];The value 50000 is a number and should not be quoted in SQL when comparing numeric columns like salary.
Complete the code to create an index on the salary column to speed up queries.
CREATE INDEX idx_salary ON employees([1]);Creating an index on the salary column helps queries filtering by salary run faster.
Fix the error in the query to force a sequential scan by disabling index scans.
SET enable_indexscan = [1]; EXPLAIN ANALYZE SELECT * FROM employees WHERE salary > 50000;
Setting enable_indexscan to off disables index scans, forcing PostgreSQL to use sequential scans.
Fill both blanks to create a query that uses an index scan on the salary column with a condition.
EXPLAIN ANALYZE SELECT * FROM employees WHERE [1] [2] 60000;
The query filters rows where salary is greater than 60000, which can use an index on salary.
Fill all three blanks to create a query that uses an index scan on the department column with a specific value.
EXPLAIN ANALYZE SELECT * FROM employees WHERE [1] = '[2]' ORDER BY [3];
The query filters employees in the Sales department and orders results by department, which can use an index on department.