Entity Relationship Diagram

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 19

Data Modelling

• Normalization
• ERD
AN UNNORMALIZED RELATION FOR ORDER

one table lists the relevant data elements for the entity ORDER.
These include all of the details about the order, the part, the
supplier.

An order can include more than one part, and it may be that
several parts are supplied by the same supplier. However, using
this table, the supplier’s name, and other information might need
to be stored several times on the order list.
NORMALIZED TABLES CREATED FROM ORDER
Normalization
Streamlining complex groupings of data to minimize redundant data elements
and awkward many-to-many relationships

The Order table has been broken down into four smaller, related tables. Notice that the Order table contains only two
unique attributes, Order Number and Order Date. The multiple items ordered are stored using the Line_Item table. The
normalization means that very little data has to be duplicated when creating orders, most of the information can be
retrieved by using keys to the Part and Supplier tables.

It is important to note that relational database systems try to enforce referential integrity rules to ensure that relationships
between coupled tables remain consistent. When one table has a foreign key that points to another table, you may not
add a record to the table with the foreign key unless there is a corresponding record in the linked table. For example,
foreign key Supplier_Number links the PART table to the SUPPLIER table. Referential integrity means that a new part can’t
be added to the part table without a valid supplier number existing in the Supplier table. It also means that if a supplier is
deleted, any corresponding parts must be deleted also.
Entity Relationship
Diagram
ERD (Entity Relationship Diagram)
►is modeling tool used to depict graphically a database
design before it is actually implemented.
►It has three basic components, namely, an Entity,
Relationship and an Attribute.
Entity
►is a real-world object distinguishable or unique from
other objects.
►An entity can be a concrete or physical object like
employee, student, faculty, customer etc. Or it could
also be conceptual or abstract like transaction, order,
course, subjects etc.
►It can be thought of as a noun like student, employee
etc.
►It is normally represented by a rectangle shape.
Relationship
►is a way of relating one entity to another. Entities can
therefore participate in a relationship.
►it is commonly thought as a verb connecting the
entities or nouns.
►It is normally represented by a diamond shape.
Example of Entities with Relationship

Person belongs Location

Student enrolls Subject(s)

Faculty teaches Subject(s)


Types of Relationship
►One-to-One
►One-to-Many
►Many-to-Many
Types of Relationship
1 1
One-to-One Student has ID

1 M
One-to-Many Division has Program

M M
Many-to-Many Student enrolls Subject
Types of Relationship (Crow Notation)

One-to-One Student has ID

One-to-Many Division has Program

Many-to-Many Student enrolls Subject


Attribute
►Refers to the characteristic or basic fact or field of an
Entity or Relationship.
►For example a Student entity could have the following
attributes ID Number, Last Name, First Name, Address,
Birth Date etc.
►A relationship could also have an attribute for example
an Entity name Student enrolls (relationship) to a
Course/Program. Now, when you enroll you enroll on a
certain date so you will have an attribute of Enrollment
Date under Enroll relationship.
►It is normally represented by a circle.
Example of Attributes
Lastname Firstname

ID No.
Gender

Student Address

Birth date

Email

Note : A Primary Key is Underlined, in this case the ID No.


Example of Attributes
Name
Chairperson

Lastname Firstname

Program ID
Enrollment ID No.
Date
Gender

Program enrolls Student Address

ID No. Birth date

Email
has Faculty
Lastname

Firstname
Example of Attributes
Name
Chairperson

Lastname Firstname

Program ID
Enrollment ID No.
Date
Gender

Program enrolls Student Address

ID No. Birth date

Email
has Faculty
Lastname

Firstname

15
Recursive ERD

manages

Employee
ERD with Ternary Relationship

Supplier supplies Product

Customer
ERD (More Examples)

Management Information Systems, 10/e


© 2007 by Prentice Hall 18
Raymond McLeod and George Schell
18
ERD (More Examples)
Code Manages
Name

Name

Employee Is_a_Member Department Dept ID


Age

Salary Start Date


Participates has
Start Date City

Name
Project
Branch
Budget Address

Release Date

You might also like