【正文】
each department, there could be one or more employees associated with that department. The relationship between DEPT and EMP is onetomany. Onetoone In a onetoone relationship, a row in a table is related to only one or none of the rows in a second table. This relationship type is often used for subtyping. For example, an EMPLOYEE table may hold the information mon to all employees, while the FULLTIME, PARTTIME, and CONTRACTOR tables hold information unique to fulltime employees, parttime employees, and contractors, respectively. These entities would be considered subtypes of an EMPLOYEE and maintain a onetoone relationship with the EMPLOYEE table. These relationships are not as mon as onetomany relationships, because if one entity has an occurrence for a corresponding row in another entity, in most cases, the attributes from both entities should be in a single entity. Manytomany In a manytomany relationship, one row of a table may be related to many rows of another table, and vice versa. Usually, when this relationship is implemented in the database, a third entity is defined as an intersection table to contain the associations between the two entities in the relationship. For example, in a database used for school class enrollment, the STUDENT table has a manytomany relationship with the CLASS table— one student may take one or more classes, and a given class may have one or more students. The intersection table STUDENT_CLASS would contain the binations of STUDENT and CLASS to track which students are in which classes. Assigning Attributes to Entities Once the designer has defined the entity relationships, the next step is to assign the attributes to each entity. This is physically implemented using columns, as shown here for the SALGRADE table as derived from the salary grade entity. After the entities, relationships, and attributes have been defined, the designer may iterate the data modeling many more times. When reviewing relationships, new entities may be discovered. For example, when discussing the widget inventory table and its relationship to a customer order, the need for a shipping restrictions table may arise. Once the design process is plete, the physical database tables may be created. Logical database design sessions should not involve physical implementation issues, but once the design has gone through an iteration or two, it39。 they are blank. A relational database can enforce the rule that fields in a column may or may not be empty. In this case, it makes sense for an employee who is not in the Sales department to have a blank Commission field. It also makes sense for the president of the pany to have a blank Manager field, since that employee doesn39。結(jié)果,設(shè)計就可能需要再次構(gòu)想以求得理想的數(shù)據(jù)庫存運行與預(yù)算和進度之間的平衡。 指定實體屬性 一旦設(shè)計者定義了實體間關(guān)聯(lián),下一步就是去指定每個實體的屬性。例如,一個員工表可能保存了所有員工的信息,而全職表、兼職表和承包人表則分別保存全職員工、兼職員工和承包人的信息。