Planning a database - DRAFT

From Apache OpenOffice Wiki
Jump to: navigation, search

The first step in creating a database is to ask yourself many questions. Write them down, and leave some space between the questions to later write the answers. At least some of the answers should seem obvious after you take some time to think.

You may have to go through this process a few times before everything becomes clear in your mind and on paper. Using a text document for these questions and answers makes it easier to move the questions around, add additional questions, or change the answers.

Here are some of the questions and answers I developed before I created a database for automobile expenses. I had an idea of what I wanted before I started, but as I began asking questions and listing the answers, I discovered that I needed additional tables and fields.

What are the fields going to be? 
My expenses divided into three broad areas: fuel purchases, maintenance, and vacations. The annual cost for the car's license plate and driver's license every four years did not fit into any of these. It will be a table of its own: license fees.
What fields fit the fuel purchases area? 
Date purchased, odometer reading, fuel cost, fuel quantity, and payment method fit. (Fuel economy can be calculated with a query.)
What fields fit the maintenance area? 
Date of service, odometer reading, type of service, cost of service, and next scheduled service of this type (for example, for oil changes list when the next oil change should be). But it would be nice if there was a way to write notes. So, a field for notes was added to the list.
What fields fit the vacations area? 
Date, odometer reading, fuel (including all the fields of the fuel table), food (including meals and snacks), motel, total tolls, and miscellaneous. Since these purchases are made by one of two bank cards or with cash, I want a field to state which payment type was used for each item.
What fields fit into the food category? 
Breakfast, lunch, supper, and snacks seem to fit. Do I list all the snacks individually or list the total cost for snacks for the day? I chose to divide snacks into two fields: number of snacks and total cost of snacks. I also need a payment type for each of these: breakfast, lunch, supper, and total cost of snacks.
What are the fields that are common to more than one area? 
Date appears in all of the areas as does odometer reading and payment type.
How will I use this information about these three fields? 
While on vacation, I want the expenses for each day to be listed together. The date fields suggest a relationship between the vacation table and the dates in each of these tables: fuel and food, This means that the date fields in these tables will be linked as we create the database. The type of payment includes two bank cards and cash. So, we will create a table with a field for the type of payment and use it in list boxes in the forms.
Tip.png While we have listed fields we will create in the tables of the database, there is one more field that may be needed in a table: the field for the primary key. In some tables, the field for the primary key has already been listed. In other tables such as the payment type, an additional field for the primary key must be created.

Content on this page is licensed under the Creative Common Attribution 3.0 license (CC-BY).
Personal tools