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
In the Project Manager, choose Tables under Databases.
Choose New, and then choose New Table.
In the Create dialog box, enter a name for the table and choose Save.
On the Fields tab of the Table Designer, type the name for the first field in the Name field.
In the Type field, select a field type from the list.
In the Width column, set the width of the column in characters.
If Type is Numeric or Float, set the number of decimal places to display in the Decimal box.
If you want to add an index to the field, select a sort order in the Index column.
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-
- Use the CREATE TABLE command with a database open.
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
In the Project Manager, select the name of the table.
Choose Browse.
From the View menu, choose Append Mode.
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