Lucas Cotta <lucco...@gmail.com> wrote:
> Are primary keys and foreign keys indexes by default? Or do we have to set
> them as indexes?

An index is automatically created to implement PRIMARY KEY and UNIQUE 
constraints.

No indexes are automatically created for foreign key constraints. Columns 
mentioned in REFERENCES clause must already have a unique index of them 
(whether explicitly or implicitly as a result of PRIMARY KEY or UNIQUE 
constraints). Indexes (not necessarily unique) on the columns of the child 
table subject to FOREIGN KEY constrained are recommended, but not required. For 
details, see

http://sqlite.org/foreignkeys.html#fk_indexes

-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to