0% found this document useful (0 votes)
7 views

Lecture05 IDB

Uploaded by

mahfuzarnab21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Lecture05 IDB

Uploaded by

mahfuzarnab21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Entity-Relationship Model:

PART 01
Course Code: CSC 2108 Course Title: Introduction To Database

Department of Computer Science


Faculty of Science and Technology

Lecture No: 05 Week No: 03 Semester: Summer 23-24


Lecturer: MD FARUK ABDULLAH AL SOHAN; [email protected]
Lecture Outline

ER Diagram
Alternative ER Notation
Participation
Cardinality Limits
Keys
Weak Entity Set
Generalization
Specialization
Aggregation
ER Diagram
Notation
 Rectangles represent entity sets.
 Diamonds represent relationship
sets.
 Lines link attributes to entity sets
and entity sets to relationship
sets.
 Ellipses represent attributes
 Double ellipses represent
multivalued attributes.
 Dashed ellipses denote
derived attributes.
 Underline indicates primary key
attributes
ER Diagram
Entity Sets

• A database can be modeled as a collection of entities or


relationship among entities.
• An entity is an object that exists and is distinguishable from
other objects. Example: specific person, company, event
etc.
• Entities have attributes. Example: people have names and
addresses
• An entity set is a set of entities of the same type that share
the same properties. Example: set of all persons,
companies, trees, holidays
ER Diagram
Attributes

• An entity is represented by a set of attributes, that is


descriptive properties possessed by all members of an entity
set.
Entity Attributes
customer customer-id, customer-name,
customer-street, customer-city

loan loan-number, amount

• Domain is the set of permitted values for each attribute


ER Diagram
Attribute Types

Simple and composite attributes.

• Single-valued and multi-valued


attributes. E.g. multi-valued
attribute: phone-numbers

• Derived attributes can be


computed from other attributes
E.g. age, given date of birth
ER Diagram
Composite, Multivalued and Derived
ER Diagram
Relationship Sets

• A relationship is an association among several entities


Example:
Entity Relationship Entity
Sam Deposit A_102

• A relationship set is a mathematical relation among n  2


entities
• An attribute can also be property of a relationship set.
ER Diagram
Relationship Sets with Attributes
ER Diagram
Roles

• Entity sets of a relationship need


not be distinct
• The labels “manager” and
“worker” are called roles; they
specify how employee entities
interact via the works-for
relationship set.
• Roles are indicated in E-R diagrams
by labeling the lines that connect
diamonds to rectangles.
• Role labels are optional, and are
used to clarify semantics of the
relationship
ER Diagram
Degree of a Relationship Set

• Refers to number of entity sets that participate in a relationship


set.
• Relationship sets that involve two entity sets are binary (or
degree two). Generally, most relationship sets in a database
system are binary.
• Relationship sets may involve more than two entity sets.
• Relationships between more than two entity sets are rare. Most
relationships are binary.
ER Diagram
Ternary Relationship
ER Diagram
Mapping Cardinality

• Express the number of entities to which another entity can be associated


via a relationship set.
• Most useful in describing binary relationship sets.
• Mapping Cardinalities affect ER Design
• We express cardinality constraints by drawing either a directed line (),
signifying “one,” or an undirected line (—), signifying “many,” between
the relationship set and the entity set.
• For a binary relationship set the mapping cardinality must be one of the
following types:
 One to one
 One to many
 Many to one
 Many to many
ER Diagram
One-to-One Relationship
ER Diagram
One-to-Many Relationship
ER Diagram
Many-to-One Relationship
ER Diagram
Many-to-Many Relationship
Alternate ER Notation
Participation
 Total participation
 Partial participation
Cardinality Limits
Keys

• A super key of an entity set is a set of one or more attributes whose values
uniquely determine each entity.
• A candidate key of an entity set is a minimal super key
• Although several candidate keys may exist, one of the candidate keys is
selected to be the primary key.
• Every candidate key is a super key but, every super key may or may not be
a candidate key.
• Foreign Key of the entity attribute is the entity which is the primary key of
the related entity. Foreign key helps to establish the mapping between two
or more entities.
Weak Entity Sets

• An entity set that does not have a primary key is referred to as a weak
entity set.
• The existence of a weak entity set depends on the existence of a
identifying entity set
 It must relate to the identifying entity set via a total; one-to-many
relationship set from the identifying to the weak entity set
 Identifying relationship depicted using a double diamond
• The discriminator (or partial key) of a weak entity set is the set of
attributes that distinguishes among all the entities of a weak entity set.
• The primary key of a weak entity set is formed by the primary key of the
strong entity set on which the weak entity set is existence dependent,
plus the weak entity set’s discriminator.
Weak Entity Sets

• We depict a weak entity set by


double rectangles.
• We underline the
discriminator of a weak entity
set with a dashed line.
• payment-number –
discriminator of the payment
entity set
• Primary key for payment –
(loan-number, payment-
number)
Generalization and Specialization
Aggregation
Books

1. Modern Database Management (Sixth Edition) by Fred R. McFadden, Jeffrey A.


Hoffer, Mary B. Prescott
2. Database System Concepts (Fifth Edition) by Henry F. Korth, S. Sudarshan, A.
Silberschatz
3. Oracle-database-10g-sql-fundamentals-1-student-guide-volume-1
4. SQL and Relational Theory: How to Write Accurate SQL Code by C.J. Date
5. Database Systems: A Practical Approach to Design, Implementation and
Management (4th Edition) by Thomas M. Connolly, Carolyn E. Begg
6. Fundamentals of Database Systems, 5th Edition by RamezElmasri, Shamkant B.
Navathe
7. Database Design and Relational Theory: Normal Forms and All That Jazz by C. J. Date
8. An Introduction to Database Systems 8th Edition, by C.J. Date
References

1. https://www.db-book.com/db6/slide-dir/index.html
2. https://docs.oracle.com/en/database/oracle/oracle-database/20/sqlrf/SQL-Sta
ndards.html#GUID-BCCCFF75-D2A4-43AD-8CAF-C3C97D92AC63
3. https://www.slideshare.net/HaaMeemMohiyuddin1/data-knowledge-and-infor
mation
4. https://www.slideshare.net/tabinhasan/from-data-to-wisdom
5. https://www.slideshare.net/thinnaphat.bo/

You might also like