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

(singke) #1

Figure 21.1 The Meet-A-Geek Web site flowchart.


Notice how the flow of the Web site helps influence the business rules that were gathered in the
requirements phase. Specifically, the rule that states a user cannot post or search an ad unless he or
she is a member. This rule is enforced by the site's design.

Database Design


Now that the basic flow of the site is designed, you can focus on the database. Remember that a database is
the engine that runs the application. If the database is not designed well, it will not perform well. A poorly
designed database is not flexible and cannot change with the business. Time spent here is time well spent.


From the requirements gathering stage, you determined the following business objects:


  1. Customers

  2. Ads

  3. Orders

  4. Products
    In this stage of the process, you will describe the business objects. This will help you determine the
    columns that will make up the database. You read about this process in detail on Day 3. By asking
    questions about the object's characteristics, you determined the descriptions of the business objects
    (see Tables 21.1, 21.2, 21.3 and 21.4). Also, it is a good idea to establish the data type of this
    characteristic at this point. It helps save time later. Remember that the column type can help enforce
    business rules as well.
    Table 21.1 The Customers Table


Characteristic Data Type

First_Name

VARCHAR(15),

Not NULL

Last_Name VARCHAR
(20), Not
NULL

Middle_Initial CHAR(^1 )^

Address

VARCHAR

(50), Not
NULL

City

VARCHAR

(30), Not
NULL

State
CHAR( 2 ), Not
NULL

Zip VARCHAR
(15), Not
Free download pdf