Thread: alter table, placing the new column after the id

alter table, placing the new column after the id

From
"Zouari Fourat"
Date:
Hello,
When trying to alter my table to add a column, it will be added at the
end of the table, i want to get my column after a given column name,
for example get my table like this :

ID
firstname
lastname
<---    my new added column here
adrress
country
<---    not here !

how to get it ?

Re: alter table, placing the new column after the id

From
Sean Davis
Date:
You can't, I don't think.  You could copy the old table to a new table using

 insert into .... Select ....

And then rename the new table to the old.  Alternatively, you could specify
a view with the columns in the correct order.

Sean

On 2/28/06 2:13 PM, "Zouari Fourat" <fourat@gmail.com> wrote:

> Hello,
> When trying to alter my table to add a column, it will be added at the
> end of the table, i want to get my column after a given column name,
> for example get my table like this :
>
> ID
> firstname
> lastname
> <---    my new added column here
> adrress
> country
> <---    not here !
>
> how to get it ?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match