Example: Creating a Table

You can use SQL Developer to create a table.

In the following example, you create a table called purchase_orders in the HR schema. The table has the following columns:


Column Name Data Type Size Not Null Primary Key

PO_NUMBER

NUMBER

 

Yes

Yes

PO_DESCRIPTION

VARCHAR2

200

No

 

PO_DATE

DATE

 

Yes

 

PO_VENDOR

NUMBER

 

Yes

 

To create the PURCHASE_ORDERS table in the HR schema:

  1. In SQL Developer, navigate to the Tables node in the schema where you want to create the new table, as described in "Viewing Tables".
  2. Right-click the Tables node and select New Table.

    The Create Table dialog box appears, with the Table tab displayed.

    You can create simple tables quickly using only the default options on the Table tab. If you want to create more advanced tables, select the Advanced checkbox, which provides many more options for table creation. Unselect the Advanced checkbox to return to the default options on the Table tab.

  3. In the Schema field, select HR.
  4. In the Name field, enter PURCHASE_ORDERS.
  5. In the Columns section, enter column information for each of the columns in 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, select the Not Null check box, and click in the PK column to indicate that PO_NUMBER is the primary key for the table. Then click the green plus sign icon to add information for the next column. Continue in this manner until you have added the information for all of the columns to PURCHASE_ORDERS.
  6. Click OK.

    The PURCHASE_ORDERS table appears under the Tables node in the Connections navigator.

See Also:

" About Tables"