Step by step design your database overview advanced ER Model

Source: Internet
Author: User

Introduction: In Step-by-Step design of your database 3, we discuss the components and semantics of the basic object link model. These concepts are very important and are the basis of today's lecture. Before starting this article, we suggest you review the previous article. Today, we will discuss the components of the advanced object link model, which, together with the previous article, covers most of the content of the ER Model diagram. The ternary relationship is the difficulty of today's speech. You can focus on it.

 

Generalized Generalization): supertype and subtype

The original ER model can already describe basic data and relationships, but generalized Generalization) the introduction of concepts can facilitate the integration of multiple conceptual data models.

A generalized relationship is used to extract the common attributes of multiple entities as superclasses. Low-level entities in generalized hierarchies-subtypes: Inherit and add attributes in super-class entities, and subtypes are specialized in supertypes.

The generalization in the ER model is similar to the inheritance concept in object-oriented programming, but its markup method is similar to that in object-oriented programming.

General Relationship between employees and managers, engineers, technicians, and secretaries. Employee is a super-Class Object and contains common attributes. Manager, Engineer, Technician, and Secretary are all sub-class objects of Employee. They can contain their own unique attributes.

 

Figure 1 generalized relationship between Employee and Manager, Engineer, Technician, and Secretary

Generalization can express two important constraints of child types, the overlapping constraint disjointness) and the completeness constraint completeness ).

Overlapping ConstraintsIndicates whether the child types are exclusive. If exclusive, use the letter "d"; otherwise, use "o" to identify o-> overlap ). In Figure 1, each subclass object is exclusive in concept.

Generalize the employees and customer entities and abstract super entity individuals to obtain the following relationship diagram. Because some of the employees may also be customers, the concepts of the sub-class Object "Employee" and "Customer" overlap.

 

Figure 2 general relationship between Individual, Employee, and Customer

Completeness ConstraintsIndicates whether all child types can completely overwrite the super type in the current system. If full coverage can be achieved, the double line can be interpreted as an equal sign between the super type and the circle ). In Figure 2, the sub-class Object "Employee" and "Customer" can completely overwrite the super-class "Individual" entity.

Aggregate Aggregation)

Aggregation is another super-type and sub-type abstraction different from generalized abstraction.

Generalization indicates the semantics of "is-a", and aggregation indicates the semantics of "part-. There is no inheritance relationship between the aggregated neutron type and the supertype.

The markup of an aggregate relationship is represented by the letter "A" in the circle.

Indicates that a software product consists of a program and a user manual.

 

Figure 3 aggregation between Software-product and Program and User's Guide

Ternary Relationships)

When the relationship between three entities cannot be accurately described through the binary relationship, we need to use the ternary relationship.

How to determine the connected number in a ternary relationship:

Note: For more information about how to use a ternary Relationship, see section Degree of a Relationship in step-by-step design of your database 3. For the concept of "connected number" of a link, see section "connected number Connectivity of a Relationship" in "Designing your database step by step.

Let's take a look at several three-element relationship instances.Degree of LinkAnd understand the semantics.

 

Figure 4 Relationship between technicians using manuals in projects

The Semantics in Figure 4 is:

Use the function dependency in mathematics to represent the relationship in Figure 4:

 

Figure 5 relationship between projects where employees are allocated

The Semantics in Figure 5 is:

Use the function dependency in mathematics to represent the relationship in Figure 5:

 

Figure 6 Relationship between managers and engineers

The Semantics in Figure 6 is:

Use the function dependency in mathematics to represent the relationship in Figure 6:

 

Figure 7 relationship between employees using skills in projects

The Semantics in Figure 7 is:

Figure 7 no function dependency between entities

In the preceding four forms of ternary relationships, the number of entities with a connection number of "1" is consistent with the number of functional dependency semantics reflected by the ternary relationship.

The ternary relationship can also have attributes. The attribute value is uniquely determined by the combination of the keys of the three entities.

N yuan relationship General n-ary Relationships)

The ternary relationship can be extended to the n meta relationship to describe the relationship between n entities.

Generally, the keys of each object with a connection number of "1" in the n-element relationship appear on the right of a function dependency expression.

It is relatively difficult to use language to express the constraints of the n-element relationship. We recommend that you use the mathematical form, that is, function dependency FD.

The number of function dependent entries in the n-element relationship is the same as the number of "1" objects in the graph ~ N ).

The function dependency expression of the n-element relationship contains n elements, n-1 elements appear on the left side of the expression, and 1 element appears on the right side.

 

Figure 8 n-element relationship

Exclusion Constraint)

Generally, multiple links are compatible with "or" relationships, that is, any or all objects are allowed to participate in these relationships.

In some cases, a multi-link is not a "or" link. That is, the entity that participates in a link can only select one of these relations, but cannot select multiple links at the same time.

It indicates that a job is either classified as an external project or an internal project, and cannot belong to both an external project and an internal project.

 

Figure 9 exclusive Constraint

 

We will make a general review of the previous article "Step by Step design your database 3" and the key content of this article.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.