You are on page 1of 13

E-R Diagram

Customer

places

Order

sells

Ordered Product

sold on

Product

C u s t o m e r s T a b le
C ustom e r N um b e r 10112 10113 10114 10117 C ustom e r N a m e L u c k S ta r P em rose H a r tm a n K - J a c k I n d u s tr ie s C ustom e r B a la n c e 1 4 5 5 .7 7 1 2 .1 4 0 .0 0 - 2 0 .0 0

O rd ers T a b le
O rder N um ber A 633 A 634 A 635 C ustom e r N um b e r ( f o r e ig n k e y ) 10112 10114 10112

O r d e r e d P r o d u c t s T a b le
O rder N um ber ( f o r e ig n key) A 633 A 633 A 634 A 634 A 635 A 635 P rod uct N um b er ( f o r e ig n k e y ) Q u a n t it y O rdered

77F02 77B12 77B13 77F01 77B12 77B15

1 500 100 5 300 15

P r o d u c t s T a b le
P rod uct N um b er 77B12 77B13 77B15 77F01 77F02 P r o d u c t D e s c r ip t io n W id g e t W id g e t W id g e t G ad g et G ad g et Q u a n t it y in S t o c k 8000 0 52 20 2

Entity, Attribute, and Relationship

DATA ENTITY TYPE: a noun, i.e. roles, events, locations, people, tangible things about which we wish to maintain data ATTRIBUTE: noun, data elements that describe characteristics of the entity type RELATIONSHIP: verb phrase, an association between entities of interest to the organization Labels of the dataflows in DFD's correspond to entities and attributes in the ERD.

ER Modeling Challenges
Identifying entities and attributes in a syetem
Entity: Student Attributes of the Entity Student Name Social Security No. (Key) Major Mailbox Number Permanent Address Street City State Zip Credit Hours Earned

Which of the following would be potential entities in a system for student registration?
Student Registrar Course number Room Class Course Pre-requisites Name Junior Sophomore Jane Stevens MIS 321 01 Instructor Password/pin Bill

Potential entities in a system for student registration . . .


Entity Types: student, course, and depending on scope bill, instructor
Attributes of Entity: course number, room, class standing, pre-requisites, name, password/pin, and depending on scope (instructor)

Possible Attribute Values: junior, sophomore Instances: Jane Stevens, MIS 321 01

Types of attributes

Composite attributes

Attributes with subattributes Address: street address, city, state, zip. Single valued Attribute with only one value Age of a person, sudent id Multivalued Attribute with more than one value Tel-phone numbers Stored and derived attribute Strongly related One is derived from other (stored attribute). Age of a person can be derived from the attribute birth date. Null value Attribute with no value Apartment number in a streetaddress can have the value null for an address which is not in an appartment

Criteria for Selecting Primary Key

The value will not change over the life of each instance of the entity For each instance of the entity, you are guaranteed to have a value for the attribute Avoid intelligent keys -- a key whose structure indicates classification or location -- these often change Single attribute keys are easier to work with than large multi-attribute composite keys Create a separate surrogate key

What would be a good primary key choice for the following entity?
ENTITY: Course
Course Number Quarter Offered Instructor Course Description Time Offered Day Offered

ID number
ENTITY: VIDEO

Movie Title , Length , Copy Number , Awards , Lead Actors/Actresses , Availability (logical) Movie Title? Movie Title and Copy No.? How to distinguish between a remake and original with the same title? May need to create an attribute that is unique -- video id number

Weak Entity Types


Existence depends on the relation with another entity No key attribute Identified by own attributes in combination with the attributes of the entity on which it depends on. A weak entity cannot exist without the relation it has with the entity it is related.

Symbols in an ERD

You might also like