Creating a Database Table

You can create a new table in a database through the menu system, the Project Manager, or through the language. As you create the table, you can create long table and field names, default field values, field- and record-level rules, as well as triggers.

To create a new database table

  1. In the Project Manager, choose Tables under Databases.

  2. Choose New, and then choose New Table.

  3. In the Create dialog box, enter a name for the table and choose Save.

  4. On the Fields tab of the Table Designer, type the name for the first field in the Name field.

  5. In the Type field, select a field type from the list.

  6. In the Width column, set the width of the column in characters.

  7. If Type is Numeric or Float, set the number of decimal places to display in the Decimal box.

  8. If you want to add an index to the field, select a sort order in the Index column.

  9. If you want the field to accept the input of null values, select NULL. You can choose to begin entering records immediately, or open the table later when ready to enter records.

    -or-

For example, the following code creates the table smalltbl with one column, called name:

OPEN DATABASE Sales
CREATE TABLE smalltbl (name c(50))

The new table is automatically associated with the database that is open at the time you create it. This association is defined by a backlink stored in the table's header record.

To add records to a table

  1. In the Project Manager, select the name of the table.

  2. Choose Browse.

  3. From the View menu, choose Append Mode.

  4. Enter new record changes in the Browse window.

    If you prefer to view each field on a separate line, switch to Edit mode by choosing Edit from the View menu.

See Also

Table Creation | Creating a Free Table | Working with Tables | Naming a Table | Renaming a Table | Viewing Data in Tables | Customizing a Browse Window | Customizing Tables