Notes database design and database CH7 ER model
7.1 Overview of the design process
- Understand and describe the complete user needs
- Concept Design (Entity Relationship Model)
- Functional requirements description (operations and transaction)
- Logic design (the pattern data mapped to the conceptual model)
- Physical design (format and file organization structure index)
Database design process to avoid redundancy and incomplete
7.2 Entity - Relationship model (ER diagram)
- Entity entity: there is realistic and can be distinguished from other things objects
- Property attributes: the entity that owns the properties and is represented by properties, each property has a value
- Set with the same attributes or properties entity: Entity Set entity set
-
Contact relationship: mutual association between multiple entities
- For example: there is a link between the advisor and the student A teacher B, B is suggested that the teacher mentor students A's
-
Contact set relationship set: a collection of the same type of contact
- If the E1, E2, E3 ... En is an entity set, the link set R is {(e1, e2, ... en) | e1 ∈ E1, e2 ∈ E2, ..., en ∈ En} subset, for example (A, B ) ∈advisor
- Information sets may have a property, which makes the contact more descriptive
-
Each attribute has a set of values, called the domain of the attribute or a value set Domain
- Simple and composite attributes: simple attributes can not continue to be divided, complex property division can continue to represent
- Single-valued and multivalued attribute: for example, a teacher can have an ID, a teacher can have multiple phone numbers
7.3 Constraints
Base Mapping Mapping Cardinality: represents a number of entity can be associated to a set of contact entities
For binary contact set, there are four kinds of base maps:
-
One: an entity A with at most one entity B is associated, and an entity B is also at most one of the associated entity A
-
Many: A, an entity may be associated with any of the entities B, and B is at most one entity and an entity associated with the A
-
Many-: an entity A and B may be at most one associated with the entity, and an entity in the entity B may be associated with any of the A,
-
Many-: A, an entity may be associated with any of the entities B, and B is an entity entities associated with any of the A,
-
If the set E of entities each entity involved in the link set R in at least one link, then the set of entities participating in a link set R E are all; E if only partially involved in the R, called entity E set to participate in the link set R portion.
Attribute value of the entity must be able to uniquely identify the entity, i.e., different values on each entity can not have the same properties
- Ultra Code: uniquely identifies the entity by a set of attributes of one or more attributes of
- Candidate code: minimum Supersize
- Contact attribute set
- If a student to teacher mapping is many, the primary key is the student advisor of the master code
- If a student to teacher mapping is one to many, the primary key is the teacher advisor of the master code
- If a student to teacher mapping is many to many, the advisor of the master code is the primary code of student and teacher union
- If a student to teacher mapping is one to one, the advisor of the master code can be a student or teacher's master code
Figure 7.5 Entity Relationship
- Is divided into two rectangular portions representative set of entities, comprises an entity name and the attribute name, the master key are underlined indicate
- Representative set diamond
- Rectangle represents an undivided contact attribute set
- The line connecting the entity sets to set Contact
- The broken line link is connected to the collector contact property set
- Double line indicates participation
The complex nature of the wording:
Mapping the base of the painting: the directed segment -> point one, no pointing to the line - many
- one to one:
- one to many:
- many to one:
- many to many:
Three yuan Contact ER diagram sets:
- Weak entity set: There is not enough to form a solid set of attributes of the primary key
- Strong entity set: sets the primary key by an entity
- Weak entity set must be associated with the identifier body, that there is set dependent on the entity identification
- Weak entity set and identifying an entity set associative link called identification exercises, is many, and weak entity set is involved in all.
- ER shown in FIG weak entity set attribute identified by a dotted line, and the collector contact with the double diamond
University of ER diagram:
FIG symbol ER denotes Method: