在mysql中,创建表时将一个栏位错建成teano(正确为teamno),请问有啥既快又好的方法将其更正!!!谢谢啦~~~~~~~~~

解决方案 »

  1.   

    mysql> create table t_Forcast457(teano int);
    Query OK, 0 rows affected (0.08 sec)mysql> insert into t_Forcast457 values (10),(20);
    Query OK, 2 rows affected (0.06 sec)
    Records: 2  Duplicates: 0  Warnings: 0mysql> desc t_Forcast457;
    +-------+---------+------+-----+---------+-------+
    | Field | Type    | Null | Key | Default | Extra |
    +-------+---------+------+-----+---------+-------+
    | teano | int(11) | YES  |     | NULL    |       |
    +-------+---------+------+-----+---------+-------+
    1 row in set (0.00 sec)mysql> select * from t_Forcast457;
    +-------+
    | teano |
    +-------+
    |    10 |
    |    20 |
    +-------+
    2 rows in set (0.00 sec)-- 既快又好的方法将其更正
    mysql> alter table t_Forcast457 change teano teamno int;
    Query OK, 0 rows affected (0.06 sec)
    Records: 0  Duplicates: 0  Warnings: 0mysql> desc t_Forcast457;
    +--------+---------+------+-----+---------+-------+
    | Field  | Type    | Null | Key | Default | Extra |
    +--------+---------+------+-----+---------+-------+
    | teamno | int(11) | YES  |     | NULL    |       |
    +--------+---------+------+-----+---------+-------+
    1 row in set (0.00 sec)mysql> select * from t_Forcast457;
    +--------+
    | teamno |
    +--------+
    |     10 |
    |     20 |
    +--------+
    2 rows in set (0.00 sec)mysql>