Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2007
    Posts
    2

    Question Ways to connect sets of data

    Hello there. I design/develop the occasional web application, and I frequently find myself needing to store data that connects two things together. At the moment, I just store one piece of data from each in it's own table, and use that. For example, a "friend" system where users select their friends (where they could have any number of friends). The system I currently use would simply store the ID of the user, and the ID of one friend, but this seems hardly optimal to me, especially since in a real life situation with more than 100 users, something like this would expand extremely quickly. Is this really the best way, or can anyone suggest an alternate method of setting things up?

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i dunno if it's really the best way, but i've seen a couple of dozen people ask questions about "friend" networks, and that's the way they're all doing it
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Yes. That is the optimal method.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  4. #4
    Join Date
    Jan 2007
    Posts
    2
    Really? Alright, thanks.

  5. #5
    Join Date
    Jul 2003
    Posts
    74

    An example of Friends

    Hi,

    There is an example on the Database Answers Web Site that might be helpful :-
    http://www.databaseanswers.org/data_...gees/index.htm

    It shows a general approach to modelling Relationships between any one person and an unlimited number of other people, with the types of the Relationships and their duration.

    HTH

    B.Dimple
    Senior DBA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •