The entity diagram is also a key issue in designing the database, and the development engineer also needs to understand the ER diagram published by the System designer. is to develop problems that are unavoidable and often used. So to be discussed. The Microsoft SQL Server2000 used in this chapter. Because of its simplicity and ease of use, it is a good tool for learning, so adopt. The adoption of Erwin is also due to the use of many developers and easy-to-use characteristics of the reasons, and the use of a good powerdesigner due to slightly complicated, it was not adopted. Entity Relationship diagram (er diagram)
In the example below, the PetShop database is used (the test database for Microsoft. NET, which is spread on the network, is downloaded to the http://www.qddown.com/down.asp?id=2475&no=1 address.) This article uses the PetShop (1.5.2). msi version. The ER modeling tool is Erwin4.1.4. Figure 1 is the ER diagram of its table structure under Erwin.
Figure 1 3.1 1 to 1 relationship
The username in the UserID and signon in Figure 2:account and the UserID in profile have a relationship of 1 to 1. A constraint relationship exists in the table. and the UserID in account must be present in both signon and profile before they can be inserted. and signon and profile have no limits.
Figure 2 3.2 1 Pair- many-to-many relationships
The favcategory in the Figure 3:profile table has a foreign key constraint with the Bannerdata primary key favcategory, and Favcategory can appear repeatedly in profile. and can only be inserted in the bannerdata.
Figure 3
The figure below is also a one-to-many relationship. Why is there a diamond icon? Because it can be empty on the Favcategory item in profile. Without necessarily appearing in the bannerdata. Null is not allowed if there is no diamond icon. Figure 4 below:
Figure 4 3.3 multi- many-to-many relationships
A course has a number of students to choose from, while a student has the option of multiple courses, there is a many-to-many relationship between the students and the curriculum. As shown in Figure 5:
Figure 5 3.4 table without any constraints
Table with no restrictions, as shown in Figure 6:
Figure 6