文章目录
Database Design
6.1 Introduction to E-R Concepts
- distinguishable
- having common properties
Example: Classrooms
- distinguishable: using room number
- common properties : seating capacity
Entities are represented by rectabgles in E-R diagrams
identifiers
descriptors
multi-valued attribute
composite attribute
Transfroming Entities and Attributes to Relations
- Relationships among Entities
Relationships are represented by diamonds in an E-R diagram
6.2 Further Details of E-R Modeling
-
Cardinality of Entity Participation in a Relationship
-
card(E, R)
-
One-toOne, Many-to-Many, and Many-to-one Relationships
-
Transfroming Binary Relationships to Relations
6.3 Additional E-R Concepts
Weak Entities
- Generalization Hierarchies
6.5 Normalization: Preliminaries
In the normalization approach, the designer starts whith a real-world situation to be modeled and lists the data items that are candidates to become column names in relational tables, together with a list of rules about the relatedness of these data items. The aim is to represent all these data items as data items as attributese of tables that obey restrictive conditions associated with what we call normal froms
. These normal form definitions limit the acceptable form of a table so that it has certain desirable properties, thus avoiding variouts kinds of anomalous behavior.
A 3NF decomposition constructed to have the three desirable properties just mentioned is generally considered an acceptable database design.
- Anomalies of a Bad Database Design
6.6 Functional Dependencies
A functional dependency defines the most commonly encountered type of relatedness property between data items of a database
-
Logical Implications among Functional Dependencies
-
Armstrong’s Axioms
- Closure, Cover, and Minimal Cover
Here is an algorithm for determining the closure of any set of attributes X
(如果是一个key,那肯定能决定其他所有属性)
- 求最小覆盖的算法
6.7 Lossless Decompositions
6.8 Normal Forms
- 3NF