问题
I'm new with iOS Development and i'm also new with SQLITE database. I used FMDB as a wrapper in my project and i have two tables 1) ParticepentsTable
and 2) ExerciseTable
.
ParticepentsTable
contains 4-Rows like Id, Name, Gender and Exercise_Id
and the ExerciseTable
contains 2-Rows i.e. Id and exercise_Name
.
My questions are as follow:-
1) I want to make a Foreign-key Relation between Table-1 & 2 using FMDB, so that i can store the exercise according to Participants choice.
2) Or any other way to select or insert exercises according to the participants?
3) Can I use Join to fetch data from both the tables according to the Participants id?
Any one can help please!
Tutorial link is more appreciated! Thanks!
回答1:
By looking at your other question I guess you already sorted this out. Here's my answer anyway. In iOS development it's uncommon to use SQLite directly, instead we use CoreData, which is an API that serializes data to SQLite (or you can configure it to serialize it to binary or XML too).
Here are some links for you:
SQLite
CoreData
Hope this helps!
来源:https://stackoverflow.com/questions/18973648/how-to-create-or-stabiles-relationship-between-two-tables-in-fmdb