
Page 1 of 2 MySpace is the social networking phenomenon that is sweeping the nation. Having recently been sold for US$580 Million, it is plain to see that the format has a value, and indeed, just about everyone I know below the age of 25 has a MySpace account. The reason MySpace works is because it puts the control of the content in the hands of the users, and by catering to the social aspects of the human condition has found itself in an enviable position of mass appeal despite some criticism.
The purpose of this, first of many articles is to deconstruct the application—in this case, MySpace.com—and show you how to build your own. I believe that the lessons that can be gleaned from learning how a successful site is constructed are plentiful and valuable. Namely, the ability for the users of your site to connect to each other.
The first thing we will look at is what database structure would be required to implement the social networking aspect of MySpace.com. The examples will be in the context of SQL Server 2005, but the knowledge should be transferable to other RDBMSs.
Want to hear the best part about all of this? The core idea of myspace, and indeed all of the social networking sites, is the ability to connect to friends or colleagues and have them listed on your page. This can be accomplished with a total of two, yes, you heard it, two database tables. Figure 1 shows an example of what these tables might look like. Please note that the Accounts table should have a lot more information
Figure 1: Database Diagram
For the more technically minded, this is a self-referencial many-to-many relationship. This design allows the users to create an organic spiderweb of links.
Keywords
social networking myspace linkedin facebook database