data 4
Connectivity and Cardinality
1Connectivity: Describes the relationship type, (1:1, 1:M, M:N) 2Cardinality : Expresses minimum and maximum number of entity occurrences associated with one occurrence of related entity。Established by very concise 简洁的statements known as business rules
Attributes
1Required attribute: must have a value。 2Optional attribute: may be left empty, 3Domain: set of possible values for an attribute。 4Identifiers: one or more attributes that uniquely identify each entity instance, 5Composite identifier: identifier composed of more than one attribute,Composite attribute can be subdivided,Simple attribute cannot be subdivided,Single-value attribute can have only a single value,Multivalued attributes can have many values
Associative (Composite) 组合的Entities
Also known as bridge entities Used to implement M:N relationships, Composed of primary keys of each of the entities to be connected, May also contain additional attributes that play no role in connective process,
Attributes
Characteristics of entities。 1Chen notation: attributes represented by ovals connected to entity rectangle with a line,Each oval椭圆 contains the name of attribute it represents, 2Crow's Foot notation: attributes written in attribute box below entity rectangle。
Key Terms
Connectivity Cardinality基数 Identifier 标示符 Composite Identifier Single-value versus multi-valued attributed Derived attribute 衍生属性 Existence dependence versus independence Relationship Strength (weak versus strong) Entity Strength (weak versus strong) Relationship Participation (optional versus mandatory强制的 Relationship degree (unary, binary, ternary)
Developing an ER Diagram
Database design is an iterative 反复的process,Create detailed narrative of organization's description of operations Identify business rules based on description of operations,Identify main entities and relationships from business rules, Develop initial ERD,Identify attributes and primary keys that adequately describe entities,Revise and review ERD。
Database Design Challenges: Conflicting Goals
Database designers must make design compromises折中, Conflicting goals: design standards,processing speed, information requirements。Important to meet logical requirements and design conventions。Design is of little value unless it delivers all specified query and reporting requirements,Some design and implementation problems do not yield "clean" solutions。
The Entity Relationship Model
ER model forms the basis of an ER diagram (ERD), ERD represents conceptual database as viewed by end user, ERDs depict database's main components: Entities实体 Attributes 属性 Relationships关系
Summary
Entity relationship (ER) model main components: Entities Relationships Attributes Includes connectivity and cardinality notations Connectivities and cardinalities are based on business rules M:N relationship is valid at conceptual概念上的 level,Must be mapped to a set of 1:M relationships。 ERDs may be based on many different ERMs UML class diagrams are used to represent the static data structures in a data model Database designers are often forced to make design compromises
Existence Dependence
Existence dependence:Entity exists in database only when it is associated with another related entity occurrence。 Existence independence:Entity can exist apart from one or more related entities, Sometimes such an entity is referred to as a strong or regular entity。
Relationship Degree
Indicates number of entities or participants associated with a relationship, 1Unary relationship:Association is maintained within single entity。 2Binary relationship :Two entities are associated。 3Ternary relationship :Three entities are associated。
Attributes
Just like M:N relationships, multivalued attributes should be broken down further. Create new attributes for each of the original multivalued attributes' components,Create new entity composed of original multivalued attributes' components, Derived attribute: value may be calculated from other attributes。Need not be physically stored within database
Weak Entities
Not to be confused with weak relationship strength。Weak entity meets two conditions ,Existence-dependent (Entity exists in database only when it is associated with another related entity occurrence),Primary key partially or totally derived from parent entity in relationship。Database designer determines whether an entity is weak based on business rules。
Relationship Participation (Cardinality)
Optional participation:One entity occurrence does not require corresponding entity occurrence in particular relationship。 Mandatory participation:One entity occurrence requires corresponding entity occurrence in particular relationship
Entities
Refers to entity set and not to single entity occurrence,Corresponds to table and not to row in relational environment,Entity is represented by rectangle with entity's name The entity name, a noun, is written in capital letters。大写!
Recursive 递归循环Relationships
Relationship can exist between occurrences of the same entity set,Naturally found within unary relationship
Relationship Strength
Weak (non-identifying) relationships:Exists if PK of related entity does not contain PK component of parent entity, Strong (identifying) relationships:Exists when PK of related entity contains PK component of parent entity。