CREATE TABLE in Oracle

 next-topic-oraclemine

CREATE TABLE is used to create a new table in Oracle database. Oracle classifies it as DDL (Data Definition Language).

CREATE TABLE

Syntax

CREATE TABLE table_name  
(   
  columnname_1 datatype [ NOT NULL ],  
  columnname_2 datatype [ NOT NULL ],  
  ...  
  columnname_n datatype [ NOT NULL ]  
);
Parameters Explanation

table_name

  • Name of the table you want to create

columnname_1, columnname_2… columnname_n

  • Name of the columns you want to add in the table

datatype

  • Datatype of each column

NOT NULL

  • A column can be NULL or NOT NULL. By default if you don’t mention anything explicitly at the column level, the column will allow NULL values. Once you define the column as NOT NULL, it becomes mandatory to enter value in that column while inserting record.

Example of CREATE TABLE

CREATE TABLE employees
(   
  employee_id NUMBER(10) NOT NULL,  
  employee_name VARCHAR2(240),  
  birthdate DATE
);

Here, you have created table employees containing columns employee_id, employee_name and birthdate.

employee_id column is declared as NOT NULL which restricts you from keeping the column NULL during record insertion.

The maximum length of employee_id and employee_name you can enter is 10 and 240 respectively as mentioned in its datatypes.

I hope you like the page and find it useful. We highly appreciate comments and feedback.

You can also Subscribe here to stay updated on latest posts of OracleMine.com.

 next-topic-oraclemine

Hi I am Paras.

Thanks for stopping by at OracleMine.com. Speaking about my brief introduction, I work for a multinational organisation in Oracle related technologies. Being an avid blogger, I would like to inform you about my productivity and motivational blog XpressPlanet.com. Speaking of OracleMine.com, I will try my best to share knowledge on technologies in as simple and understandable manner as possible. You can also contribute your knowledge on OracleMine by writing to us at hioraclemine@gmail.com. Again I appreciate your visit. Hope to see you again and again!

2 thoughts on “CREATE TABLE in Oracle

  1. It was very nice..but small request from my side could you please post the topics which are related to Oracle apps technical consultant.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.