Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Oct 3, 2012

How to Add a Column, Rename or Edit the Column in Oracle.

In Oracle the syntax for Adding the Column in the existing Table:

Alter Table [Table Name] Add [Column Name] [Colum Type]
Eg 1:
ALTER TABLE Emp ADD emp_rank NUMBER;
Eg 2:
alter table emp add emp_rating number;

For renaming the Column Name of the Table in Oracle:

Syntax:
ALTER TABLE [Table Name] RENAME COLUMN [Column Name] TO [New Column Name];

Eg 1:
 ALTER TABLE Emp RENAME COLUMN emp_rank TO emp_rnk;

Eg 2:
alter table emp rename column emp_rating to rating;



How to Alter a Table in Oracle.

We can do the alteration of the table using command called Alter.
Syntax:
Alter Table [Table Name] Rename To [New Table Name]
Eg:
Alter Table Book Rename To Store_Books;
alter table Emp rename to tbl_Emp;