3.1. Designing a Database

Designing the database includes identifying the data that you need and organizing the data in the way that the database software requires.

3.1.1. Choosing the data

To design a database, you first must identify what information belongs in it. The database must contain the data needed for the Web site to perform its purpose.

Here are a few examples:

  • An online catalog needs a database containing product information.

  • An online order application needs a database that can hold customer information and order information.

  • A travel Web site needs a database with information on destinations, reservations, fares, schedules, and so on.

In many cases, your application might include a task that collects information from the user. Customers who buy things from a Web site must provide their address, phone number, credit card information, and other data in order to complete the order. The information must be saved at least until the order is filled. Often, the Web site retains the customer information to facilitate future orders so the customer doesn't need to retype the information when placing the next order. The information also provides marketing opportunities to the business operating the Web site, such as sending marketing offers or newsletters to customers.

A customer database might collect the following customer information:

  • Name

  • Address

  • Phone number

  • Fax number

  • E-mail address

You have to balance your urge to collect all the potentially useful information you can think ...

Get PHP & MySQL® Web Development All-in-One Desk Reference for Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.