Create Table in Oracle: Step-by-Step Guide

To create a table in Oracle database, you can use the CREATE TABLE statement with the following syntax:

CREATE TABLE table_name
(
   column1 datatype [ NULL | NOT NULL ],
   column2 datatype [ NULL | NOT NULL ],
   ...
   columnN datatype [ NULL | NOT NULL ],
   PRIMARY KEY (column_name)
);

In this, table_name is the name of the table to be created, column1, column2, … columnN are the names of the columns to be created, datatype is the data type of each column, NULL indicates that the column can be empty, NOT NULL indicates that the column cannot be empty. PRIMARY KEY (column_name) is used to define the primary key constraint.

For instance, to create a table named employee with columns id, name, age, and salary, where id is the primary key and the data types are NUMBER, VARCHAR2, NUMBER, and FLOAT respectively, you can use the following SQL statement:

CREATE TABLE employee
(
   id NUMBER PRIMARY KEY,
   name VARCHAR2(50),
   age NUMBER,
   salary FLOAT
);
bannerAds