...

Database Managment - Oracle

Back to Course

Lesson Description


Lession - #1401 Oracle CREATE TABLE


Oracle CREATE TABLE

In Oracle, CREATE TABLE proclamation is utilized to make another table in the data set. To make a table, you need to name that table and characterize its segments and datatype for every section.
Syntax:

CREATE TABLE table_name  
(   
  column1 datatype [ NULL | NOT NULL ],  
  column2 datatype [ NULL | NOT NULL ],  
  ...  
  column_n datatype [ NULL | NOT NULL ]  
>
;

Parameters: table_name: It determines the name of the table which you need to make. column1, column2, ... section n: It determines the segments which you need to include the table. Each segment should have a datatype. Each segment ought to either be characterized as "Invalid" or "NOT NULL". For the situation, the worth is left clear; it is treated as "Invalid" as default

Oracle CREATE TABLE Example


CREATE TABLE customers  
( customer_id number(10>
NOT NULL, customer_name varchar2(50>
NOT NULL, city varchar2(50>
>
;

Oracle CREATE TABLE Example with primary key


CREATE TABLE customers  
( customer_id number(10>
NOT NULL, customer_name varchar2(50>
NOT NULL, city varchar2(50>
, CONSTRAINT customers_pk PRIMARY KEY (customer_id>
>
;