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

(singke) #1
fields that you have created. Remember that a key field is an identifier—it uniquely describes a row of
data. It should not be null. After you have completed this process, you are ready for your next step in
the design process.

The Final Stage—Creating the Database


The final step of the process is actually creating the database. By now, you should have a thorough
understanding of the business process, the business objects, and the business rules. You should have a
visual model of your proposed database. This is extremely helpful when it is time to modify or query the
database. Now is the perfect time to review everything. Go over the business process, see if anything was
left out. Review the business objects to ensure that you did not miss any of the implied objects. This is the
best time to add or subtract any fields or tables that might make your system better.
After the review is finished, you are ready to assign the data types to each of the fields. The MySQL
data types are covered in detail on Day 7. Assigning the proper data types will help enforce the rules
you have defined earlier, as well as make your database more efficient. At this time, it is also a good
idea to add a key to every table. Every table should have a key field. After you have everything on
paper, you can begin creating your database. Make sure you stick to your blueprint. Improvising is not
recommended. It can lead to poor design, which is what you are trying to avoid.


After your database is created, you will have to establish privileges, add users, and perform countless
other administrative tasks.

Sample Database—The Meet_A_Geek Database


To reinforce what you have learned, you are going to apply today's lesson to a sample project. The project's
task is to create a database for an online dating service called Meet-A-Geek. Meet-A-Geek is based on an
actual Web site that is using MySQL. The URL is http://www.meetageek.com. I encourage you to visit
this site and see what it has to offer. You will continue to build on this project in the following lessons. Now,
on with the design.


The first step is to define the business process. After interviewing the client, you might formulate the
following plan:


  1. A potential Romeo or Juliet comes to the site wanting to place an ad.

  2. He or she is first asked to fill out a membership application. This application
    captures the usual personal information. It also contains a questionnaire with
    specific questions asking the customer's likes and dislikes.

  3. After the customer has successfully completed the application, he or she is
    allowed to search the database for potential dates.

  4. After receiving results from his or her search, a customer can send flowers, a box
    of chocolate, or some other gift to one of the potential dates he or she found in the
    database. The customer will click a hyperlink that will take him or her to your
    catalog of gifts.

  5. After the customer has picked out his or her gift, he or she will have the
    opportunity to purchase this gift via the Web and ship the gift directly to the
    potential boyfriend or girlfriend with a custom message. The gift giver and receiver
    must both be members of the Web site to exchange gifts.
    From this process, you can easily see some business objects. There is of course the Customer object.
    There is also a Products object, as well as an Orders and Transactions object.
    The second part of this two-part step is to describe your objects. The client Meet-A-Geek has given you
    the application form for potential customers. This is an excellent starting point to help you describe a
    customer. Take a look at Figure 3.9.

Free download pdf