A “Parent” table is the highest-level table in a data stack or family. In the image below, we see the data model of a Ninox database application with four Data Stacks or “Data Families”. The families are “Accounting”, “Employees”, “Customer” and “Legal and Compliance”. The name of a stack or family is the name that appears at the very top of the stack. It is important to note that while a data family may have many children, grandchildren and great-grandchildren, there can only be, and there must always be, one single parent.
When reviewing a data model (“Schema”) with parent tables, please be advised of the following:
1. A parent table may or may not have children. Every table (see the “Legal and Compliance” table in the image above), is by default a parent irrespective of whether or not that parent is composed of children.
2. Both parent tables and child tables may have links to and from other parent and children tables. A link from a parent to a parent or a child to a parent (that is not the child’s own parent) is represented by an arrow with starts at the table that requires content from another table and ends (the arrow head points to) the table that provides content to another table.
3. The relationship between a child table and its own parent is represented by the child table being displayed within the parent stack (as is the “Invoice Summary” and “Job Sites” children within their respective “Accounting” and “Customer” parents.
4. Data families may, optionally, have multiple generations or layers within the stack. Consider the Accounting family in the image above. The “Invoice” table is a child of the Accounting parent, but that child table has a child of its own – the “Line Items” table. In this scenario, the Invoice Line Items table is the child of the Invoice table and the grand child of the Accounting table. Therefore, a child may also be a parent and so on and so forth.
5. Children may have a relationship with their own parent that exists outside of the data family or stack. For example, you may create a database that consists of three tables, “Players”, “Coaches” and “Teams”. In this data model, “Teams” or comprised of one or a few coaches and many players. It is possible though, that the parent of one of the players could also be the coach of that childs team. In this case, the child would have two relationships with their parent, one within the family and one outside the family (as represented by a record in the “Team” table. (see below)
In the image above, we see that Players are children of Parents whlie Team Members are children of the Teams for which they play. These relationships are indicated by the fact that the children tables are completely enclosed within – they are components of – their parent. The two arrows indicate that there are additional relationships within this model. Relationship A represents the Child-to-Child relationships that indicates that members of the team are actually children in “another family”. Relationship B represents the Parent-to-Parent relationship such that team coaches are also parents of other families. In this scenario, a child who is coached by his familial parent would have two relationships with the same parent record; the first being child to parent and the second being player to coach.