390 likes | 719 Vues
Jae H. Park 2006. 2. Entity, Relationship, Attribute - Definition. EntityAnything (such as a person, place, thing, or event) about which data are to be collected and storedCould be physical objects (customer, product, student, etc.) or abstraction (enrollment, flight route, order, etc.) Relatio
E N D
1. Entity-Relationship Model BEDU 496, Records Administration Using Database
Jan. 30, 2006
Dr. Jae Park, jae.park@emich.edu
STS, Eastern Michigan University
2. © Jae H. Park 2006 2 Entity, Relationship, Attribute - Definition Entity
Anything (such as a person, place, thing, or event) about which data are to be collected and stored
Could be physical objects (customer, product, student, etc.) or abstraction (enrollment, flight route, order, etc.)
Relationship
Association among (two or more) entities
Cardinality: One-to-one, one-to-many, many-to-many relationships
Attributes
Characteristics of an entity
Student’s (entity) attributes: student ID, student name, address, etc.
3. © Jae H. Park 2006 3 E-R Model Entity-Relationship model is a detailed, logical representation of the data for an organization or for a business area.
E-R model is expressed in terms of
Entities in the business environment,
The relationships among those entities, and
Attributes of both the entities and their relationships
E-R model is normally expressed as an Entity-Relationship Diagram (or ERD), which is a graphical representation of an E-R model
4. © Jae H. Park 2006 4 E-R Model Notation
5. © Jae H. Park 2006 5 E-R Model Relationship Degree
6. © Jae H. Park 2006 6 E-R Model Relationship Cardinality
7. © Jae H. Park 2006 7 Entities Entities
A person, place, object, event, or concept in the user environment about which the organization wishes to maintain data
Entity type
A collection of entities that share common properties or characteristics
Person (Employee, student, patient)
Place (Store, warehouse, state)
Object (Machine, building, automobile)
Event (Sale, renewal, order, payment, enrollment)
Concept (Account, course, membersip)
Entity instance
A single occurrence of an entity type
8. © Jae H. Park 2006 8 Strong Entity vs. Weak Entity Strong Entity Type
An entity that exists independently of other entity types
Weak Entity Type
An entity type whose existence depends on some other entity type
Identifying owner or owner
The entity type on which the weak entity type depends
Identifying relationship
The relationship between a weak entity type and its owner
9. © Jae H. Park 2006 9 Strong Entity vs. Weak Entity
10. © Jae H. Park 2006 10 Strong Entity vs. Weak Entity
11. © Jae H. Park 2006 11 Attribute A property or characteristic of an entity type that is of interest to the organization
Can be associated with only one entity type or relationship
Naming
Use a noun name
Use initial capital letter followed by lower case letters
If more than two words, use underscore character to connect the words and start each with a capital letter (Employee_Name)
12. © Jae H. Park 2006 12 Required vs. Optional Attributes Required Attribute
An attribute of an entity that must have a value for each entity instance
Optional Attribute
An attribute of an entity that may not have a value for every entity instance
An attribute without a value is said to be null
13. © Jae H. Park 2006 13 Simple vs. Composite Attributes Simple attribute
An attribute that cannot be broken down into smaller components
Composite attribute
An attribute that can be broken down into component parts
14. © Jae H. Park 2006 14 Single-valued vs. Multivalued Attributes Multivalued attribute
An attribute that may take on more than one value for a given entity instance
E.g., Programming skills like C, Java, Visual Basic, etc.
15. © Jae H. Park 2006 15 Stored vs. Derived Attributes Derived Attribute
An attribute whose values can be calculated from related attribute values
16. © Jae H. Park 2006 16 Identifier An attribute or combination of attributes that uniquely identifies individual instances of an entity type
17. © Jae H. Park 2006 17 Composite Identifier An identifier that consists of a composite attribute
18. © Jae H. Park 2006 18 Associative Entities An entity type that associates the instances of one or more entity types and contains attributes that are peculiar to the relationship between those entity instances.
the entity was initially specified as a relationship
Usually relationship name (a verb) is converted to an entity name (a noun)
How do we know when we have to convert a relationship to an entity?
Many to many relationship
Resulting entity type has independent meaning to users and can be identified with a single-attribute identifier
Relationship includes attributes other than identifier
19. © Jae H. Park 2006 19 Associative Entities
20. © Jae H. Park 2006 20 Associative Entities
21. © Jae H. Park 2006 21 Associative Entities
22. © Jae H. Park 2006 22 Associative Entities
23. © Jae H. Park 2006 23 Degree of Relationship Degree
The number of entity types that participate in a relationship
Unary relationship
A relationship between the instances of a single entity type
Binary relationship
A relationship between the instances of two entity types
Ternary relationship
A simultaneous relationship among the instances of three entity types
24. © Jae H. Park 2006 24 Unary Relationship
25. © Jae H. Park 2006 25 Binary Relationship
26. © Jae H. Park 2006 26 Ternary Relationship
27. © Jae H. Park 2006 27 Ternary Relationship
28. © Jae H. Park 2006 28 Attribute or Relationship? (multivalued attribute)
29. © Jae H. Park 2006 29 Attribute or Relationship? (multivalued and composite attribute)
30. © Jae H. Park 2006 30 Attribute or Relationship?(composite attribute)
31. © Jae H. Park 2006 31 Attribute or Relationship?
32. © Jae H. Park 2006 32 Cardinality Constraints Specifies the number of instances of one entity that can (or must) be associated with each instance of another entity
Minimum Cardinality
If minimum cardinality is zero, we say the entity type is an optional participant in the relationship
In the previous slide, EMPLOYEE entity type is an optional participant in the “belongs” relationship
Maximum Cardinality
In the previous slide, maximum cardinality of EMPLOYEE is “many” (by crow’s feet)
Minimum and maximum cardinality of DEPARTMENT in “belongs” relationship are both one. This is called a “mandatory one” cardinality.
This means each employee must belong to one and only one department
33. © Jae H. Park 2006 33 Time-dependent Data Modeling
34. © Jae H. Park 2006 34 Time-dependent Data Modeling
35. © Jae H. Park 2006 35 Multiple Relationships