Usually, you'd have 3 tables: USER, FRIEND, and a third table named something like USER_FRIEND. They'd be set up like:
USER: emailID (PK) userName Password Address Etc FRIEND: emailID (PK) USER_FRIEND user_emailID (PK) friend_emailID (PK) with user_emailID a foreign key pointing to USER, friend_emailid a foreign key pointing to FRIEND. This is the standard way of doing a many-many relationship. On Wed, Oct 8, 2008 at 10:41 AM, Ben A.H. <[EMAIL PROTECTED]> wrote: > Hello, > > I'm having conceptualizing the correct relationship for what seems a very > simple scenario: > > Scenario: > I have a standard "USERS" table... > USERS have a list of "FRIENDS", these can be other members or also non > members... Similar to facebook... > > My main issue is conceptualizing the relationship for member to member > contacts. > > TABLES: > USER: > emailID (PK) > userName > Password > Address > Etc > > FRIEND: > emailID (PK) > friendEmailID (PK) > > RELATIONSHIPS: > > USER.emailID (1) --- FRIEND.emailID (many) > USER.emailID (many) --- FRIEND.friendEmailID (1) > > Does this work or is this a cyclical many-to-many relationship? (1 User can > have many friends, 1 friend can belong to many users)... If so, what's the > correct (normalized) way of representing this? > > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] > > -- Jim Lyons Web developer / Database administrator http://www.weblyons.com