Hey all, I am hoping someone with a lot of Database experience can give me a bit of a hand here. In my database for my app, I have several tables but I am going to ask my question concerning only 2 of them and just extrapolate from there.
My first table is all of a user's identifying information, ID as primary Key and then stuff like Name, Address, etc etc.. The second table is my medication table which is to contain, for each user, a list of their medications. The structure of the meds table is UserID (Integer which joins the first table and this one), MedID (Right now, the Primary Key), MedName, etc etc.. Would I be best making, for the Meds Table, UserID AND MedID as key? If I did that, could my tables possibly look like the following?
I hope that this is clear. Any suggestions?
Thanks,
Lary
My first table is all of a user's identifying information, ID as primary Key and then stuff like Name, Address, etc etc.. The second table is my medication table which is to contain, for each user, a list of their medications. The structure of the meds table is UserID (Integer which joins the first table and this one), MedID (Right now, the Primary Key), MedName, etc etc.. Would I be best making, for the Meds Table, UserID AND MedID as key? If I did that, could my tables possibly look like the following?
User Table.....................Meds Table
ID=1.............................UserID=1
Name=Lary....................MedID=1
...................................MedName=Whatever
...................................UserID=1
...................................MedID=2
...................................MedName=Stuff
ID=1.............................UserID=1
Name=Lary....................MedID=1
...................................MedName=Whatever
...................................UserID=1
...................................MedID=2
...................................MedName=Stuff
ID=2.............................UserID=2
Name=George.................MedID=??? 1 OR 3???
...................................MedName=DifferentStuff
Name=George.................MedID=??? 1 OR 3???
...................................MedName=DifferentStuff
I hope that this is clear. Any suggestions?
Thanks,
Lary
Last edited: