It will be easier for you to understand and define business rules if you divide them into two distinct categories: field specific and relationship specific.
Business rules under this category impose constraints on the elements of a field specification for a particular field. The number of elements a given rule affects depends on the manner in which you define that rule. For example, this rule only affects one element:
Order dates are to be displayed in long form, such as "January 10, 2003."
This rule affects the Display Format element of the ORDER DATE field in an ORDERS table. You establish this rule by modifying the Display Format element of the field specifications for the ORDER DATE field to indicate the manner in which the date should be displayed.
Here's a rule that affects more than one element:
We must be able to store a zip code for our Canadian customers.
This rule affects the Data Type, Character Support, and Display Format elements of the field specifications for the CUSTZIPCODE field in a CUSTOMERS table. Canadian zip codes include letters, so you must make the following modifications to these elements in order to impose the constraints defined by this rule:
Change the Data Type setting to "Alphanumeric."
Include "Letters" under the Character Support element.
Modify the Display Format element to ensure that the letters in Canadian zip codes will be capitalized.
Figure 11.3 shows the modified Physical Elements section of CUSTZIPCODE's field specifications.
These types of business rules impose constraints that affect the characteristics of a relationship. For instance, assume you're working with the tables and relationships in Figure 11.4.
Say you determine that there must be a limit to the number of students for each class and you define the following business rule:
Each class must have a minimum of 5 students, but cannot have more than 20.
This business rule affects the degree of participation between the CLASSES and STUDENT CLASSES tables. You enforce the constraint this rule defines by modifying the relationship diagram to show that a single record in the CLASSES table must be related to at least 5but no more than 20records in the STUDENT CLASSES table. (Depending on your point of view, you could also infer from this business rule that the type of participation for the STUDENT CLASSES table is now mandatory. You can enter a new class or keep an existing class in the CLASSES table if and only if there are at least five students registered for that class.) Figure 11.5 shows the modification you must make to the diagram in order to establish the business rule.
Top |