![]() Previous |
![]() Next |
You can use Database Control to create a table. Before you create and populate a table, you can estimate its size to ensure that you have sufficient space to hold its data.
In the following example, you create a table called purchase_orders in the nick schema that you created in Administering User Accounts and Security. The table has the following columns:
| Column Name | Data Type | Size | Not NULL |
|---|---|---|---|
PO_NUMBER |
NUMBER |
Yes | |
PO_DESCRIPTION |
VARCHAR2 |
200 | No |
PO_DATE |
DATE |
Yes | |
PO_VENDOR |
NUMBER |
Yes |
To create the PURCHASE_ORDERS table in the NICK schema:
Go to the Database Home page, logging in as user nick or as user SYSTEM.
At the top of the page, click Schema to view the Schema subpage.
In the Database Objects section, click Tables.
The Tables page appears.
Click
Create.
The Create Table: Table Organization page appears.
Select Standard, Heap Organized, and then click Continue.
The Create Table page appears.
In the Name field, enter purchase_orders as the table name, and in the Schema field, enter nick.
Because a default tablespace was specified when creating the user nick in the section "Example: Creating a User Account", accept the default tablespace setting for the table.
In the Columns section, enter column information for the purchase_orders table as specified in the table in the introduction to this topic. For example, for the first column in the purchase_orders table, enter the name PO_NUMBER and the data type NUMBER, and select the Not NULL check box.
For all purchase_orders columns, you can leave Scale and Default Value blank.
Note: To create the table with partitions, click Partitions at the top of the page during this step.
(Optional) Obtain an estimate of the table size by completing the following steps:
Click Estimate Table Size.
The Estimate Table Size page appears.
In the Projected Row Count field, enter 400000 (four hundred thousand), and then click Estimate Table Size.
The estimated results are calculated and displayed.
Click OK to return to the Create Table page.
The estimate of the table size can help you determine what values to use when specifying the storage parameters for the table.
Click Constraints to view the Constraints subpage, where you can designate a primary key for the table.
In the Constraints list, select PRIMARY, then click Add.
The Add PRIMARY Constraint page appears.
In the Available Columns list, select PO_NUMBER, and then click Move.
Note: You can also double-click PO_NUMBER.
The po_number column moves to the Selected Columns list.
Click Continue to return to the Constraints subpage of the Create Table page.
Click OK.
The Tables page returns, showing a confirmation message and listing the new table in the tables list. The purchase_orders table is now created with po_number as its primary key.