Tuesday, June 10, 2008
Parent and Child Database Relationships

Parent and Child Database Relationships
Easy if you keep it simple.
an excerpt from http://evolt.org/article/RI_to_the_Rescue/18/13276/index.html

"Every database relation is a one-to-many relation involving just two tables, a parent table and a child table. Yes, you may hear other terms like one-to-one, many-to-many, and so on, but these are all just special cases of the one-to-many relation. Don't let them fool you. Understanding databases is easy if you keep it simple.

So each relation is one-to-many, involving a parent table and a child table. This terminology is not standard, merely convenient, if somewhat unfortunate. Some people say master and detail; sometimes, I'll say owner and member, a flashback from pre-relational CODASYL databases as out of date as bell-bottom pants (except that unlike pre-relational databases, bell-bottoms may one day be back in style).

As you might guess, the parent is the "one" and the child is the "many." Each parent can have many children. The reverse, I am afraid, is not true, not in a relational database. A child can have only one parent. Please don't dwell too long on the obvious fact that in real life a child has two parents -- you will only get confused. In a relational database, in a one-to-many relation, each child has at most one parent. This is important. This is also why the parent-child terminology is unfortunate."
 




<< Home







<< Return to Home Page



Sponsored by Iterations Software