Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Father Son Relationship Expand / Collapse
Author
Message
Posted Thursday, August 6, 2009 6:59 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, April 15, 2013 10:34 PM
Points: 44, Visits: 263
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
Post #766156
Posted Thursday, August 6, 2009 7:34 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Today @ 9:20 AM
Points: 574, Visits: 3,342
i'd have them in one table and self reference as a son could also be a father. presumably.
Post #766186
Posted Thursday, August 6, 2009 7:42 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, June 16, 2014 7:32 AM
Points: 1,327, Visits: 4,504
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?




Post #766189
Posted Thursday, August 6, 2009 8:24 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, May 1, 2012 10:31 AM
Points: 17, 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.
Post #766233
Posted Thursday, August 6, 2009 10:04 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, April 15, 2013 10:34 PM
Points: 44, Visits: 263
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
Post #766695
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse