D.3 The DBTG CODASYL Model 11 Hayes Main Harrison A-102400 Perryridge Horseneck 1700000 A-101500 Johnson Alma Palo Alto A-201900 Downtown Brooklyn 9000000 A-305 350 Round Hill Horseneck 8000000 Turner Putnam Stamford A-402 1000 A-408 1123 Figure D.16 Six set occurrences. 4.Owner is branch record Perryridge,with three member account records A-102,A-201,andA-402. 5.Owner is branch record Downtown,with one member account record A-101. 6.Owner is branch record Round Hill,with two member account records A-305 and A-408. Note that an account record(which is,in this case,a member of both DBTG sets) cannot appear in more than one set occurrence of one individual set type.This restriction exists because an account can belong to exactly one customer,and can be associated with only one bank branch.An account,however,can appear in two set occurrences of different set types.For example,account A-102 is a member of set occurrence 1 of type depositor,and is also a member of set occurrence 4 of type account branch. The member records of a set occurrence can be ordered in a variety of ways. We shall discuss this issue in greater detail in Section D.6.6,after we describe the mechanism for inserting and deleting records into a set occurrence. The DBTG model allows more complicated set structures,in which one single owner type and several different member types exist.For example,suppose that we have two types of bank accounts:checking and saving.Then,the data- structure diagram for the customer-account schema is as depicted in Figure D.17a. Such a schema is similar in nature to the E-R diagram of Figure D.17b. The DBTG model also provides for the definition of a special kind of set, referred to as a singular set (or system set).In such a set,the owner is a system- defined,unique record type,called system,with no fields.Such a set has a single set occurrence.This scheme is useful in searching records of one particular type, as we shall discuss in Section D.4.4. D.3.3 Repeating Groups The DBTG model provides a mechanism for a field(or collection of fields)to have a set of values,rather than one single value.For example,suppose that a customer
D.3 The DBTG CODASYL Model 11 Figure D.16 Six set occurrences. 4. Owner is branch record Perryridge, with three member account records A-102, A-201, and A-402. 5. Owner is branch record Downtown, with one member account record A-101. 6. Owner is branch record Round Hill, with two member account records A-305 and A-408. Note that an accountrecord (which is, in this case, a member of both DBTG sets) cannot appear in more than one set occurrence of one individual set type. This restriction exists because an account can belong to exactly one customer, and can be associated with only one bank branch. An account, however, can appear in two set occurrences of different set types. For example, account A-102 is a member of set occurrence 1 of type depositor, and is also a member of set occurrence 4 of type account branch. The member records of a set occurrence can be ordered in a variety of ways. We shall discuss this issue in greater detail in Section D.6.6, after we describe the mechanism for inserting and deleting records into a set occurrence. The DBTG model allows more complicated set structures, in which one single owner type and several different member types exist. For example, suppose that we have two types of bank accounts: checking and saving. Then, the datastructure diagram for the customer-account schema is as depicted in Figure D.17a. Such a schema is similar in nature to the E-R diagram of Figure D.17b. The DBTG model also provides for the definition of a special kind of set, referred to as a singular set (or system set). In such a set, the owner is a systemdefined, unique record type, called system, with no fields. Such a set has a single set occurrence. This scheme is useful in searching records of one particular type, as we shall discuss in Section D.4.4. D.3.3 Repeating Groups The DBTG model provides a mechanism for a field (or collection of fields) to have a set of values, rather than one single value. For example, suppose that a customer
12 Appendix D Network Model customer 、depositor customer account savings_account checking_account savings_account checking_account (a) (b) Figure D.17 Data-structure and E-R diagram. has several addresses.In this case,the customer record type will have the (street, city)pair of fields defined as a repeating group.Thus,the customer record for Turner may be as in Figure D.18. The repeating-groups construct provides another way to represent the notion of weak entities in the E-R model.As an illustration,let us partition the entity set customer into two sets: 1.customer,with descriptive attribute customer name 2.customer address,with descriptive attributes customer_street and customer_city The customer nddress entity set is a weak entity set,since it depends on the strong entity set customer. The E-R diagram describing this schema appears in Figure D.19a.If we do not use the repeating-group construct in the schema,then the corresponding data- Turner Putnam Stamford Field Horseneck Figure D.18 A customer record
12 Appendix D Network Model Figure D.17 Data-structure and E-R diagram. has several addresses. In this case, the customer record type will have the (street, city) pair of fields defined as a repeating group. Thus, the customer record for Turner may be as in Figure D.18. The repeating-groups construct provides another way to represent the notion of weak entities in the E-R model. As an illustration, let us partition the entity set customer into two sets: 1. customer, with descriptive attribute customer name 2. customer address, with descriptive attributes customer street and customer city The customer address entity set is a weak entity set, since it depends on the strong entity set customer. The E-R diagram describing this schema appears in Figure D.19a. If we do not use the repeating-group construct in the schema, then the corresponding dataFigure D.18 A customer record