If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Ways to connect sets of data

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-05-07, 02:18
Spatulas Spatulas is offline
Registered User
 
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?
Reply With Quote
  #2 (permalink)  
Old 01-05-07, 09:01
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
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
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-05-07, 11:10
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
Yes. That is the optimal method.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
  #4 (permalink)  
Old 01-05-07, 16:40
Spatulas Spatulas is offline
Registered User
 
Join Date: Jan 2007
Posts: 2
Really? Alright, thanks.
Reply With Quote
  #5 (permalink)  
Old 01-06-07, 18:58
bdimple bdimple is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On