DBMS_slide_2_Data_Models_PPT
DBMS_slide_2_Data_Models_PPT
MANAGEMEN
T SYSTEMS
Data Models
What is a Data Model?
Data
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Data model basic building blocks
Entity
An entity is anything about which data are to be collected and
Constraints
Data
A constraint is a restriction placed on the data. Constraints are
important
because they help to ensure data integrity.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Relationships
Data
Many to Many (M:N) relationship:
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Hierarchical model
Data
It depicts a set of 1:M relationships between a parent and its children
segments
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Cont…
Data
• If a parent node is deleted then the child node is
automatically deleted.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Network Model
Data
Ms.Rathika.P /AP-CSE
Data
difficult.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Entity-Relationship Model
Data
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
ER (Entity Relationship) Diagram in DBMS
In ER 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, etc and there will be a relationship between them.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Component of ER Diagram
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
1. Entity:
An entity 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. can be taken as an entity.
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.
2. Attribute
3.
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, etc. can be attributes of a student.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
a. 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.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
b. Composite Attribute
An attribute that composed of many other attributes is known as a composite attribute. The composite attribute is represented by an
ellipse, and those ellipses are connected with an ellipse.
c. Multivalued Attribute
An attribute can have more than one 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.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
d. Derived Attribute
An attribute that can be derived from other 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.
3. Relationship
A relationship is used to describe the relation between entities. Diamond or rhombus is used to represent the relationship.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Types of relationship are as follows:
a. One-to-One Relationship
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.
b. One-to-many relationship
When only one instance of the entity on the left, and more than one instance of an entity on the right associates with the relationship then
this is known as a one-to-many relationship.
For example, Scientist can invent many inventions, but the invention is done by the only specific scientist.
c. Many-to-one relationship
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.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
For example, Student enrolls for only one course, but a course can have many students.
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 it is known as a many-to-many relationship.
For example, Employee can assign by many projects and project can have many employees.
https://app.smartdraw.com/editor.aspx?templateId=359473cb-5a63-4fa6-aa39-
https://app.smartdraw.com/editor.aspx?templateId=359473cb-5a63-4fa6-aa39-2ce9909f4c46&flags=128#depoId=63824472&credID=-
74156275 2ce9909f4c46&flags=128#depoId=63824472&credID=-74156275
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Advantages of Entity-Relationship Model
• Simple: Conceptually ER Model is very easy to build. If we know the
relationship between the attributes and the entities we can easily
build the ER Diagram for the model.
Data
• Hidden information: Some information might be lost or hidden in the
ER model. As it is a high-level view so there are chances that some
details of information might be hidden.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Relational Model
The most common model is the Relational Model. The data in this
model is kept in the form of a two-dimensional table. All data is
saved in the form of rows and columns. Tables are the foundation
Data
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Cont…
Data
• 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.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Object-Oriented(OO) Model
• Any object in a hypertext database can link to any other object. It is effective
for organizing a large amount of heterogeneous data, but it is not perfect for
numerical analysis.
Data
OODs are most often used with object-oriented programming languages like Java, Kotlin, C#, Node JS
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
(React), and Swift.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Cont…
Data
problems.
• High system overheads slow transactions.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Object-Relational (OR) Model
Data
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
OO vs OR Data Model
• Object-Oriented database
A database that represents • Object-Relational database
A database that depends on
information in the form of objects Relational data model and Object
Data
is typically incorporated into a • There are data manipulation
programming language such as languages such as SQL, QUEL and
#C++. QBE which are based on
relational calculus.
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University
Semi-structured Model
Data
Dr.
Ms.Rathika.P
Jay Sarraf,/AP-CSE
School of Computer Engineering, KIIT Deemed to be
University