An index is the single biggest lever for query performance, and also one of the most misunderstood — adding one doesn't automatically make a query fast, adding too many can make writes slow, and the same query can silently stop using an index after a seemingly harmless change. This is a complete reference for how indexes actually work, using the same Employees/Departments schema that runs live in the code lab:
CREATE TABLE Departments (
dept_id INTEGER PRIMARY KEY,
dept TEXT NOT NULL
);
CREATE TABLE Employees (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,
dept TEXT NOT NULL,
salary INTEGER
);
Work through this in order if you're new to the topic — later chapters (composite indexes, SARGability, execution plans) build directly on the mental model established in the first few.