MySQL Forums
Forum List  »  Newbie

1 to many and many to many help
Posted by: jason smith
Date: February 24, 2012 09:48AM

Hi guys i have been researching alot of tutorials and documentation but still cant grasp when to use a 1 to many relationship and when to use a many to many relationship any input would be greatly appreciated. here is my scenario im trying to grasp.

I have a user and a user_profile table, the user_profile has a 1 to 1 relationship with the user table which i understand. I am trying to figure out that i want a new table caled user_profile_pics that a user profile can have multiple profile pics ie only 1 default profile pic but adding more is possible so that when the user want to see all the profile pics they have been uploading they can see them all. Would this relationship be a 1 to many or many to many? i try to say to myself 1 user profile can have many user profile pics and many user profile pics can have 1 user profile. But also could it be many user profiles have have many user profile pics and many user profile pics can have many user profiles> i dont understand which way to look at it.

2nd scenario. the same user profile has an interests field which they can have many interests eg relaxing, outdoors etc. would this be a many to many or 1 to many?


Options: ReplyQuote

Written By
1 to many and many to many help
February 24, 2012 09:48AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.