Solved

request for idea about designing database like wat friendster does

Posted on 2006-07-16
7
190 Views
Last Modified: 2010-04-23
I would like to design an application which able to track 10 degrees of client...

juz like friendster.. can get to know who are your second degree frd.. third degree frd...

anyone can give me ideas about designing such database?
0
Comment
Question by:kengkit
  • 2
7 Comments
 
LVL 17

Accepted Solution

by:
ZeonFlash earned 20 total points
ID: 17117431
You should be able to pull off something like that with a pair of tables.  One is your basic user table that contains all the user information (demographic, login, etc.), while the other table is simply a linking table between users.  For example (assuming that you'll be using MS-SQL since you didn't specify):

tblUsers
  userPKID
  userLogin
  userPassword
  userCity
  ...etc

tblFriends
  frUserPKID
  frFriendPKID

So to get a user's friends, you do:
SELECT userPKID, userLogin, ...
FROM tblUsers
   INNER JOIN tblFriends ON userPKID = frFriendPKID
WHERE userPKID = [The user you're getting the friends of]

From there on it gets interesting to write the queries, but it can be done with a little time.
0
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 17123092
Funny... there's exactly this problem described in the latest issue of Dr. Dobbs.... http://drdobbs.com/dept/database/189401684

They describe a tool called Cogito, but do a pretty good job ob describing the process.

And, yes, it's very similar to what ZeonFlash describes.

One caveat... you either need to write queries that return for the friendID and the userID being the ID you're looking for... or have duplicate information in your database table.
0
 

Author Comment

by:kengkit
ID: 17127538
To: ZeonFlash

Thx for ur suggestion.. i will try it out when i free! Point will be award once i have a test later..

by the way.. i can foresee tat the table of tblFriends will be very huge if i got many many user
0
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 17315486
Bob,

Full points to ZeonFlash.

Jeff
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now