Megosztás a következőn keresztül:


The Database Design Process

If you use an established database design process, you can quickly and effectively create a well-designed database that provides you with convenient access to the information you want. With a solid design, you'll spend less time constructing the database and you'll end up with faster, more accurate results.

Note   The terms "database" and "table" are not synonymous in Visual FoxPro. The term database (.dbc file) refers to a relational database that is a container of information about one or more tables (.dbf files) or views.

The key to effective database design lies in understanding exactly what information you want to store and the way a relational database management system, such as Visual FoxPro, stores data. To efficiently and accurately provide you with information, Visual FoxPro needs to have the facts about different subjects organized into separate tables. For example, you might have one table that stores facts only about employees and another that stores facts only about sales.

When you organize your data appropriately, you design flexibility into your database and gain the capability to combine and present facts in many different ways.

When you design a database, you first break down the information you want to keep as separate subjects, and then you tell Visual FoxPro how the subjects are related to each other so that Visual FoxPro can bring the right information together when you need it. By maintaining information in separate tables, you make it easier to organize and maintain your data, as well as to build a high-performance application.

Here are the steps in the database design process. Each step is discussed in greater detail in the remaining topics of this section.

  1. Determine the purpose of your database   Knowing the purpose will help you decide which facts you want Visual FoxPro to store.
  2. Determine the tables you need   When you have a clear purpose for your database, you can divide your information into separate subjects, such as "Employees" or "Orders." Each subject will be a table in your database.
  3. Determine the fields you need   Decide what information you want to keep in each table. Each category of information in a table is called a field and is displayed as a column when you browse the table. For example, one field in an Employee table could be Last_name; another could be Hire_date.
  4. Determine the relationships   Look at each table and decide how the data in one table is related to the data in other tables. Add fields to tables or create new tables to clarify the relationships, as necessary.
  5. Refine your design   Analyze your design for errors. Create the tables and add a few records of sample data. See if you can get the results you want from your tables. Make adjustments to the design as needed.

Don't worry if you make mistakes or leave things out of your initial design. Think of it as a rough draft that you can refine later. Experiment with sample data and prototypes of your forms and reports. With Visual FoxPro, it's easy to change the design of your database as you're creating it. However, it becomes much more difficult to make changes to tables after they're filled with data and after you've built forms and reports. For this reason, make sure that you have a solid design before you proceed too far into building your application.

See Also

Designing Databases | Analysis of Data Requirements | Creating Databases | Working with Tables | Organization of Requirements into Tables