关于mysql调整表属性顺序问题现在有一张表test
三个字段、name id age
里面已经有很多条数据了、我现在想把id 和name换个顺序、
当然数据库的记录也要调整顺序请问该怎么搞?谢谢!

解决方案 »

  1.   

    主键是什么?
    如果主键是name,那么建议不要换
    用select id,name,age from test一样的结果另外换字段顺序建议可以用复制表,然后drop原来的表,再复制回来create table temp as select id,name,age from test;
    drop table test;
    create table test as select id,name,age from test;
    drop table temp;注:上面建表语句是oracle中的,不知道mysql适合否,楼主可以试试