0% found this document useful (0 votes)
39 views30 pages

Entity Relationship Model

The document discusses the basic concepts of entity relationship modeling including entities, attributes, relationships, keys, and entity relationship diagrams. It defines entities as real-world objects with attributes and relationships as associations between entities. The key concepts are represented graphically in ER diagrams using standard notations.

Uploaded by

CHANDRA BHUSHAN
Copyright
© Attribution Non-Commercial (BY-NC)
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)
39 views30 pages

Entity Relationship Model

The document discusses the basic concepts of entity relationship modeling including entities, attributes, relationships, keys, and entity relationship diagrams. It defines entities as real-world objects with attributes and relationships as associations between entities. The key concepts are represented graphically in ER diagrams using standard notations.

Uploaded by

CHANDRA BHUSHAN
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 30

Entity Relationship Model

Basic Concepts:
Database Modeling: A database can be modeled as a collection of entities and relationship among entities. Entity Relationship Model: The entity-relationship model (or ER model) is a way of graphically representing the logical relationships of entities (or objects) in order to create a database. The ER model was first proposed by Peter Pin-Shan Chen in the 1970s.

Entities:
In general, an entity is an existing or real thing. It is a thing or object in the real world that is distinguishable from all other objects. These are the people, places, things, events and concepts of interest to an organization. An entity has a set of properties and the values for some set of properties may uniquely identify an entity. Entities represent collections of things. For example, an EMPLOYEE entity might represent a collection of all the employees that work for an organization. Individual members (employees) of the collection are called occurrences of the EMPLOYEE entity.

Attributes: An entity is represented by a set of attributes, that is descriptive properties possessed by all members of an entity set. Attributes are the properties that are used to describe an entity. Example an EMPLOYEE entity may have a Name, SSN, Address, Sex, BirthDate. A specific entity will have a value for each of its attributes. Example a specific employee entity may have Name='John Smith', SSN='123456789', Address='731 Fondren, Houston, TX', Sex='M', BirthDate='09-JAN-55'.

Types of Attributes: 1. Simple Attributes: Each entity has a single atomic value for the attribute; for example SSN or Sex. 2. Composite: Composite attributes are the attributes that are composed of several components; for example Address (Apt, House, Street, City, State, ZipCode, Country) or Name (FirstName, MiddleName, LastName).

3. Multi-valued: An entity may have multiple values for that attribute. Example Color of a CAR or PreviousDegrees of a STUDENT. Denoted as {Color} or {PreviousDegrees}. 4. Single Values Attributes: Attributes having single value for a particular entity are called as single valued attributes. Example, Age is a single value for a particular entity Person.

5. Stored Attributes: An attribute whose value is actually stored in a database is called as a stored attribute. 6. Derived Attributes: In some cases two or more attribute values are related. Example the age and Birthdate attributes of a person. For a particular person entity, the value of Age can be determined from the current date and the value of that persons Birthdate. The Age attribute is hence called as derived attribute. Domain: Domain is the set of permitted values for each attribute.

Entity Sets customer and loan


Customer Customer Customer ID name street customer City Loan number Amount

Relationship: A relationship relates two or more distinct entities with a specific meaning. It is an association among several entities. Example:
Hayes Customer entity depositor relationship set A102 Account entity

Relationship Set: A relationship set is a mathematical relation among n >= 2 entities, each taken from entity sets.
{(e1, e2, en) | e1 E1, e2 E2, , en En}

where (e1, e2, , en) is a relationship Example: (Hayes, A102) depositor

Relationship Set borrower:

An attribute can also be property of a relationship set. For instance, the depositor relationship set between entity sets customer and account may have the attribute access_date.

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. Example: Suppose employees of a bank may have jobs (responsibilities) at multiple branches, with different jobs at different branches. Then there is a ternary relationship set between entity sets employee, job, and branch.

Mapping Cardinalities:
The cardinality ratio for a binary relationship specifies the number of relationship instances that an entity can participate in. Note: Some elements in A and B may not be mapped to any elements in the other set One to One One to Many

Many to One

Many to Many

Keys: Super Key: A super key of an entity set is a set of one or more attributes whose values uniquely determine each entity. Candidate Key: A candidate key of an entity set is a minimal super key E.g. Customer_id is candidate key of customer and account_number is candidate key of account. Primary Key: Although several candidate keys may exist, one of the candidate keys is selected to be the primary key. Primary key is an attribute which uniquely identifies each entity in an entity set.

Keys for Relationship Sets: The combination of primary keys of the participating entity sets forms a super key of a relationship set. (customer_id, account_number) is the super key of depositor. NOTE: This means a pair of entity sets can have at most one relationship in a particular relationship set.

E-R Diagram Notations:

ER Diagram With Composite, Multivalued, and Derived Attributes:

Relationship Sets with Attributes:

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 ER diagrams by labeling the lines that connect diamonds to rectangles. Role labels are optional, and are used to clarify semantics of the relationship.

Cardinality Constraints: Cardinality constraints are expressed by drawing either a directed line ( )signifying one, or an undirected line (), signifying many, between the relationship set and the entity set. One to one relationship: A customer is associated with at most one loan via the relationship borrower. A loan is associated with at most one customer via borrower.

One To Many Relationship: In the one to many relationship a loan is associated with at most one customer via borrower, a customer is associated with several (including 0) loans via borrower. Many To One Relationships: In a many to one relationship a loan is associated with several (including 0) customers via borrower, a customer is associated with at most one loan via borrower Many To Many Relationship: A customer is associated with several (possibly 0) loans via Borrower, A loan is associated with several (possibly 0) customers via borrower.

Relationship Set: Total participation is indicated by double line: every entity in the entity set participates in at least one relationship in the relationship set. E.g. participation of loan in borrower is total. Every loan must have a customer associated to it via borrower. Partial participation: Some entities may not participate in any relationship in the relationship set. Example: participation of customer in borrower is partial.

ER Diagram with a Ternary Relationship:

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 is 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 sets 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).

You might also like