Define a table

Define a table by using the New Table Definition wizard. Tables are logical structures that are maintained by the database manager. Tables consist of columns and rows. You can define tables as part of your data definitions in the Data perspective.

Prerequisite: Before you can define a table, define a database and a schema.

To define a table:

  1. In the Data Definition view of the Data perspective, right-click the Tables folder under your schema, and select New > Table Definition to open the New Table Definition wizard.

  2. Complete the steps of the wizard to define table properties, add columns, and define primary and foreign keys. Table identifiers that contain a period (.) character, for example, "my.table", are not supported. The period can be used to create a qualified identifier, for example, "myschema"."mytable".

  3. Click Finish. The table is added to the Tables folder.

You must define at least one column and a primary key for the table. You can define foreign keys if other tables are already defined.

If you delete a primary key (either by removing the constraint, its columns, or the table that defines it), any foreign key constraints that reference the key are also removed.

You can edit the table information, add or delete columns, change the primary key, and add or delete foreign keys by using the table editor. To open the table editor, double-click on the table in the Data Definition view.

Defining a column
Define a column by using the New Table Definitions wizard. A column defines a unit of information within a table row. Each row is an entry in the table. Each column is a category of information that applies to all rows.

Defining a primary key
Define a primary key by using the Table Definition wizard. A primary key consists of a column or columns whose value uniquely identifies a row. There can only be one primary key per table. When you define a primary key for a table, you create a constraint on data in the table, which ensures that any row in the table can be uniquely identified by its key columns.

Defining a foreign key
Define a foreign key by using the New Table Definition wizard. A foreign key consists of one or more columns in a table whose value in one row uniquely identifies another row in the same or another table.

 

Parent topic

Defining database objects