Lecture 5
Lecture 5
Lecture 5
Model
Part-1
Steps in Developing a Database
• Requirements analysis →
• Conceptual Database design →
• Logical Database design →
• Schema refinement →
• Physical Database design
• Applications and security
Conceptual Design
• What are the entities and relationships in the
enterprise?
• What information about these entities and
relationships should we store in the database?
• What are the integrity constraints or business rules
that hold?
• A database `schema’ in the ER Model can be
represented pictorially (ER diagrams).
• Can map an ER diagram into a relational schema.
Conceptual Design
• What are the entities and relationships in the
enterprise?
• What information about these entities and
relationships should we store in the database?
• What are the integrity constraints or business rules
that hold?
• A database `schema’ in the ER Model can be
represented pictorially (ER diagrams).
• Can map an ER diagram into a relational schema.
What is ER model?
• ER model is used to show the • Perspective
Conceptual schema of an
organisation.
BU Information system
• Independent of specific data model
or DBMS
ERM
Relational
a Logical model (e.g. relational) on Model storage
which the physical database is built
Conceptual Logical Physical
model model model
Logical model
Conceptual model
Physical
model
Notations in Entity Relationship Diagram
ER Model Basics
• The basics of ER modelling ssn
name
address
• Entity
Employee
• Relationship
• Attribute Works_i
n
Departments
did d_name
Entity and Entity Set
Entity type name
• Entity: Real-world object (singular, no spaces,
distinguishable from other objects. An capital letter at start
entity is described using a set of E n tityNa m e of each word)
attributes. Each attribute has a domain.
• Entity Set: A collection of similar space for attributes
entities. E.g., all employees.
• All entities in an entity set have the same
set of attributes. E1
E2 Entity Set
• Each entity set has a key. E3
Attributes
Attributes: Properties associated each entity with a value from a domain of values.
• Simple attribute: Single valued attribute which can not be divided further e.g.,
phone.
• Composite attribute: Made of more than one simple attribute e.g., name, address etc.
• Derived attribute: Values are derived from other attributes present in the database
e.g., age, average salary etc.
• Single-value attribute: Contains single value e.g., SSN, SID etc.
• Multivalued attribute: It may contain more than one values e.g., phone number,
email_ address etc.
Attributes Contd.
Geometric shapes and their meaning:
• Rectangle: Represents Entity sets.
• Ellipses: Attributes
• Diamonds: Relationship Set
• Lines: They link attributes to Entity
Sets and Entity sets to Relationship Set
• Double Ellipses: Multivalued Attributes
• Dashed Ellipses: Derived Attributes Entity type Student with its attributes
Hospital ER Model
Company ER Model
MCQ
• Entity is a _________
• Object of relation
• Present working model
• Thing in real world
• Model of relation
MCQ
• Entity is a _________
• Object of relation
• Present working model
• Thing in real world
• Model of relation
MCQ
• In a relation between the entities, the type and condition of the relation
should be specified. That is called as ______ attribute.
a) Descriptive
b) Derived
c) Recursive
d) Relative
MCQ
• In a relation between the entities the type and condition of the relation
should be specified. That is called as ______ attribute.
a) Descriptive
b) Derived
c) Recursive
d) Relative
MCQ
Relationship: cardinality
participation
• full/mandatory
• or partial/optional
Example:
• Every employee works for exactly one department and a department can
have many employees. employee Worksfor Department
• New department may not have any employee. .
E1 D1
E2 .
D2
E3 .
D3
E4 .
E5 .
E6 .
E7 .
Example:
• Every employee works for exactly one department and a department can
have many employees. employee Worksfor Department
• New department may not have any employee. .
E1 D1
E2 .
D2
DEGREE=2 E3 .
D3
E4 .
E5 .
E6 .
E7 .
Example:
• Every employee works for exactly one department and a department can
have many employees. employee Worksfor Department
• New department may not have any employee. .
E1 D1
E2 .
D2
DEGREE=2 E3 .
D3
CARDINALITY RATIO=MAX (1,N) E4 .
E5 .
E6 .
E7 .
Works for
Example: emp
N 1
dept
1 N
• Every employee works for exactly one department and a department can
have many employees. employee Worksfor Department
• New department may not have any employee. .
E1 D1
E2 .
D2
DEGREE=2 E3 .
D3
CARDINALITY RATIO=MAX (1,N) E4 .
E5 .
E6 .
E7 .
Supervises
Employee Works_In Department
Staff
Binary Relationship
Unary or Recursive
Relationship
Employee Works_In Department
Student
Ternary Location Welfare
Relationshi Project
p
Employee Works_In Department
Location
Project
P&D
Employee Works_In Department
Quaternary N-ary
Relationshi Project Relationshi
Complex Relationship p
p
Cardinality and Ordinality
• Cardinality specifies the number of
times an entity of an entity set
participates in a relationship.
• Ordinality specifies whether a
relationship is either mandatory or
optional.
• Cardinality specifies maximum number
of relationships and ordinality specifies
the absolute minimum number of
relationship
Participation constraints
• Participation Constraint is applied on the entity participating in the relationship
set.
• It specifies the number of instances of an entity that are participating in the
relationship type.
• It is also called the minimum cardinality constraint.
• There are two types of participation constraint:
• Total participation
• Partial participation
Total Participation
• Each entity present in the entity Student
enroll
Course
set must mandatorily participate s
in at least one relationship • It specifies that each student must be
instance of that relationship set enrolled in at least one course where
• It is represented using a double the “student” is the entity set and
line between the entity set and relationship “enrolls” signifies total
participation
relationship set
• It means that every student must have
enrolled at least in one course
Partial Participation
• It specifies that each entity in the enroll
Student Course
entity set may or may not s
participate in the relationship
instance of the relationship set, is • A single line between the entity i.e
also called as optional participation courses and enrolls a relationship
signifies the partial participation,
• It is represented using a single line which means there might be some
between the entity set and courses where enrollments are not
relationship set in the ER diagram made i.e enrollments are optional in
that case
MCQ
• In one to many relationship, the entity that is on the one side of the
relationship is called a(n) ________ entity.
• Parent
• Child
• Instance
• Subtype
MCQ
• In one to many relationship, the entity that is on the one side of the
relationship is called a(n) ________ entity.
• Parent
• Child
• Instance
• Subtype
MCQ
Entities:
1. Book: Attributes - ISBN (Primary Key), Title, Author, Genre
2. Author: Attributes - AuthorID (Primary Key), Name, Birthdate
3. Member: Attributes - MemberID (Primary Key), Name, Address, Email
4. Transaction: Attributes - TransactionID (Primary Key), Date, BookID
(Foreign Key), MemberID (Foreign Key)
References
• http://www.agiledata.org/essays/dataModeling101.html
• https://www.vertabelo.com/blog/chen-erd-notation/
• https://www.guru99.com/dbms-keys.html
• http://www.mathcs.emory.edu/~cheung/Courses/377/Syllabus/2-ER/ER-diagram.html
• https://www.studytonight.com/dbms/
• https://www.youtube.com/watch?v=QpdhBUYk7Kk
• https://www.youtube.com/watch?v=-CuY5ADwn24&t=110s
• https://www.youtube.com/watch?v=XUdNVaSikqY