# The Hierarchical Model

## Presentation on theme: "The Hierarchical Model"— Presentation transcript:

The Hierarchical Model
Developed in the 1960s to manage large amounts of data for complex projects Basic logical structure is represented by an upside-down “tree”

Hierarchical database model
In the hierarchical model, data is organized as an inverted tree. Each entity has only one parent but can have several children. At the top of the hierarchy, there is one entity, which is called the root. An example of the hierarchical model representing a university

The Hierarchical Model (continued)

The Hierarchical Model (continued)
The hierarchical structure contains levels, or segments Depicts a set of one-to-many (1:M) relationships between a parent and its children segments Each parent can have many children each child has only one parent

Hierarchical model Data are organized as an upside down tree.
Each entity has only one parent but can have several children.

The Hierarchical Model (continued)
Disadvantages Complex to implement Difficult to manage Lacks structural independence Implementation limitations Lack of standards

Network database model
In the network model, the entities are organized in a graph, in which some entities can be accessed through several path An example of the network model representing a university

The Network Data Model In this model, data is represented by collections of records and relationships among data are represented by links. Ie., the collection of records which are connected to one another by means of links. A record is a collection of fields (attributes), each of which contains only one data value. A link is an association between precisely two records. The structure of the database is shown as an arbitrary graph in which the records form the nodes and links form the edges. There is no concept of a root node.

The operations on a network database are performed through a data manipulation language for network model. The operations that can be performed on a network database include find, insert, delete, modify etc. The inserting or removing records include connect, disconnect and reconnect operations.

RELATIONAL MODEL

Relational model Data are organized in two-dimensional tables called relations. The tables are related to each other. The most popular model.

The Relational Data Model
In this model,the data is organized into tables (ie., rows and columns). These tables are called relations. A row in a table represents a relationship among a set of values. Consider a sample database with three tables (relations):Suppliers, Items, Quantities:   Suppliers (sup-no#,sup-name,status, city) Items ( item-no#, item-name, price) Quantities (sup-no#, item-no#, Qty)

Suppliers Items Quantities Sup-no# Sup-Name Status City S1 S2 S3
Britannia New Cockg 10 30 Delhi Mumbai Items Item-no# Item-name Price I1 I2 I3 I4 I5 I6 Milk Cake Bread Biscuit Ice cream Jam 15.00 5.00 9.00 14.00 6.00 10.00 Quantities Sup-no# Item-no# Qty S1 S2 S3 I2 I3 I6 I4 I5 I1 10 20

Rows of relations are generally referred to as tuples and the columns are usually referred to as attributes. No two tuples are identical and their ordering is not important. A relationship is represented by combining the primary key of the relations. various operations can be performed on relations such as insert new tuples, delete tuples and modify tuples. There are several languages for expressing these operations. One such language is relational query language.

Relational model RDBMS (Relational Database Management System)
external view The data are represented as a set of relations. A relation is a two-dimensional table. This doesn’t mean that data are stored as tables; the physical storage of the data is independent of the way the data are logically organized.

Relation Name – each relation in a relational database should have a name that is unique among other relations. Attribute – each column in a relation. The degree of the relation – the total number of attributes for a relation. Tuple – each row in a relation. The cardinality of the relation – the total number of rows in a relation.

OPERATIONS ON RELATIONS

Operations on relations
In a relational database, we can define several operations to create new relations out of the existing ones. Basic operations: Insert Delete Update Select Project Join Union Intersection Difference

Insert operation An unary operation.
Insert a new tuple into the relation.

Delete operation An unary operation.
Delete a tuple defined by a criterion from the relation.

Update operation An unary operation.
Changes the value of some attributes of a tuple.

Select operation An unary operation.
It is applied to one single relation and creates another relation. The tuples in the resulting relation are a subset of the tuples in the original relation. Use some criteria to select

Project operation An unary operation.
It is applied to one single relation and creates another relation. The attributes in the resulting relation are a subset of the attributes in the original relation.

Join operation A binary operation.
Combines two relations based on common attributes.

Union operation A binary operation.
Creates a new relation in which each tuple is either in the first relation, in the second, or in both. The two relations must have the same attributes.

Intersection operation
A binary operation. Creates a new relation in which each tuple is a member in both relations. The two relations must have the same attributes.

Difference operation A binary operation.
Creates a new relation in which each tuple is in the first relation but not the second. The two relations must have the same attributes.

Similar presentations