8.4. SQL Index

8.4.1. Rationale

  • Used to create and retrieve data from the database very quickly

  • Analog to notebook calendar tabs

../../_images/sql-index-notebookcalendar.png

8.4.2. SQL Syntax

CREATE INDEX astronaut_agency_index
ON astronaut (agency);

8.4.3. If Not Exists

  • IF NOT EXISTS

CREATE INDEX IF NOT EXISTS astronaut_agency_index
ON astronaut (agency);

8.4.4. Unique Index

  • UNIQUE

CREATE UNIQUE INDEX IF NOT EXISTS astronaut_agency_index
ON astronaut (agency);