A hierarchical database is a database based on a tree structure. By the principle of construction, it is somewhat similar to the file system of a computer. The use of such a model has its advantages and disadvantages, which will be discussed in this article, along with detailed examples.
Types of databases
As you know, there are four types of database construction:
- Relational - tabular DBMS, where the information is presented in the form of row-columns. According to this principle, databases are built in "Access", for example.
- Object-oriented - are closely related to OOP (programming, in which work with objects is carried out), and this is their main plus, but, given their small performance, they are still significantly inferior to relational in prevalence.
- Hybrid - DBMS, containing just two of the above types.
- Hierarchical - the object of attention of this article. This is a database characterized by a tree structure.
The most famous example of a hierarchical database is a product created by IBM ("IBM"), called Information Management System (translated as "Information Management System"), abbreviated IMS. The first version of IMS was released in the last, twentieth century, in the sixty-eighth year. It is used to store and control data to this day.
The principle of building a hierarchical model
The hierarchical data model is built on the following principle:
- for each node of the tree structure, a segment is mapped;
- a segment refers to data fields with a name assigned to each field and arranged in one linear tuple;
- one more correspondence: one input and several output segments for each source field;
- for each structural element there is one and only one place in the hierarchy system;
- the tree structure begins with the root element;
- each subordinate node has only one ancestor, but each source can have several descendants.
Applying a hierarchical data structure
A hierarchical database is a repository applicable to those systems that initially have a tree structure. For them, choosing a similar simulation is logical.
An example of a hierarchical database with initially systematized degrees is a military unit in which, as you know, the ranks are clearly defined. It can also be complex mechanisms, consisting of increasingly simplified particles to the bottom of the hierarchy. To model such systems and bring them to the form of the database in question, there is no need for decomposition. Nevertheless, this situation does not always develop.
In addition, there is a trend in which a downward-directed query is simpler than a similar upward query.
Basic operations on a database built on a hierarchical model
The hierarchical database structure allows you to successfully and almost seamlessly (depending on skills and abilities) perform the following operations (the most basic ones are presented, the list can always be expanded with small additions):
- search the database of an element;
- Database navigation - from tree to tree;
- transition on a tree - from branch to branch;
- accordingly, branching is element-wise;
- work with records: insert a new one and / or delete the current one, copy, cut, etc.
Generalized structure description
The term "tree-like" to describe the structure is mentioned in this article more than once. It's time to tell where it came from. That's because a hierarchical database is such a database that uses the data tree type. Let us consider in more detail what it is.
This is a composite type: several of them (one or more) are embedded in each of the elements (nodes). And it all starts with one root element. The bottom line is that each of the pieces of the "tree" type is a subtype, also a "tree". Many, many branched, and all also ordered structures.
Elementary types can be simple and compound, but essentially they are always records. But in a simple record there is one type of data, and in a composite record there is a whole set of them.
The hierarchical model is characterized by the principle of descendants, when each previous segment is the ancestor of the next. In addition, the descendant in relation to the higher type is a subordinate type, while equivalent records to one another are considered twins.
DB filling
The main data of a hierarchical database are values ββ(numbers or characters) that are stored in records. Such a database is usually bypassed from bottom to top and from left to right.
Advantages
A hierarchical database is a database with a root folder that gradually branches down. Given that such a structure is very similar to the file system, such databases are successfully used to perform various operations on computer data. Bottom line: the rational distribution of her memory, as well as very decent indicators of the time spent on work.
The hierarchical model is ideal for applying it to ordered information.
disadvantages
However, the same features of the DBMS under consideration, which have become their main advantages, also determine their disadvantages. For example, the cumbersomeness and complexity of logical connections - it will be difficult for an experienced specialist to work with a previously unknown database, and a simple user will βget lostβ in it at all. This complexity of understanding leads to the fact that in reality not many DBMSs are built on a hierarchical model. An example of a hierarchical database is, in addition to the product already described by IBM, Oka and MIRIS (manufactured in Russia), as well as Data Edge and Team-UP (from foreign corporations).
Examples
A hierarchical database is a variety of different levels on which relationships are built. Schematically, it looks like an inverted graph. An example of a hierarchical database is any public administration institution. Take, say, a school.
At the highest level will be located the "leader" of the administration - the director. The head teachers are subordinate to him, the head teachers have teachers who lead class parallels. In each parallel there is a certain number of them, and in each class there is a certain number of students.
By the same principle, you can paint the management of a corporation. The head of the company or even the board of directors at the top. Next - an increasing number of units, each of which has its own structure. There are common features: the head in each department, his assistant, his secretary, in fact, office employees and so on.
Computer application
There may be more serious applications. A striking example of a hierarchical database is the file system. The familiar Explorer is built in the very core of the Windows operating system in exactly this way, just like many other file managers.
Network Databases
Exist:
- relational
- hierarchical;
- network databases.
Why did we recall the classification again? Since, unlike relational, a network database has similar features with a hierarchical one.
Time to remember the types of relationships in databases. There are one-to-one, one-to-many, and many-to-many relationships. We are interested in the latter. In a network database, it manifests itself as follows: a single heir can have several ancestors at once. The property of having multiple descendants is also preserved. We can say that hierarchical databases, network databases in themselves are already an example of such inheritance. The ancestor in this case is precisely the hierarchical database, since the principle of constructing the structure in network databases remains the same.
Hierarchy and relational
The name "relational" comes from the English word "relation". As mentioned at the beginning of the article, they are often expressed in tabular form. But in the previous paragraph, we pointed out that a hierarchical database can also organize communications, does this mean that there is also a thin thread connecting these two types?
Yes. In addition to the fact that both the first and second types are still related to databases, there is one more common property besides this feature. For example, a hierarchical database (and a network along with it) can be expressed in a table. The point here is not how to present the information to the end user (this is already a matter of interface usability), but by what principle the information was structured. Thus, a clear division into departments with their superiors, departments and others will still be expressed in a hierarchy, but for convenience it is listed in the table.