How would I design this table in SQL?
- by RSharma
I have a parent master table that is generic enough to hold the common information of the children. Since the children were substantially different, we created separate tables for them. So I have something like this:
tblMaster
--------
MasterID int
Name varchar(50) --Common to all children and there are a bunch of fields like this
ChildType int -- Type of Child either ChildOne or ChildTwo
ChildID int -- need to store ChildOneID or ChildTwoID depending on type of Child, so that i can refer to children
tblChild1
--------
ChildOneID int IDENTITY
tblChild2
---------
ChildTwoID int IDENTITY
Should I have a ChildID in the master that is either ChildOneID or ChildTwoID based on the ChildType column? I have a number of children and I have simplified it for this question.
The other way is to add ChildOneID and ChildTwoID as columns in the master, but since i have a number of columns, I will have a lot of null columns
EDIT: Any help is appreciated