View previous topic :: View next topic
|
Author |
Message |
lakshmibala
New User
Joined: 16 Jun 2004 Posts: 47
|
|
|
|
Hi all
i have a doubt, can v insert a column in a table, is it possible to insert a column in the middle of the table?
Regards
Lakshmi |
|
Back to top |
|
|
jz1b0c
Active User
Joined: 25 Jan 2004 Posts: 160 Location: Toronto, Canada
|
|
|
|
Hi,
Yes you can do that, the procedure is first drop the table and then create |
|
Back to top |
|
|
ovreddy
Active User
Joined: 06 Dec 2004 Posts: 211 Location: Keane Inc., Minneapolis USA.
|
|
|
|
Hi,
We can add a new column using ALTER TABLE but not in the middle. We can do it by using one indirect method that is...
for example i have a table EMP with following columns
EMPNO,ENAME,JOB,DOB,DEPTNO
You want to insert a column SAL between JOB and DOB then apply the following steps...
ALTER TABLE EMP ADD COLUMN SAL NUMBER(5,2);
this will add SAL column at end. then create a view as follows...
CREATE VIEW EMPVIEW AS SELECT EMPNO,ENAME,JOB,SAL,DOB,DEPTNO;
and use the view instead of table ok...
Bye,
O.V.Reddy. |
|
Back to top |
|
|
karuna
New User
Joined: 03 May 2005 Posts: 10 Location: bangalore
|
|
|
|
Hi ovreddy,
what is NUMBER(5,2) in the Alter query below?Is this col no.?
ovreddy wrote: |
Hi,
We can add a new column using ALTER TABLE but not in the middle. We can do it by using one indirect method that is...
for example i have a table EMP with following columns
EMPNO,ENAME,JOB,DOB,DEPTNO
You want to insert a column SAL between JOB and DOB then apply the following steps...
ALTER TABLE EMP ADD COLUMN SAL NUMBER(5,2);
this will add SAL column at end. then create a view as follows...
CREATE VIEW EMPVIEW AS SELECT EMPNO,ENAME,JOB,SAL,DOB,DEPTNO;
and use the view instead of table ok...
Bye,
O.V.Reddy. |
|
|
Back to top |
|
|
vasanthanc
New User
Joined: 01 Apr 2005 Posts: 58
|
|
|
|
Karuna,
NUMBER is the data type of the field salary and (5,2) is the size of the field |
|
Back to top |
|
|
karuna
New User
Joined: 03 May 2005 Posts: 10 Location: bangalore
|
|
|
|
vasanthanc wrote: |
Karuna,
NUMBER is the data type of the field salary and (5,2) is the size of the field |
Vasanthac,
I know about Integer data type but i have never heard and used NUMBER data type thats y m asking.
Karuna |
|
Back to top |
|
|
ursjohn
New User
Joined: 25 Apr 2005 Posts: 5 Location: india
|
|
|
|
It is not possible to insert into middle records |
|
Back to top |
|
|
|