Data is collected and stored using a database. A database system allows us to keep data and make analysis that results to [[knowledge]]. Hierarchy is the simplest form any database can be presented in. ```plaintext Hierarchical Model Example: Root ├── Department │ ├── Employee │ │ └── Salary │ └── Projects └── Resources ``` Hierarchy is a system where groups of data are ranked by importance or subordination. > [!Example] > In the above hierarchy system, let's assume a school is the root containing multiple data types such as Departments, Resources, Employees and Projects. Now, these things are randomly a part of the school. We use hierarchy to structured them in a way that we which groups are apart of another group. “Heir” meaning rank. This is the basis for all data basing systems. In Department, which is a part of school, there are employees. In employees, which is a part of departments, there is salary. We could also say in salary, there is currency. This system could contain an endless breakdown of data. It is useful this way because we can understand what plays an important role in the system and what does not. This analysis helps us make crucial decisions like cutting down staff and increasing salaries. From hierarchy, we evolve data basing to: ##### - [[DATABASING|Relational]] : ```sql -- Example of relational model CREATE TABLE Employees ( id INTEGER PRIMARY KEY, name VARCHAR(100), department_id INTEGER, FOREIGN KEY (department_id) REFERENCES Departments(id) ); ``` Data is related to each other but in a pre-defined way. Example: the use of a number or word called a key. The key is used as an identity to relate one datum to another. ##### - [[DATABASING|Object - oriented]] : ```typescript // Object-Relational Mapping Example @Entity() class Employee { @PrimaryKey() id: number; @Column() name: string; @ManyToOne() department: Department; } ``` This is a more complex form where data are stored as objects. This means individual data are treated as singular objects that may have a type, identity and other details even if it is a subordinate of another group of data. *So in object-oriented systems, one attributed subordinate can be linked to another subordinate with direct identifiers. This allows a great deal of complexity since it doesn't matter if both data are in different tables or groups.*