Enforce uniqueness and speed up lookups.
Section: Create and use indexes
Create a unique index
sql
sql
CREATE UNIQUE INDEX idx_users_email ON users(email);Explanation
Useful both for integrity and for fast point lookups.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Create and use indexes