Index with Included Columns (Covering)
Index with Included Columns (Covering) is a SQL statement in the Indexes category. Non-key columns stored at the leaf level only — they cannot be used for search but avoid table lookups. The syntax is CREATE INDEX idx_name ON table (key_col) INCLUDE (non_key_col1, non_key_col2);. It returns covering index. A typical example: CREATE INDEX idx_covering ON employees (department_id) INCLUDE (name, salary, hire_date); -- This query is fully covered (no table access needed): SELECT name, salary FROM employees WHERE department_id = 5; -- The index contains the key (department_id) and included columns (name, salary) -- Faster because it only reads from the index -- Included columns are NOT part of the index key: -- They don't affect index size (B-tree levels) -- They… A close relative is CREATE INDEX, which creates an index on one or more columns to speed up query performance. A close relative is DROP INDEX, which removes an existing index from a table.