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 related topics.
- Determine the purpose of your database Knowing the purpose will help you decide which facts you want Visual FoxPro to store. For more information, see Analyzing Data Requirements.
- 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. For more information, see
Organizing Requirements into Tables
- 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. For more information,
see Determining the Fields You Need
- 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. For more information, see Identifying Relationships
- 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. For more information, see Refining the Design
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.
You can use
the Database Designer to define a set of tables and link them with
relationships that persist whenever you use the tables.
Take a
look at the sample database. To open the database in the Database
Designer, choose Open from the File menu, and locate Testdata.dbc in the
Visual FoxPro ...\Samples\Data directory.
The Database Designer shows the relationships between tables
No comments:
Post a Comment