Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1
Message^

Amount Due^ Zip

(^) Email
(^) Age
(^) Gender
(^) Race
(^) Eye Color
(^) Hair Color
(^) Favorite
Activity
(^) Favorite
Movie
(^) Occupation
(^) Smoker
We could have added more to this list but I'm going to keep it small and simple. The most important
point here is not the contents but the use of the concepts. Hopefully, you will see the importance of
good database design.
The next step is to define your business rules. From the analysis of the business process, you can
determine some rules. You can also determine the rules from common sense and experience. From the
analysis, you know that a person cannot search the database unless he or she is a member. You also
know that a gift will not be shipped unless it has been ordered. This may seem quite obvious, but, as I
said earlier, even the rules that may seem foolish will help with your overall design. Think of some more
rules, and then look at the list of rules I have compiled.
Business rules for Meet-A-Geek:
ƒ A customer cannot search database unless he or she is is a member.
ƒ A gift will not be shipped unless it is ordered.
ƒ A customer must have a name and an address.
ƒ A product must have a name and a price.
ƒ A transaction ship date cannot be earlier than the order date.
ƒ A customer's gender can only be male or female.
ƒ The customer is either a smoker or not (a yes or no question).
ƒ The amount paid is equal to the product's price times the order quantity.
ƒ The amount paid cannot be a negative amount.
For the sake of simplicity, stop here. There are many more rules, but stick with what you have. Now that
you have defined your business process, defined and described your business objects, and have
established your business rules, you are ready to model your database. I have developed a model of
your current database. Compare Figure 3.12 to what you have done and see if they are similar.

Free download pdf