Planning the Data

One of the best pieces of advice ever given to one of the authors is this: "When working with a computer, think like a computer." This means create the databases in a logical manner.

Here are some tips to get you started:

  • Determine what is to be stored in the database. "Text" isn't an answer. It could be a product description, a list of member's last names, a list of image names, or whatever.

  • Decide what each piece of data looks like. If it's a product description, it would be a text field in a database.

  • Decide how the data will be presented. If it's a table-based layout, then each cell of the Dreamweaver table will hold content.

  • Determine a model that meets your needs. The model is a representation of the data in a database. It consists of fields that hold data and tables. Tables are the logical grouping of the fields for the data that these fields may store. Various tables within your database will have data that is tied to other tables. This is known as a relationship, which we will discuss shortly. Don't simply copy a model that makes sense for you and bend the technology around that model?that is inefficient and wastes time. The model should fit your needs, not the other way around.

  • Determine the relationships between the tables in the database. Relationships between tables enable you to consolidate your data and avoid needless repetition. Using the community center as an example, just because a member books a tennis court ten times is no reason to create ten copies of that member's data. Each of the ten entries in the booking table would contain a field containing an ID that links to a record in the membership table containing the member's data.

  • Account for the present and the future. Situations change as data is added or removed, and failure to plan ahead will create a maintenance problem. Using our community center as an example, it is easy to plan a model that enables us to add new types of activities and delete ones no longer available. For example, if we decide to add power skating as an activity, we would accommodate this new entry in a table that contains a list of available activities. Therefore, having a model that includes a table of activities accounts for this type of growth. It would be expensive later to attempt to graft power skating onto a model that wasn't built to accommodate growth, such as a table with the activities hard-wired as fields.