Skip to content
Home » Oracle » PL/SQL Developer Create Table Example

PL/SQL Developer Create Table Example

How to create a new table in Oracle?

To create a new table, we can choose to compose a hand-writing PL/SQL statement which may be lengthy, complex, and error-prone. Or, we can also use handy GUI tools like PL/SQL developer to reach the goal.

PL/SQL developer is a GUI tool for connecting Oracle, which is mainly used by developers who want to create some schema objects and program stored procedures in an easier and visualized way.

In this post, I'd like to illustrate how to create a table in PL/SQL Developer step by step. For creating tables in SQL developer, there's also a tutorial for you.

Let's see the procedure.

  1. New a Table
  2. Table Attributes
  3. Columns
  4. Keys
  5. Constraints
  6. Indexes
  7. Preview DDL
  8. Table Created

New a Table

We click on the icon of blank document and click "Table" to initiate the table creation.

PL/SQL Developer - Create Table - New Table
PL/SQL Developer - Create Table - New Table

Table Attributes

We enter table name, comment etc in the first tab.

PL/SQL Developer - Create Table - Table Attributes
PL/SQL Developer - Create Table - Table Attributes

Columns

We can add some more columns for the table in "Columns" tab.

PL/SQL Developer - Create Table - Column Definitions
PL/SQL Developer - Create Table - Column Definitions

Please note that, not null columns should uncheck "Nullable".

Keys

To add primary key, unique key or foreign key, we can go for "Keys" tab. Here we add a primary key for the table.

PL/SQL Developer - Create Table - Key
PL/SQL Developer - Create Table - Key

Please note that, the tool uses out_of_line_constraint to create primary key, unique key or foreign key. To create nonunique (normal) indexes, you should go for "Indexes".

Constraints

To add more constraints, we can go for "Constraints" tab. Here we add a check constraint for a column.

PL/SQL Developer - Create Table - Constraint
PL/SQL Developer - Create Table - Constraint

Indexes

To add more indexes, we can go for "Indexes" tab. Here we create a nonunique (normal) index for a column.

PL/SQL Developer - Create Table - Index
PL/SQL Developer - Create Table - Index

We click "View SQL" to preview DDL of the table.

Preview DDL

We preview the final result by viewing the DDL before actually creating it.

PL/SQL Developer - Create Table - Preview DDL
PL/SQL Developer - Create Table - Preview DDL

We click "Apply" to confirm the table creation.

PL/SQL Developer - Create Table - Table Created
PL/SQL Developer - Create Table - Table Created

We click "Close" to close the window.

Table Created

In the table list, we can see its definition.

PL/SQL Developer - Create Table - Table Schema
PL/SQL Developer - Create Table - Table Schema

We have created a new table in PL/SQL developer.

Leave a Reply

Your email address will not be published. Required fields are marked *