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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Help in table relationships

Author  Topic 

jasmen
Starting Member

11 Posts

Posted - 2014-06-12 : 08:38:58
Hi i have this three table
1)Users
2)FamilyMembers
3)FamilyLogin
My question is how can i add for specific user account more than one son or Daughtar
with their name and age and so on

here the relation i made

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2014-06-12 : 11:13:57
Is your question about how to tell if a user has a son or daughter? Because, your schema doesn't allow you to tell whom is a son or daughter of another user. Otherwise you would just insert into the Users table with a reference back to the users table. Usually, two columns like Father and Mother or LegalGaurdian1 and LegalGaurdian2 or something that makes sense in your situation.
Go to Top of Page

jasmen
Starting Member

11 Posts

Posted - 2014-06-12 : 11:46:16
Lamprey thanks but i didn't get it
Go to Top of Page

Bill Z
Starting Member

27 Posts

Posted - 2014-06-12 : 12:30:09
May I make some suggestions here, even though I do not fully understand what you want to accomplish?

Additional keys in your FamilyMembers table could help identify if they are Father, Mother, Son or Daughter (or other). This would be part of the key.

Logic says that because they are members of the same family, they may reside at the same address. However, since this is not always true, there should be keys between FamilyMembers and Users that will allow for the father to live at a different address. Maybe one or more of the children are living in a boarding school.


_______________________________________________________________________________
How do you measure success? Money? Career? Health? Stuff? Relationships? Success and Purpose in Life go hand in hand. If you want to fulfill YOUR purpose in life you need to find out what it is.

I do this by accomplishing GOD’S purpose for my life.
Go to Top of Page

jasmen
Starting Member

11 Posts

Posted - 2014-06-12 : 12:55:20
quote:
Originally posted by Bill Z

May I make some suggestions here, even though I do not fully understand what you want to accomplish?

Additional keys in your FamilyMembers table could help identify if they are Father, Mother, Son or Daughter (or other). This would be part of the key.

Logic says that because they are members of the same family, they may reside at the same address. However, since this is not always true, there should be keys between FamilyMembers and Users that will allow for the father to live at a different address. Maybe one or more of the children are living in a boarding school.


_______________________________________________________________________________
How do you measure success? Money? Career? Health? Stuff? Relationships? Success and Purpose in Life go hand in hand. If you want to fulfill YOUR purpose in life you need to find out what it is.

I do this by accomplishing GOD’S purpose for my life.


thanks but my goal is lets say i am a Father and my family tree consist of my wife,tow sons and tow Daughters
lets say this Father have an account at website and he want to add his family tree with their Details like their names and ages
Go to Top of Page
   

- Advertisement -