0% found this document useful (0 votes)
29 views33 pages

FALLSEM2019-20 CSE2004 ETH VL2019201000657 Reference Material I 12-Aug-2019 ENTITY - RELATIONSHIP MODEL

This document describes the entity-relationship (E-R) model for conceptual database design. It defines entity sets, relationship sets, attributes, keys, E-R diagrams, and how to map an E-R schema to tables. Entity sets represent objects, relationship sets define connections between entities, and attributes provide information about entities. The document outlines the components of an E-R diagram and how to represent various modeling constructs like weak entities, generalization, and aggregation. It concludes by explaining the process to convert an E-R schema into relational tables by mapping entities, relationships, and hierarchical structures.

Uploaded by

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

FALLSEM2019-20 CSE2004 ETH VL2019201000657 Reference Material I 12-Aug-2019 ENTITY - RELATIONSHIP MODEL

This document describes the entity-relationship (E-R) model for conceptual database design. It defines entity sets, relationship sets, attributes, keys, E-R diagrams, and how to map an E-R schema to tables. Entity sets represent objects, relationship sets define connections between entities, and attributes provide information about entities. The document outlines the components of an E-R diagram and how to represent various modeling constructs like weak entities, generalization, and aggregation. It concludes by explaining the process to convert an E-R schema into relational tables by mapping entities, relationships, and hierarchical structures.

Uploaded by

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

ENTITY_- RELATIONSHIP

MODEL
Entity Sets
 Relationship Sets
 Design Issues
 Mapping Constraints
 Keys
 E–R Diagram
 Extended E-R Features
 Design of an E-R Database Schema
 Reduction of an E-R Schema to Tables
ENTITY SETS
A database can be modeled as:
– a collection of entities,
– relationships among entities.
An entity is an object that exists and is
distinguishable from other objects.
Example: specific person, company, event, plant
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
ATTRIBUTES
An entity is represented by a set of attributes, that is, descriptive properties
possessed by all members of an entity set.
Example:
Customer = ( customer-name,social-security,customer-street,customer-city)
account= ( account-number,balance)

Domain
– the set of permitted values for each attribute
Attribute types:
–Simple and composite attributes.
–Single-valued and multi-valued attributes.
Null attributes.
Derived attributes.
Existence Dependencies
If the existence of entity x depends on the existence of entity y, then x is said to be
existence dependent on y.

Y is a dominant entity (in example below, loan)–
X is a subordinate entity
(in example below, payment)

If a loan entity is deleted, then all its associated payment entities must be deleted also.
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
– social-security is candidate key of customer
– account-number is candidate key of account
Although several candidate keys may exist, one of the candidate
keys is selected to be the primary key.
The combination of primary keys of the participating entity sets
forms a candidate key of a relationship set.
– must consider the mapping cardinality and the semantics of the
relationship set when selecting the primary key.
– ( social-security, account-number) is the primary key of
depositor
E-R Diagram Components

• Rectangles represent entity sets.


• Ellipses represent attributes.
• Diamonds represent relationship sets.
• Lines link attributes to entity sets and
entity sets to relationship sets.
• Double ellipses represent multivalued
attributes.
• Dashed ellipses denote derived attributes.
• Primary key attributes are underlined.
WEAK ENTITY SET
• 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 strong entity set; it must relate to the strong
set via a one-to-many relationship set.
• 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.
• 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)
SPECIALIZATION
• Top-down design process; we designate
subgroupings within an entity set that are
distinctive from other entitie in the set.
• These subgroupings become lower-level
entity sets that have attributes or
participate in relationships that do not
apply to the higher-level entity set.
• Depicted by a triangle component labeled
ISA (i.e., savings-account “is an” account)
GENERALIZATION
• A bottom-up design process – combine a
number of entity sets that share the same
features into a higher-level entity set
• Specialization and generalization are simple
inversions of each other; they are represented in
an E-R diagram in the same way.
• Attribute Inheritance – a lower-level entity set
inherits all the attributes and relationship
participation of the higher-level entity set to
which it is linked.
AGGREGATION
• Loan customers may be advised by a
loan-officer.
AGGREGATION EXAMPLE
MAPPING ER MODEL TO
A RELATIONAL SCHEMA
Mapping Entity
Mapping Entity - Process
• Create table for each entity.
• Entity's attributes should become fields of
tables with their respective data types.
• Declare primary key.
Mapping Relationship
Mapping Relationship - Process
• Create table for a relationship.
• Add the primary keys of all participating
Entities as fields of table with their respective
data types.
• If relationship has any attribute, add each
attribute as field of table.
• Declare a primary key composing all the
primary keys of participating entities.
• Declare all foreign key constraints.
Mapping Weak Entity
Mapping Weak Entity - Process
• Create table for weak entity set.
• Add all its attributes to table as field.
• Add the primary key of identifying entity
set.
• Declare all foreign key constraints.
Mapping Hierarchical Entities
Mapping Hierarchical Entities -
Process
• Create tables for all higher-level entities.
• Create tables for lower-level entities.
• Add primary keys of higher-level entities in the
table of lower-level entities.
• In lower-level tables, add all other attributes of
lower-level entities.
• Declare primary key of higher-level table and
the primary key for lower-level table.
• Declare foreign key constraints.
CONCLUSION
• Helps in database design
• Models the real world
• Visual representation
• Performed before normalization
• Relationships can be established
depending on the application

You might also like