askvity

How does hierarchical model work?

Published in Database Model 3 mins read

The hierarchical model, notable as the first database management system model, works by organizing data in a structure that resembles a hierarchical tree.

Understanding the Hierarchical Structure

At its core, the hierarchical model uses a hierarchical tree structure to organise the data. Think of it like an organizational chart or a file system on a computer.

Here's a breakdown of its components:

  • Root Node: The hierarchy begins at the root. This is the top-level node in the tree and contains the initial data point from which all other data branches out. There is only one root node in a hierarchical database.
  • Nodes: Data is stored within nodes. Each node represents a specific entity or data record.
  • Parent-Child Relationships: Nodes are connected through links that define parent-child relationships.
    • A parent node can have one or more child nodes.
    • Crucially, each child node can have only one parent node. This is a defining characteristic of the hierarchical model and creates the strict tree structure.

How Data is Organized and Accessed

Data flows down the tree from the root. To access data, you typically navigate down the hierarchy starting from the root node and following the parent-child links.

Consider a simple example like a company's structure:

Level Node Type Relationship
Top Company Root
Level 1 Department Child of Company
Level 2 Employee Child of Department
  • The Company is the root.
  • Departments (e.g., Sales, HR) are child nodes of the Company. Each Department has only one parent (the Company).
  • Employees are child nodes of a specific Department. Each Employee belongs to only one Department.

This structure means you can easily find all employees in a specific department by starting at the Company root, navigating to the desired Department node (parent), and then accessing its Employee nodes (children).

Key Characteristics

  • Tree Structure: Data is arranged in a strict one-to-many relationship flowing downwards.
  • Single Parent: Every child node has exactly one parent node, except for the root node which has no parent.
  • Navigation: Data access involves traversing paths from the root to the desired nodes.

In essence, the hierarchical model establishes a clear, top-down relationship between data elements, making it straightforward to represent data with inherent parent-child dependencies.

Related Articles