0% found this document useful (0 votes)
20 views18 pages

Entity Relationship Diagram (Er-Diagram) BY Debraj Chatterjee

The document provides an overview of the Entity-Relationship (E-R) model, which is used for database design by defining entities, relationships, and attributes. It explains various types of relationships such as one-to-one, one-to-many, many-to-one, and many-to-many, along with guidelines for creating E-R diagrams. Key constraints for naming entities and attributes are also outlined to ensure clarity and consistency in database representation.

Uploaded by

rishavthakkar02
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)
20 views18 pages

Entity Relationship Diagram (Er-Diagram) BY Debraj Chatterjee

The document provides an overview of the Entity-Relationship (E-R) model, which is used for database design by defining entities, relationships, and attributes. It explains various types of relationships such as one-to-one, one-to-many, many-to-one, and many-to-many, along with guidelines for creating E-R diagrams. Key constraints for naming entities and attributes are also outlined to ensure clarity and consistency in database representation.

Uploaded by

rishavthakkar02
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/ 18

ENTITY RELATIONSHIP DIAGRAM [ER-DIAGRAM]

BY
DEBRAJ CHATTERJEE
E-R Model

The E-R (entity-relationship) data model views the real world as a


set of basic objects (entities) and relationships among these
objects.

It is intended primarily for the DB design process by allowing the


specification of an enterprise scheme. This represents the overall
logical structure of the DB.
KEY CONSTRAINTS
ENTITY

• Has its own identity that distinguishes Entity type name should be:
it from other entities. • A singular noun and in
capital letters.
• Examples:
• Person: PROFESSOR, STUDENT
• Descriptive and specific to
the organization.
• Place: STORE, UNIVERSITY
• Object: MACHINE, BUILDING • Concise.
• Event: SALE, REGISTRATION • Named for the result of the
• Concept: ACCOUNT, COURSE event, not the activity or
process of the event.
EXAMPLES
•One-to-one: An entity in A is associated with at most one entity in B, and
an entity
in B is associated with at most one entity in A.
A man may be married to at most one women, and woman may be
married to at most one man (both men and women can be
unmarried)

since
name name

Is
Men Married Women
to

Is Married to
•One-to-many: An entity in A is associated with any number in B. An
entity in B is
associated with at most one entity in A.
A women may be the mother of many (or no) children. A person
may have at most one mother.

Born on
name name

Is
Women' Low I.Q.
s Club
Mother
of Club

Is mother of
•Many-to-one: An entity in A is associated with at most one entity in B.
An entity in
B is associated with any number in A.
Many people can be born in any county, but any individual is born
in at most one country.

year
name Capital

Was
Bowling Country
Born
Club
in

Was born in
•Many-to-many: Entities in A and B are associated with any number
from each other.

Since
name name

Is
Girls Boys
Classmate
of

Is Classmate of
UNIVERSITY ENTITY-RELATIONSHIP DIAGRAM

Entity
ATTRIBUTES
• Each Entity has a set of Attributes
• Attribute is a property or characteristic of an entity that is of interest to the
organization.
• Example: [STUDENT: Student_ID, Student_Name, Phone_Number, Major]

• An attribute name:
• Should be a noun and capitalize the first letter of each word.
(Example: Student_ID.)
• Should be unique.
• Should follow a standard format. (Example: Student_GPA, not
GPA_of_Student.)
• Similar attributes of different entity types should use similar but
distinguished names.
• Example: Faculty_Residence_City_Name and
Student_Residence_City_Name
• An attribute definition should:
• State what the attribute is and why it is important.
• Make clear what is and isn’t included in the attribute's value.
• Define any aliases.
• Indicate if the attribute is required or not.
• Indicate any relationships with other attributes.

Student

Student_ID
Student_Address
Student_Phone
RELATIONSHIPS
• Relationships are associations between one or more entity types.

• The degree of a relationship = is the number of entity types that participate in a relationship. There are 3
common relationships:
1. Unary (degree one) 2. binary (degree two) 3. Ternary (degree three)

Relationship
UNARY RELATIONSHIP

• Relationship between the instances of one entity type.

Is_married_to Manages

EMPLOYEE
PERSON

One-to-one One-to-many
BINARY RELATIONSHIP
• Relationship between the instances of two entity type.

Is assigned Contains

One-to-One One-to-Many
PARKING
EMPLOYEE PRODUCT
SPACE PRODUCTS
LINE

Can also have many to many!


TERNARY RELATIONSHIP

• A simultaneous relationship among instances of three


entity types.

PART

VENDOR WAREHOUSE
Supplies
STARTING AN ER-D

1. Define the Entities.


2. Define the Relationships.
3. Add attributes to the relationships.
4. Add cardinality to the relationships.
5. Don’t forget to use proper naming conventions and
symbol representation.
GUIDELINES FOR DRAWING ER-D’S

• Lay out the diagram with minimal line crossing.


• Place subject entity types on the top of the diagram.
• Place plural entity types below a single entity type in a one-to-many
relationship.
• Place entity types participating in one-to-one and many-to-many relationships
alongside each other.
• Group closely related entity types when possible. Try to keep the length of
relationship lines as short as possible. Also try to minimize the number of
changes of direction in a single line.
• Show the most relevant relationship name. One name must always be shown.

You might also like