次の方法で共有


Table Creation

Tables store data in a row and column format, similar to a spreadsheet. Each row represents a record, and each column represents the fields in each record. Tables in Visual FoxPro can exist as a free table or as a database table.

A free table is a table (.dbf) file that is not associated with any database. A database table is a table file that is associated with a database. Database tables can have properties that free tables do not have, such as field-level and record-level rules, triggers, and persistent relationships. The following list includes some of the benefits database tables offer:

  • Long names for the table and for each field in the table.

  • Captions and comments for each table field.

  • Default values, input masks, and format for table fields.

  • Default control class for table fields.

  • Field-level and record-level rules.

  • Primary key indexes and table relationships to support referential integrity rules.

  • One trigger for each INSERT, UPDATE, or DELETE event.

However, free tables are useful for storing information outside of a database. For example, for example, you can use free tables to store lookup information that multiple databases share. For more information about the benefits of associating tables with a database, see Databases in Visual FoxPro.

To view a sample table, open one of the table (.dbf) files for the Northwind database located in the Visual FoxPro ...\Samples\Northwind directory. For more information, see How to: View Records in Tables.

Considerations for Table Creation

When creating tables, remember the following considerations:

  • Make sure field's data type matches the type of information you want to store.

  • Make sure the field is wide enough to accommodate the information it stores and displays.

  • Set an appropriate number of decimal places for Numeric or Float fields.

  • Make sure that fields that can accept null values are configured to accept them.

See Also

Tasks

How to: Create Free Tables

How to: Create Database Tables

Other Resources

Creating Tables

Working with Tables (Visual FoxPro)