Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
A record in the hierarchical database model corresponds to a row (or tuple) in the relational database
model and an entity type corresponds to a table (or relation).
The hierarchical database model mandates that each child record has only one parent, whereas each
parent record can have one or more child records. In order to retrieve data from a hierarchical database
the whole tree needs to be traversed starting from the root node. This model is recognized as the first
database model created by IBM in the 1960s.
First Name
Last Name
Dept. Num
Serial Num
Type
User EmpNo
100
Ram
Prathap
10-L
3009734-4
Computer
100
101
Ravi
Kumar
10-L
3-23-283742
Monitor
100
102
Ramesh
Naidu
20-B
2-22-723423
Monitor
100
103
sarath
yadav
20-B
232342
Printer
100
In this model, the employee data table represents the "parent" part of the hierarchy, while the computer
table represents the "child" part of the hierarchy. In contrast to tree structures usually found in computer
software algorithms, in this model the children point to the parents. As shown, each employee may
possess several pieces of computer equipment, but each individual piece of computer equipment may
have only one employee owner.
Designation
ReportsTo
10
Director
20
Senior Manager
10
30
Typist
20
40
Programmer
20
In this, the "child" is the same type as the "parent". The hierarchy stating EmpNo 10 is boss of 20, and 30
and 40 each report to 20 is represented by the "ReportsTo" column. In Relational database terms, the
ReportsTo column is a foreign keyreferencing the EmpNo column. If the "child" data type were different, it
would be in a different table, but there would still be a foreign key referencing the EmpNo column of the
employees table.
This simple model is commonly known as the adjacency list model, and was introduced by Dr. Edgar F.
Codd after initial criticisms surfaced that the relational model could not model hierarchical data.
The Windows Registry is a hierarchical database that stores configuration settings and options on
Microsoft Windows operating systems.
the many (zero or more) employees who work in that department. An occurrence of
the (DEPARTMENT, PROJECT) PCR type relates a department record to the records of
projects controlled by that department. Figure D.2 shows two PCR occurrences (or
instances) for each of these two PCR types.
DEPARTMENT
DNUMBER
MGRNAME
DNAME
NAME
EMPLOYEE
SSN
BDATE
ADDR
ESS
MGRSTARTDAT
E
PNAM
E
PROJECT
PNUMB PLOCATI
ER
ON
Fig D1
(a)DEPARTMENT:
EMPLOYEE:
(b)DEPARTMENT:
PROJECT:
Newbenefits
Research
Administration
Computerization
5.4. A record type that does not participate as parent record type in any PCR type is
called a leaf of the hierarchical schema. If a record type participates as parent in
more than one PCR type, then its child record types are ordered. The order is
displayed, by convention, from left to right in a hierarchical diagram.
The definition of a hierarchical schema defines a tree data structure. In the
terminology of tree data structures, a record type corresponds to a node of the tree,
and a PCR type corresponds to an edge (or arc) of the tree. We use the terms node
and record type, and edge and PCR type, interchangeably. The usual convention of
displaying a tree is slightly different from that used in hierarchical diagrams, in that
each tree edge is shown separately from other edges (Figure D.3).
DEPARTMENT
EMPLOYEE
FIG D3
Figure D.1.)
PROJECT
In hierarchical diagrams the convention is that all edges emanating from the same
parent node are joined together (as in Figure D.1). We use this latter hierarchical
diagram convention.
The preceding properties of a hierarchical schema mean that every node except
the root has exactly one parent node. However, a node can have several child
nodes, and in this case they are ordered from left to right. In Figure D.1 EMPLOYEE is
the first child of DEPARTMENT, and PROJECT is the second child. The previously
identified properties also limit the types of relationships that can be represented in
a hierarchical schema. In particular, M:N relationships between record types cannot
be directly represented, because parent-child relationships are 1:N relationships,
and a record type cannot participate as child in two or more distinct parent-child
relationships.
An M:N relationship may be handled in the hierarchical model by allowing
duplication of child record instances. For example, consider an M:N relationship
between EMPLOYEE and PROJECT, where a project can have several employees
working on it, and an employee can work on several projects. We can represent the
relationship as a (PROJECT, EMPLOYEE) PCR type. In this case a record describing
the same employee can be duplicated by appearing once under each project that
the employee works for. Alternatively, we can represent the relationship as an
(EMPLOYEE, PROJECT) PCR type, in which case project records may be duplicated.
EXAMPLE 1: Consider the following instances of the EMPLOYEE:
Project
A
B
C
D
E2, E4, E6
E1, E4
E2, E3, E4, E5
If these instances are stored using the hierarchical schema (PROJECT, EMPLOYEE)
(with PROJECT as the parent), there will be four occurrences of the (PROJECT,
EMPLOYEE) PCR typeone for each project. The employee records for E1, E2, E3,
and E5 will appear twice each as child records, however, because each of these
employees works on two projects. The employee record for E4 will appear three
timesonce under each of projects B, C, and D and may have number of hours that
E4 works on each project in the corresponding instance. To avoid such duplication, a
technique is used whereby several hierarchical schemas can be specified in the
same hierarchical database schema. Relationships like the preceding PCR type can
now be defined across different hierarchical schemas. This technique, called virtual
relationships, causes a departure from the strict hierarchical model.
Network Model
The popularity of the network data model coincided with the popularity of the
hierarchical data model. Some data were more naturally modeled with more than
one parent per child. So, the network model permitted the modeling of many-tomany relationships in data. In 1971, the Conference on Data Systems Languages
(CODASYL) formally defined the network model. The basic data modeling construct
in the network model is the set construct. A set consists of an owner record type, a
set name, and a member record type. A member record type can have that role in
more than one set, hence the multiparent concept is supported. An owner record
type can also be a member or owner in another set. The data model is a simple
network, and link and intersection record types (called junction records by IDMS)
may exist, as well as sets between them .
Relational Model
(RDBMS - relational database management system) A database based on the
relational model developed by E.F. Codd. A relational database allows the definition
of data structures, storage and retrieval operations and integrity constraints. In such
a database the data and relations between them are organised in tables. A table is a
collection of records and each record in a table contains the same fields.
Properties of Relational Tables:
Values Are Atomic
Each Row is Unique
Column Values Are of the Same Kind
The Sequence of Columns is Insignificant
3. A child record having two or more parent records of different record types can do
so only by having at most one real parent, with all the others represented as virtual
parents. IMS limits the number of virtual parents to one.
4. In IMS, a record type can be the virtual parent in only one VPCR type. That is, the
number of virtual children can be only one per record type in IMS.
RECORD UPDATE
INSERT
DELETE
REPLACE
CURRENCY RETENTION
GET HOLD