How to Create Table in Oracle

How to Create Table in Oracle

Use the Create Table command in Oracle to create a table.

To create a table in Oracle, you need to specify the column names and their data types.

In Oracle, there are several kinds of data types. The most important and most commonly used data types are:

  • Varchar2
  • Number
  • Integer
  • Date
  • BLOB
  • CLOB

For more details on Oracle database data types, check this link.

To create a table in Oracle, first, connect to your Oracle database schema/user using your credentials. For example:

sqlplus scott/tiger@orcl

Below is the basic syntax of Create Table command:

Create Table table_name (
   column_name1 data_type1 [Primary Key],
   column_name2 data_type2 [Not Null],
   column_name3 data_type3
)
/

Check Oracle Create Table command in more detail.

Oracle Create Table Example

Create Table students (
  st_id integer Primary Key,
  rollno integer Not Null,
  st_name varchar2(100),
  admission_date date,
  st_photo blob
)
/

Check more Oracle Create table examples: