An index is a database object that improves the speed of data retrieval by creating a quick lookup structure, similar to a book index.
CREATE INDEX idx_employee_name ON employees(name);
CREATE INDEX idx_emp_dept_salary ON employees(dept_id, salary);
CREATE UNIQUE INDEX idx_email ON users(email);
SELECT queries; useful for JOIN and WHERE conditions.INSERT/UPDATE/DELETE (index updates) and consumes extra storage.SELECT *
FROM employees
WHERE dept_id = 10 AND salary > 50000;
-- Faster with index on (dept_id, salary)