Create Normal Table and Global Temporary Table in Oracle
We can create two types of Table in Oracle.
1) Normal Table (CREATE TABLE Command)
2) Global Temporary Table (CREATE GLOBAL TEMPORARY TABLE Command)
How to create a Normal Table in Oracle?
The create table command allows you to create normal table in Oracle. The syntax of CREATE TABLE command is as follows:
CREATE TABLE table-name ( Column-1 data-type null/not null, Column-2 data-type null/not null, ... );
It is mandatory to have a data type of a column. You can define a column either as NULL or NOT NULL and if this value is left blank, the oracle database assumes it NULL by default.
You can see the below example where two columns are defined as NOT NULL and two without NULL, it means the column can have NULL values by default.
CREATE TABLE TB_EMPLOYEE ( EMP_ID NUMBER(10) NOT NULL, EMP_NAME VARCHAR2(50) NOT NULL, EMP_CITY VARCHAR2(50), EMP_STATE VARCHAR2(50) );
How to create Global Temporary Table in Oracle?
You can create and manage Global temporary tables within SQL sessions. You can create Global temporary table using following syntax:
CREATE GLOBAL TEMPORARY TABLE table-name ( Column-1 data-type null/not null, Column-2 data-type null/not null, ... );
Following example would create a Global Temporary table called TB_EMPLOYEE in Oracle.
CREATE GLOBAL TEMPORARY TABLE TB_EMPLOYEE ( EMP_ID NUMBER(10) NOT NULL, EMP_NAME VARCHAR2(50) NOT NULL, EMP_CITY VARCHAR2(50), EMP_STATE VARCHAR2(50) );
I hope you understood how to create normal table and global temporary table in Oracle.
I use SEMRush for Keyword Research & Boost Organic Traffic. Do You?
Highly recommended SEM & SEO Tool for overview of Traffic, Keywords, Backlinks and more. You can search your competitors URL to analyze keywords & crush your competition.
Get Free Blogging Tips & Technology updates in your Email !!!
Latest posts by Anil Kumar (see all)
- Top 3 Custom Sidebar WordPress Plugins for Post & Pages - October 17, 2015
- Bluehost Coupon Codes Up To 75% OFF – August 2015 - August 25, 2015
- Make Money Online: $50-$100 Daily with Affiliate Marketing - August 10, 2015