Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Relationship Diagram (ER Diagram)

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

 A tool for communications between database

designers and end users during the analysis phase


of database development.
 describes the structure of a database with the help
of a diagram, which is known as Entity
Relationship Diagram (ER Diagram). 

Chapter 2 Copyright © 2014 Pearson Education, Inc.


Chapter 2 Copyright © 2014 Pearson Education, Inc.
E-R MODEL CONSTRUCTS
 Entities:
 Entity instance–person, place, object, event, concept in the
user environment about which the organization wishes
to maintain data
Examples of entities:
•Person: Employee, Student, Patient
•Place: Store, Building
•Object: Machine, product, and Car
•Event: Sale, Registration, Renewal
•Concept: Account, Course

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 one that exists independently of other entity type
 ex: STUDENT, EMPLOYEE, COURSE

Chapter 2 Copyright © 2014 Pearson Education, Inc.


An entity that cannot be uniquely identified by its
own attributes and relies on the relationship with
other entity.

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 An attribute describes the property of an entity.
 There are four types of attributes:

1. Key attribute
2. Composite attribute
3. Multivalued attribute
4. Derived attribute

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 A key attribute can uniquely identify an entity from an
entity set. 

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 An attribute that is a combination of other attributes.

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 An attribute that can hold multiple values.
  It is represented with double ovals in an ER Diagram.   

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 An attribute based on another attribute.
 It is represented by dashed oval in an ER Diagram. 
 For example, for a circle, the area can be derived from
the radius.

Chapter 2 Copyright © 2014 Pearson Education, Inc.


Chapter 2 Copyright © 2014 Pearson Education, Inc.
REQUIRED VS. OPTIONAL ATTRIBUTES

Required – must have a value for every Optional – may not have a value for
entity (or relationship) instance with every entity (or relationship) instance
which it is associated with which it is associated

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 singular noun
 specific to the organization
 concise as possible
 the name used for the same type entity type
should be the same on all ER diagram on which
the entity type appears.

Chapter 2 Copyright © 2014 Pearson Education, Inc.


Attributes Attributes

Entities Entities

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 An association among the instances of one or more
entity types that is of interest to the organization
 A relationship is represented by diamond shape in ER
diagram

Chapter 2 Copyright © 2014 Pearson Education, Inc.


1. One to One
2. One to Many
3. Many to One
4. Many to Many

Chapter 2 Copyright © 2014 Pearson Education, Inc.


Chapter 2 Copyright © 2014 Pearson Education, Inc.
 When a single instance of an entity is associated
with a single instance of another entity

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 When a single instance of an entity is associated
with more than one instances of another entity

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 When more than one instances of an entity is
associated with a single instance of another entity

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 When more than one instances of an entity is associated
with more than one instances of another entity

Chapter 2 Copyright © 2014 Pearson Education, Inc.


Figure 2-17 Examples of cardinality constraints

a) Mandatory cardinalities

A patient history is A patient must have recorded


recorded for one and at least one history, and can
only one patient have many

Chapter 2 Copyright © 2014 Pearson Education, Inc.


29
Figure 2-17 Examples of cardinality constraints (cont.)

b) One optional, one mandatory

A project must be An employee can be assigned


assigned to at least one to any number of projects, or
employee, and may be may not be assigned to any
assigned to many at all

Chapter 2 Copyright © 2014 Pearson Education, Inc.


30
Figure 2-17 Examples of cardinality constraints (cont.)

c) Optional cardinalities

A person is
married to at most
one other person,
or may not be
married at all

Chapter 2 Copyright © 2014 Pearson Education, Inc.


31
Figure 2-20 Examples of multiple relationships

a) Employees and departments

Entities can be related to one another in more than one way

Chapter 2 Copyright © 2014 Pearson Education, Inc.


32
Chapter 2 Copyright © 2014 Pearson Education, Inc.
 In a University, a student enrols in Courses. A
student must be assigned to atleast one or more
courses. Each course is taught by a single
Professor.To maintain quality instruction, a
professor can deliver only one course.

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 We have three entities
 Student
 Course
 Professor

In a University, a student enrols in Courses. A student must be assigned to


atleast one or more courses. Each course is taught by a single Professor.To
maintain quality instruction, a professor can deliver only one course.

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 We have the following two relationships
 The student is assigned a course
 Professor delivers a course

In a University, a student enrols in Courses. A student must be assigned to


atleast one or more courses. Each course is taught by a single Professor.To
maintain quality instruction, a professor can deliver only one course.

Chapter 2 Copyright © 2014 Pearson Education, Inc.


 For them problem statement we know that,
 A student can be assigned multiple courses
 A Professor can deliver only one course

Chapter 2 Copyright © 2014 Pearson Education, Inc.


Chapter 2 Copyright © 2014 Pearson Education, Inc.
Chapter 2 Copyright © 2014 Pearson Education, Inc.

You might also like