Entity Attribute and Relationship DATA ENTITY TYPE a
• 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 •
- Slides: 13