I have a table AA which it's definition is:
CREATE TABLE `AA` (
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
I would like to add a column to the table however I want this column to be between b
and `c, If I would create the table now it would have been like:
CREATE TABLE `AA` (
`a` int(11) NOT NULL,
`b` int(11) NOT NULL,
`ba` int(11) NOT NULL,
`c` int(11) NOT NULL,
PRIMARY KEY (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
The thing is that the table already contains data so I can not drop and recreate it. When I use alter table add column
it adds the column to the end.
How do I insert a new column in specific position?