create table tableF select * from tableA; alter table...
create table tableF select * from tableA; alter table tablef ADD [CONSTRAINT [symbol]] FOREIGN KEY [index_name] (index_col_name,...); alter table tablef CHARACTER SET charset_name
先CREATE再ALTER并不能保证你的字符集设置。 事后的字符集设计修改仅对之后插入的记录有效。还是应该先创建表,然后再添加记录。create table tableF select * from tableA where 1<0; alter table tableF ADD PRIMARY KEY (id) CHARACTER SET 'gbk'; insert into tableF select * from tableA ;
alter table...
alter table tablef ADD [CONSTRAINT [symbol]]
FOREIGN KEY [index_name] (index_col_name,...);
alter table tablef CHARACTER SET charset_name
alter table tableF ADD PRIMARY KEY (id) CHARACTER SET 'gbk';
insert into tableF select * from tableA ;