Hierarchical database model definition:
Hierarchical database model is a database model where database entities are in parent-child relations to each other and exists a databse entity which has no parent and all other database entities are in the child relation (directly or by other database entities) to this database entity. In the hierarchical database model child database entities may have only one parent (in this model it is not allowed to exist many to many relation).
Hierarchical database model example:
Hierarchical database model resambleas a “tree” structure. It meas that in the hierarchical database model exists main database entity which has no parent (a tree root) and all other database entities (tree branches) are in the child relation (directly or by other database entities) with this main database entity.
Let’s take a following “Shop database” which is a good example of a hierarchical database model:
Shop database contains 4 database entities:
- Branches (this database entity contains data about shop branches in various localizations)
- Sellers (this database entity contains data about sales staff)
- Customers (this database entity contains data about shop customers)
- Products (this database entity contains data about products that the shop offers and sellers responsible for each product)
In the our example Branches database does not contain foreign keys from other database entities so as a result, has no parent and it is a “tree root”.
Sellers and Cutomers database entities are in one to many relation with Branches database entity (both contain ID_BRANCH values from Branches database entity as foreign keys) so they are directly in the child relation with Branches database entity.
Products database entity is in the one to many relation with Sellers database entity (Products database contains ID_SELLER values from Sellers database (in the Sellers database ID_SELLER is a primary key) as foreign key) so Sellers database is a parent for Products database.
Products database is not directly in the child relation with Branches database but it is in a child relation with this Branches database via Sellers database. For example, if we want to investigate which branch is responsible for selling Microwaves in the first step we must check who from sellers is responsible for this product and next check to which branch this seller has been assigned. In the above example it will be ID_SELLER = S15 – Susan Smith who is assigned to ID_BRANCH = 12352 – New York, USA.
Copyright © 2015-2016 • All Rights Reserved • database-definition.com