GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Oracle  >  SQL
Go To First  |  Previous Question  |  Next Question 
 SQL  |  Question 158 of 171    Print  
How to add new column in the existing table at our desired location?

  
Total Answers and Comments: 7 Last Update: October 23, 2009     Asked by: vijay.akki 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: atmarammuduli
 
 You cannot do this. You can drop and re-create the table if you insist on the columns being in a particular order. Having the columns in a particular order is pretty much pointless. This question is asked on a regular basis. If you had searched, you should have quite quickly discovered this information.

Above answer was rated as good by the following members:
praveentn, seenu333p, shiiva
May 30, 2008 02:22:33   #1  
atmarammuduli Member Since: December 2007   Contribution: 8    

RE: How to add new column in the existing table at our desired location?
You cannot do this. You can drop and re-create the table if you insist on the columns being in a particular order. Having the columns in a particular order is pretty much pointless. This question is asked on a regular basis. If you had searched you should have quite quickly discovered this information.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 1Overall Rating: -N/A-    
June 10, 2008 06:46:47   #2  
dineshchaini Member Since: August 2006   Contribution: 7    

RE: How to add new column in the existing table at our desired location?
Alter Table<Tab_Name> add column <column_name> .. this is allowed in 9i but when the table fill with data and various constraint then it might not work..

and order of the column in a RDBMS is not at all important as per Codd's rules any time you can extract any column in any sequesnce.

Dinesh

 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    
July 17, 2008 04:45:17   #3  
Elavarasi Member Since: July 2008   Contribution: 1    

RE: How to add new column in the existing table at our desired location?
alter table table_name add column_name datatype
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 2Overall Rating: -1    
September 12, 2008 04:06:21   #4  
mahato.neelima Member Since: September 2008   Contribution: 2    

RE: How to add new column in the existing table at our desired location?
Syntax : - Alter Table <table_name> ADD Column (<column_name1> <data_type1>[size1] <column_name2> <data_type2>[size2] ...);

Example : - Alter Table Employee ADD Column (Address2 Varchar2(28) Phone2 Number(6));

 
Is this answer useful? Yes | No
March 30, 2009 07:31:48   #5  
aniketkatkar Member Since: March 2009   Contribution: 1    

RE: How to add new column in the existing table at our desired location?
You cannot do this. for this you must then drop or re-create the table with your order sequence of columns.
 
Is this answer useful? Yes | No
April 01, 2009 01:29:47   #6  
fkhalid Member Since: December 2006   Contribution: 1    

RE: How to add new column in the existing table at our desired location?
You can't add the column at desired location but you can create view and put the desired columns in order you required and use that view.
 
Is this answer useful? Yes | No
October 23, 2009 06:37:26   #7  
arunmscit86 Member Since: June 2008   Contribution: 2    

RE: How to add new column in the existing table at our desired location?
Syntax:
--------

Alter
table <Table_name> add <Column_name1> <Data_type1> after <Column_Name>;

Example:
-----------

Alter table employee add age int after emp_name;

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape