Complete the code to create a partial index on the "users" table for active users only.
CREATE INDEX idx_active_users ON users (last_login) WHERE [1];The partial index is created only for rows where the status is 'active'. This helps speed up queries filtering active users.
Complete the code to create a partial index on the "orders" table for orders with status 'pending'.
CREATE INDEX idx_pending_orders ON orders (order_date) WHERE [1];The partial index targets only orders where the status is 'pending', improving query speed for those orders.
Fix the error in the partial index creation for the "products" table to index only discontinued products.
CREATE INDEX idx_discontinued_products ON products (product_name) WHERE [1];The column 'discontinued' is a boolean, so the correct condition is 'discontinued = TRUE' to index only discontinued products.
Fill both blanks to create a partial index on the "employees" table for employees in the 'Sales' department with active status.
CREATE INDEX idx_active_sales ON employees (employee_id) WHERE [1] AND [2];
The partial index filters employees who are in the Sales department and have an active status.
Fill all three blanks to create a partial index on the "tickets" table for open tickets assigned to user 'john_doe' with priority higher than 3.
CREATE INDEX idx_open_high_priority ON tickets (ticket_id) WHERE [1] AND [2] AND [3];
The partial index covers tickets that are open, assigned to 'john_doe', and have priority greater than 3.