标签:4.0 nim and 设置 name 内容 warning -- warnings
之前建立的表, 没有填内容却忘记了建立时设置的结构.
使用
desc <表名>;
查看table的结构, 如下
mysql> desc animal; +--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | name | varchar(20) | YES | | NULL | | | weight | int(11) | YES | | NULL | | | age | int(11) | YES | | NULL | | | living_place | varchar(20) | YES | | NULL | | | color | int(11) | YES | | NULL | | +--------------+-------------+------+-----+---------+-------+ 5 rows in set (0.03 sec)
然后发现color项的数据类型建立错了, 需要修改数据类型.
语法:alter table <表名> modify <字段名> <数据类型>
如下:
mysql> alter table animal modify color varchar(20); Query OK, 1 row affected (0.08 sec) Records: 1 Duplicates: 0 Warnings: 0 mysql> desc animal; +--------------+-------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +--------------+-------------+------+-----+---------+-------+ | name | varchar(20) | YES | | NULL | | | weight | int(11) | YES | | NULL | | | age | int(11) | YES | | NULL | | | living_place | varchar(20) | YES | | NULL | | | color | varchar(20) | YES | | NULL | | +--------------+-------------+------+-----+---------+-------+ 5 rows in set (0.01 sec)
标签:4.0 nim and 设置 name 内容 warning -- warnings
原文地址:http://www.cnblogs.com/sldafa/p/7647645.html