0 ratings0% found this document useful (0 votes) 10 views10 pagesData Modeling Technique
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Data Models:
Data Model is the modelling of the data description, data semantics, and consistency
constraints of the data. It provides the conceptual tools for describing the design of a database
at each level of data abstrac
n
* Hierarchical Mode
The Hierarchical Model was the first database management system model. This
concept uses a hierarchical tree structure to organise the data. The hierarchy begins at
the root, which contains root data, and then grows into a tree as child nodes are added
to the parent node. This model accurately depicts several real-world relationships such
as food recipes, website sitemaps, and so on.
Example
The following diagram depicts the relationship between the shoes available on a
shopping webs
Features of a Hierarchical Model
1. Parent-Child Relationship
Apparent node exists for each child node. However, a parent node
might have several child nodes. It is not permitted to have more than one
parent.
2. One-to-many Relationship
The data is organised in a tree-like form, with the datatypes having a
one-to-many relationship. There can only be one path from any node to its
parent. For example, in the preceding example, there is only one way to get to
the node ‘sneakers’, which is through the ‘men’s shoes” node.
3. Deletion Problem
‘When a parent node is removed, the child node is removed as well.
4, Pointers
Pointers are used to connect the parent and child nodes and to traverse
and navigate between the stored data. The ‘shoes’ node in the above example
points to the two additional nodes, ‘women’s shoes” and ‘men’s shoes.”
Advantages / Pros of Hierarchical Model
© Atree-like structure is incredibly straightforward and quick to navigate© Any modification to the parent node is reflected automatically in the child
node, ensuring data integrity
Disadvantages / Cons of Hierarchical Model
© Relationships that are complex are not supported.
© Because it only supports one parent per child node, if we have a complex
relationship in which a child node needs to have two parents, we won't be able
to describe it using this model.
© When a parent node is removed, the child node is removed as well
Network Mod
The hierarchical model is extended in the network model. Prior to the relational
model, it was the most popular model. To increase database performance and
standards, the network model was devised to express complicated data relationships
more effectively than hierarchical models. It has entities that are grouped in a
graphical format, and some of the entities can be reached by many paths.
Example
We can observe that the node student has two parents, CSE Department and Library,
inthe example below-Jn the hierarchical model, this was previously impossible.
CSE Department
Network Model
Features of a Network Model
1. Multiple Paths
There may be several paths to the same record due to the increased number of
relationships. It allows for quick and easy data access.
2. The Ability to Merge More Relationships
Data is more connected in this model since there are more relationships. This
paradigm can handle many-to-many as well as one-to-one relationships.
3. Circular Linked List
The circular linked list is used to perform operations on the network model.
The present position is kept up to date with the help of a software, and it navigates
through the records based on the relationship.Pros of Network Model
© In comparison to the hierarchical model, data can be retrieved faster. This is
because the data in the network model is more related, and there may be more
than one path to a given node. As a result, the data can be accessed in a variety
of ways.
© Data integrity is present since there is a parent-child relationship. Any changes
to the parent record are mirrored in the child record.
Cons of Network Model
© As the number of relationships to be managed grows, the system may get
increasingly complicated. To operate with the model, a user must have a
thorough understanding of it,
© Any alteration, such as an update, deletion, or insertion, is extremely difficult.
Object Oriented Model:
The OODM is a better representation of real-world challenges. Both the data and the
relationship are contained into a single structure that’s known as an object in this
model, We can now store audios, pictures, videos, and other types of data in
databases, which was previously impossible with the relational approach (Although
you can store video and audio in relational DB, itis generally advised not to store
them in the relational DB).
Examples. :, pLETy ver wiie
Here is an example of this model:
Multiple objects are connected in this model using connections. The following
example can help you understand this.‘Atitbutes Attributes
Wethods ethods
‘Object Oriented Model
‘The Employee and Department are the two objects in the example above. Each
object’s data and the relationships are there in a single unit. Here, the attributes of the
employee, such as Name and Job_title, as well as the methods that will be performed
by that object, are all kept in a single object. The two objects are linked by a common
attribute, ie., Department_id, as well as communication between them will be
accomplished by this common id.
Components of an Object-Oriented Data Model
Objects —
An object is an abstraction ofa real-world entity or we can say itis an instance of
class, Objects encapstilates data’and/code into a sitiglé unit Which provide data
abstraction by hiding the implementation details from the user. For example: Instances
of student, doctor, engineer in above figure.
Attribute —
An attribute describes the properties of object. For example: Object is STUDENT and
its attribute are Roll no, Branch, Setmarks() in the Student class.
Methods —
Method represents the behavior of an object. Basically, it represents the real-world
action. For example: Finding a STUDENT marks in above figure as Setmarks().
Class —
Aclass is a collection of similar objects with shared structure i.e. attributes and
behavior ie. methods. An object is an instance of class. For example: Person, Student,
Doctor, Engineer in above figure.
class student
{
char Namef20];
int roll_no;
public:
void search;
void update();}
In this example, students refer to class and $1, S2 are the objects of class which can
be created in main function.
Inheritance —
By using inheritance, new class can inherit the attributes and methods of the old class
i.e., base class. For example: as classes Student, Doctor and Engineer are inherited
from the base class Person,
Advantages of Object-Oriented Data Model:
© Codes can be reused due to inheritance.
© Easily understandable.
© Cost of maintenance can reduce due (o reusability of attributes and functions
because of inheritance.
Disadvantages of Object-Oriented Data Model:
© Itis not properly developed so not accepted by users easily.
E-R Model:
© ER model ands for an Entity-Relationship model. It is a high-level data model.
This model is uscd to define the data elements and relationship for a specified
system,
©. It develops a conceptual design for the database. It also develops a very simple
and easy to design view of data
© InER modeling, the database structure is portrayed as a diagram called an entity-
relationship diagram.
For example, suppose we design a school database. In this database, the student will
be an entity with attributes like address, name, id, age, etc. The address can be another
entity with attributes like city, street name, pin code, ete and there will be a
relationship between them.
(address
studentComponent of ER Diagram
ER Model
|
ae le
1. Entity: Anentity may be'any object, class, person or place: In the ER diagram, an
entity can be represented as rectangles.
Consider an organization as an example- manager, product, employee, department etc.
an be taken as an entity.
or
(ots J department
o
a, Weak Entity
An entity that depends on another entity called a weak entity. The weak entity
doesn't contain any key attribute of its own. The weak entity is represented by
a double rectangle.
Loan Installment
2. Attribute
The attribute is used to describe the property of an entity. Eclipse is used to represent
an attribute,
For example, id, age, contact number, name, ete, can be attributes of a student.
Studenta. Key Attribute
The key attribute is used to represent the main characteristics of an entity. It
represents a primary key. The key attribute is represented by an ellipse with the
text underlined,
from re)
Student
Attribute
An attribute that composed of many other attributes is known as a composite
b. Compe:
attribute, The composite attribute is represented by an ellipse, and those
ellipses are connected with an ellipse.
~
(same)
(exesume ) (napa
¢. Multivalued Attribute
An attribute can have more than dhe value. These attributes are known as a
multivalued attribute. The double oval is used to represent multivalued
attribute,
For example, a student can have more than one phone number.
4. Derived Attribute
An attribute that can be derived from another attribute is known as a derived
attribute. It can be represented by a dashed ellipse.
For example, A person's age changes over time and can be derived from
another attribute like Date of birth.
as, aa
Birth Date)
Coane
WE ~—
Student3. Relationship
A relationship is used to describe the relation between entities. Diamond or rhombus
is used to represent the relationship,
ZN
Teacher
teaches
‘Types of relationship are as follows:
a, One-to-One Relationship
‘Student
‘When only one instance of an entity is associated with the relationship, then
it is known as one-to-one relationship.
For example, A female can marry to one male, and a male can marry to one
female,
Female
(eer >
b. One-to-many relationship
as one-to-many relationship.
done by the only specific scientist.
sett <
¢. Many-to-one relationship
When only one instance of the entity on the left, and
of an entity on the right associates with the relationship then this
1
Male
more than one instance
is known
For example, Scientist can invent many inventions, but the invention is
Invention
When more than one instance of the entity on the left, and only one instance
of an entity on the right associates with the relationship then it is known as
a many-to-one relationship.
For example, Student enrolls for only one course, but a course can have
many students.
student |! —< erat >>
d. Many-to-many relationship
When more than one instance of the entity on the left, and more than one
instance of an entity on the right associates with the relationship then itis known
as a many-to-many relationship.
For example, Employee can assign by many projects and project can have many
employees.
i
Coa
Ww
M
i couse
o>" ProjectHierarchical Model
Network Model
Relational Model
‘One to many or one to one
relationship.
Allowed the network
mode to support many to
many relationships,
‘One to one, one to many,
‘many to one relationship.
Retrieve algorithms are complex
and asymmetric.
Retrieve algorithms are
complex and symmetric.
Retrieve algorithms are
simple and symmetric.
Based on parent child
relationship.
‘Arecord can have many
parents as well as many
children.
Based on relational data
structures,
Doesn't provide an independent
stand-alone query interface.
Conference on data
system language.
Relational databases are
what bring many sources
into a common query such
as SQL.
Cannot insert the information of
a child who does not have any
parent,
Does not suffer fom any
insertion anomaly.
Doesn't suffer fom any
insertion anomaly.
Multiple occurrences of child
records which lead to problems
of inconsistency, during. the
update operation.
Free from update
anomalies.
Free from update anomalies:
Deletion of parent results in
Free from delete
Free from delete anomalies.
deletion of child record. anomalies.
This model lacks data, There is partial data It provides data
independence. independence. independence,
Less flexible. Flexible. Flexible.
Difficult to access data.
Easier to access data,
Easier to access data.
‘Arrange data in a tree-like
structure.
‘Organizes data in graph-
like structure.
‘Arrange data in tables.
The Enhanced Entity-Relationship (EER) model:
EER is a high-level data model that incorporates the extensions to the original ER model.
Enhanced ERD are high level models that represent the requirements and complexities of
complex database,
Specialization and Generalization
Generalization is a process of generalizing an entity which contains generalized attributes or
properties of generalized entities.VEHICLE
CAR TRUCK MOTORCYCLE
It is a Bottom-up process i.e., consider we have 3 sub entities Car, Truck and Motorcycle.
‘Now these three entities can be generalized into one super class named as Vehicle.
Specialization is a process of identifying subsets of an entity that share some different
characteristic. It is a top-down approach in which one entity is broken down into low level
entity.
In above example Vehicle entity can be a Car, Truck or Motorcycle.
Aggregation
Represents relationship between a whole object and its component,
Job
Employee ‘work Branch
SON
MANAGE
s
Manager
Consider a ternary relationship Works_On between Employee, Branch and Manager. Now the
best way to model this situation is to use aggregation, So, the relationship-set, Works_On is a
higher-level entity-set. Such an entity-set is treated in the same manner as any other entity-
set, We can create a binary relationship, Manager, between Works_On and Manager to
represent who manages what tasks.