Adding new column after column and defining a default
alter-table, database, mysql
Solution
If I'm reading the documentation for `alter table` correctly this time... you're only able to specify `after` or `default`, but not both. You could work around this by creating the column using `after`, and then altering it to have the `default`:
alter table pageareas add content_userDefined BIT( 1 ) NULL after content;
alter table pageareas alter content_userDefined set default 0;
Problem
I am trying to add a column after another column while also specifying a default value. Below is my attempt that does not work. ``` alter table pageareas add content_userDefined BIT( 1 ) NULL default 0 after content; ``` If I remove "after content" it works: ``` alter table pageareas add content_userDefined BIT( 1 ) NULL default 0; ``` And if I remove "default 0" it works: ``` alter table pageareas add content_userDefined BIT( 1 ) NULL after content; ``` How can I accomplish adding it after a specified column while also defining a default value? I am using MySql 5.1.36