Defining and Establishing Business Rules

   

Categories of Business Rules

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 .

Field Specific Business Rules

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 O RDER D ATE field in an ORDERS table. You establish this rule by modifying the Display Format element of the field specifications for the O RDER D ATE 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 C UST Z IPCODE 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:

  1. Change the Data Type setting to "Alphanumeric."

  2. Include "Letters" under the Character Support element.

  3. 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 C UST Z IPCODE 's field specifications.

Figure 11.3. Establishing a field specific business rule for C UST Z IPCODE .

graphics/11fig03.gif

Relationship Specific Business Rules

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.

Figure 11.4. Tables and relationships from a school database.

graphics/11fig04.gif

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.

Figure 11.5. Establishing a relationship specific business rule.

graphics/11fig05.gif


   
Top


Database Design for Mere Mortals[c] A Hands-On Guide to Relational Database Design
Database Design for Mere Mortals: A Hands-On Guide to Relational Database Design
ISBN: 0201694719
EAN: 2147483647
Year: 2002
Pages: 203

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net