id int not null auto_increment primary key,
hoge1 text,
hoge2 text,
hoge3 text,
hoge4 bool
);
alter table hoge add hoge4 bool;
というようなSQL文をMySQL4.0系で実行して、「Duplicate column name 'hoge4'」とエラーが出る場合、このエラーの回避方法を教えて下さい。
CREATE TABLE hoge(
id int not null auto_increment primary key,
hoge1 text,
hoge2 text,
hoge3 text,
hoge4 bool //この時点でhoge4列が作成されている。
);
alter table hoge add hoge4 bool; //hogeテーブルにhoge4を追加しようとしているが、すでにcreate table時に出来ているので追加できない。
追加する列名(alter addする列名)hoge4を変更してください。 列名はユニークでなければなりません。