Date post: | 14-Dec-2015 |
Category: |
Documents |
Upload: | maverick-manson |
View: | 228 times |
Download: | 0 times |
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 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 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)
Sup-no# Sup-Name Status City
S1
S2
S3
Britannia
New
Cockg
10
30
10
Delhi
Mumbai
Delhi
Suppliers
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
Items
Sup-no# Item-no# Qty
S1
S1
S1
S2
S2
S3
I2
I3
I6
I4
I5
I1
10
20
20
20
10
10
Quantities
•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
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
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.
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.