title: iOS SQLite: How to automatically set foreign key?
body: <p>My app uses SQLite, and I've sorted out the create table statements. The idea is that table A and B have a one-to-many (or one) relationship, so the foreign key will be in Table B. Now I know about autoincrement for creating the primary key but how will this work for the foreign key? What if I add one row for Table A and 5 rows for Table B (all of which ideally are linked to that single row in Table A)? Won't it just autoincrement from 001-005 in table B?</p>