ENABLE User's Guide
 DEVELOPING A DATA BASE
 Choosing Key Fields
 A key-sequenced file type is the best choice for both files in
 the personnel data base. A relative file type is not necessary
 because no logical use for the record number field exists. An
 entry-sequenced file type is not satisfactory because the
 personnel department enters data in both files randomly and
 sequentially. An unstructured file type is unsatisfactory
 because, with such a file type, the personnel department could
 not use alternate keys to find an "employee" or "depend" record.
 After you select a file type for a file, you are ready to choose
 key fields for that file.
 Choosing Key Fields
 Assuming that you have selected a key-sequenced file type for
 your data base files, you must now choose one primary key field
 for each. In addition, you can choose up to 255 alternate key
 fields for each file.
 For the "employee" file, a good choice for a primary key is
 "empnum." One of the requirements for a primary key field is
 that it stores unique values. Since each employee has a unique
 employee number, "empnum" satisfies this requirement. Good
 candidates for alternate keys in this file are "empname,"
 "regnum," and "branchnum." Instead of making both "regnum" and
 "branchnum" separate alternate key fields, you could identify a
 group field ("dept") of which these fields are a part and make
 that group an alternate key field. When you choose a group as a
 key field, that group is said to be a composite key field.
 For the "depend" file, neither "emp-no" nor "dependent-name"
 uniquely identify a record. These fields are not unique because
 the same employee number can appear with several dependents, and
 several dependents could have the same name. If you provide a
 number that identifies each dependent of a given employee, you
 could identify a group ("dep-key") consisting of "emp-no" and the
 dependent number ("dependent-no"). You could then use this group
 as a composite primary-key field. Although "dependent-name" is
 not unique, and therefore cannot serve as a primary key, it is a
 good choice for an alternate key field.
 When you are choosing key fields for your files, consider making
 any field (such as "empnum") that also appears in another file a
 key field of the other file. If you do this, you can use ENABLE
 to generate an application that can access both files.
 3-10










