Unit 2
Unit 2
Unit 2
Implementation
Unit 2
Database Models and Implementation: Part I
Objectives
• Data Models are used to show how data is stored, connected, accessed and updated in the database
management system
• We use a set of symbols and text to represent the information so that members of the organization
can communicate and understand it.
• there are many data models being used nowadays but the Relational model is the most widely used
model
Types of Data Model
• Tuples: Each row in the table is called tuple. A row contains all the information about any instance of
the object. In the above example, each row has all the information about any specific individual like the
first row has information about John.
• Attribute or field: Attributes are the property which defines the table or relation. The values of the
attribute should be from the same domain. In the above example, we have different attributes of the
employee like Salary, Mobile_no, etc.
Advantages of Relational Model
• Simple: This model is more simple as compared to the network and hierarchical model.
• Scalable: This model can be easily scaled as we can add as many rows and columns we want.
• Structural Independence: We can make changes in database structure without changing the way to
access the data. When we can make changes to the database structure without affecting the capability
to DBMS to access the data we can say that structural independence has been achieved.
Disadvantages of Relational Model
• Hardware Overheads: For hiding the complexities and making things easier for the user this model
requires more powerful hardware computers and data storage devices.
• Bad Design: As the relational model is very easy to design and use. So the users don't need to know
how the data is stored in order to access it. This ease of design can lead to the development of a poor
database which would slow down if the database grows.
• But all these disadvantages are minor as compared to the advantages of the relational model. These
problems can be avoided with the help of proper implementation and organization.
Hierarchical Model
Hierarchical Model
• Hierarchical Model was the first DBMS model.
• The hierarchy starts from the root which has root data and then it expands in the form of a tree adding
child node to the parent node.
• This model easily represents some of the real-world relationships like food recipes, sitemap of a
website etc.
• Example: We can represent the relationship between the shoes present on a shopping website in the
following way:
Example
Features of a Hierarchical Model
• One-to-many relationship: The data here is organized in a tree-like structure where the one-to-many
relationship is between the data types. Also, there can be only one path from parent to any node.
Example: In the above example, if we want to go to the node sneakers we only have one path to
reach there i.e through men's shoes node.
• Parent-Child Relationship: Each child node has a parent node but a parent node can have more than
one child node. Multiple parents are not allowed.
• Deletion Problem: If a parent node is deleted then the child node is automatically deleted.
• Pointers: Pointers are used to link the parent node with the child node and are used to navigate
between the stored data. Example: In the above example the 'shoes' node points to the two other
nodes 'women shoes' node and 'men's shoes' node.
Advantages of Hierarchical Model
• Any change in the parent node is automatically reflected in the child node so, the integrity of data is
maintained.
Disadvantages of Hierarchical Model
• Complex relationships are not supported.
• As it does not support more than one parent of the child node so if we have some complex relationship
where a child node needs to have two parent node then that can't be represented using this model.
• This model is the same as the hierarchical model, the only difference is that a record can have more
than one parent.
• Example: In the example below we can see that node student has two parents i.e. CSE Department
and Library. This was earlier not possible in the hierarchical model.
Example
Features of a Network Model
• Ability to Merge more Relationships: In this model, as there are more relationships so data is more
related. This model has the ability to manage one-to-one relationships as well as many-to-many
relationships.
• Many paths: As there are more relationships so there can be more than one path to the same record.
This makes data access fast and simple.
• Circular Linked List: The operations on the network model are done with the help of the circular
linked list. The current position is maintained with the help of a program and this position navigates
through the records according to the relationship
Advantages of Network Model
• The data can be accessed faster as compared to the hierarchical model. This is because the data is
more related in the network model and there can be more than one path to reach a particular node. So
the data can be accessed in many ways.
• As there is a parent-child relationship so data integrity is present. Any change in parent record is
reflected in the child record
Disadvantages of Network Model
• As more and more relationships need to be handled the system might get complex. So, a user must be
having detailed knowledge of the model to work with the model.
• In this model, both the data and relationship are present in a single structure known as an object.
• We can store audio, video, images, etc in the database which was not possible in the relational model
• In this model, two or more objects are connected through links. We use this link to relate one object to
other objects.
Example
Explanation
• In the example, we have two objects Employee and Department.
• All the data and relationships of each object are contained as a single unit
• The attributes like Name, Job_title of the employee and the methods which will be performed by that
object are stored as a single object.
• The two objects are connected through a common attribute i.e the Department_id
• The communication between these two will be done with the help of this common id.
Object – Relational Model
Object – Relational Model
• An Object relational model is a combination of a Object oriented database model and a Relational
database model.
• So, it supports objects, classes, inheritance etc. just like Object Oriented models and has support for
data types, tabular structures etc. like Relational data model.
• One of the major goals of Object relational data model is to close the gap between relational databases
and the object oriented practices frequently used in many programming languages such as C++, C#,
Java etc.
Advantages of Object Relational model
• Inheritance
• The Object Relational data model allows its users to inherit objects, tables etc. so that they can
extend their functionality. Inherited objects contains new attributes as well as the attributes that
were inherited.
Cont…
• Complex data types can be formed using existing data types. This is useful in Object relational data
model as complex data types allow better manipulation of the data.
• Extensibility
• The functionality of the system can be extended in Object relational data model. This can be achieved
using complex data types as well as advanced concepts of object oriented model such as inheritance.
Disadvantage of Object Relational model
• The object relational data model can get quite complicated and difficult to handle at times as it is a
combination of the Object oriented data model and Relational data model and utilizes the functionalities of
both of them.
Summary
• Hierarchical Model
• Object/Relational Model
• Object-Oriented Model
Thank You!