Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
roshana
Starting Member
31 Posts |
Posted - 2009-10-30 : 00:36:28
|
HI All, I have an interview question “We would like to store a list of user’s in the database with their corresponding network of friends, groups, as well as any messages which are swapped between them. A user consists of a username, password, first name, last name and profile picture. A message is a string. User’s can have many friends but usually start off with none or only 1 friend. A user can join or create a group and there can only be 1 creator for any group”Please draw up a draft database schema for the above description with as much detail using the following annotationTABLE NAME: TABLE ATTRIBUTES: column1, column2, column3FOREIGN KEYS: column1 to .column1Thanks in advanceRoshana |
|
krishnarajeesh
Yak Posting Veteran
67 Posts |
Posted - 2009-11-06 : 14:00:05
|
Hello,Could try some thing like this...just created fast...pls review.Tables with columnsUSERSUID -> PrimaryKey(Pk)UNameUPasswordUFirstnameULastNameUProfilePicGROUPSGID -> PkGNameUIDMESSAGESMID -> PkMContentFRIENDSUID -> CompositekeyFID -> CompositekFRIENDS_MESSAGESUID -> CompositekFID -> CompositekMID -> CompositekFOREIGN KEYS GROUPS.UID -> USERS.UID(Pk)FRIENDS.UID -> USERS.UID(Pk)FRIENDS.FID -> USERS.UID(Pk)FRIENDS_MESSAGES.UID -> USERS.UID(Pk)FRIENDS_MESSAGES.FID -> USERS.UID(Pk)FRIENDS_MESSAGES.MID -> MESSAGES.MID(Pk)Thanks,Krishnawww.SQLServer.in |
|
|
|
|
|