View Single Post

   
  #5 (permalink)  
Old 02-28-2008, 09:49 AM
strawberry
 
Posts: n/a
Default Re: column name suggestion


Josselin wrote:
> On 2006-12-23 18:40:35 +0100, "strawberry" <zac.carey@gmail.com> said:
>
> >
> > Josselin wrote:
> >> I have 'members' table in my app
> >> A member 'knows' 0-to-many other members and a member 'is_knowned_by'
> >> 0-to-many other members
> >>
> >> Obviously, I need to create a table 'relationships' to maintain the
> >> relationship data between 2 members of a network :
> >> creation_date, relationship_type.... no problem at this point....
> >>
> >> to create this relationship table I need to give a label to the 2
> >> foreign keys, but as a non-english dev, I actually don't know hos Is
> >> hould name this keys in english..... shoudl I use 'knowned_by_id'
> >> and 'knows_id' or have you any better suggestion ?
> >>
> >> thanks a lot
> >>
> >> joss

> >
> > will this do...
> >
> > members_friends(member_id*,friend*)
> > *=primary key
> >
> > is_known_by =
> >
> > SELECT member_id FROM members_friends WHERE friend = x
> >
> > knows =
> > SELECT friend FROM members_friends WHERE member = x

>
> thanks a lot for your help
> my concern is about using 'friend' as the 'relationship' will have a
> type_code ( 'friend', 'family' ', business',..)
> maybe I should go to 'related_to_id' and 'related_from_id' ....


Sorry, I don't know what a type_code is, so I don't really know what
the problem you envisage is. Call it friend_id if that's clearer for
you.

Reply With Quote