SQL · Schema and constraints

index

Speeds up matching reads at the cost of writes and storage. Index the columns you filter and join on.

Syntax
create index name on table(col);

Example

Open in the lab

More in this group

alter table check create table create unique index default drop table foreign key not null

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course