Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Father Son Relationship


Father Son Relationship

Author
Message
frecal
frecal
SSC Rookie
SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)

Group: General Forum Members
Points: 44 Visits: 287
Hi I am after some advice
I have to record Father and Son details using sql 2008.
would you have the information all in one table or have two tables with the fathers in one and sons in other table

all advice is welcome

thanks
Fred
davidandrews13
davidandrews13
SSC Eights!
SSC Eights! (896 reputation)SSC Eights! (896 reputation)SSC Eights! (896 reputation)SSC Eights! (896 reputation)SSC Eights! (896 reputation)SSC Eights! (896 reputation)SSC Eights! (896 reputation)SSC Eights! (896 reputation)

Group: General Forum Members
Points: 896 Visits: 4458
i'd have them in one table and self reference as a son could also be a father. presumably.
Ian Scarlett
Ian Scarlett
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1623 Visits: 6540
A few questions before giving definitive advice...

Will you be recording EXACTLY the same sort of information (e.g. name, address, dob) for Father and Son, or will one have more/less information than the other (e.g. only record Marital Status for Father)?

Can a Son have only one father (not biologically!!) e.g. would you need to record both a natural father and a stepfather.

Can a Son exist without a Father?

Can a Son also be a Father?



alastair-804470
alastair-804470
Grasshopper
Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)Grasshopper (21 reputation)

Group: General Forum Members
Points: 21 Visits: 105
Are we talking 'metaphorical' father and son relationships here, as in the nodes in a graph that may be described as 'parents' and 'children', or do you really mean a list of fathers and their sons? (and not their grandsons as well?)

Essentially, the answer depends on whether the data you are modelling conforms to the rules of a hierarchy (i.e. it has a single root node, every child must have a parent, and the graph is directed), or whether you are just describing a general graph where nodes can be connected to each other, but without any further constraints.

Options that spring to mind are:
- A father table and a son table, joined on keys.
- Father and son records stored in the same table, using adjacency lists to reference between them (similar to how employee tables typically structure employee/manager relationships)
- The hierarchyid datatype

Without further information though, it's hard to recommend which is most suitable for your situation.
frecal
frecal
SSC Rookie
SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)SSC Rookie (44 reputation)

Group: General Forum Members
Points: 44 Visits: 287
thanks for the response.

The sons will have different information to the fathers .
and the sons wont be a father.

I am leaning towards having 2 tables
a Father table and a Son table as a father can have more than one son..with the links between the two

thanks
Fred
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search