<>Mysql修改表字段类型
* 查看表结构 mysql> desc orders ; +
-------------+-------------+------+-----+---------+-------+ | Field | Type |
Null | Key | Default | Extra | +
-------------+-------------+------+-----+---------+-------+ | shipaddress |
varchar(20) | YES | MUL | NULL | | | shipcity | varchar(20) | YES | | NULL | | +
-------------+-------------+------+-----+---------+-------+ 2 rows in set (0.13
sec)
* 修改表字段 mysql> alter table orders modify column shipaddress int(20) ; Query OK
, 0 rows affected (0.85 sec) Records: 0 Duplicates: 0 Warnings: 0
* 查看修改后的类型 mysql> desc orders ; +
-------------+-------------+------+-----+---------+-------+ | Field | Type |
Null | Key | Default | Extra | +
-------------+-------------+------+-----+---------+-------+ | shipaddress | int(
20) | YES | MUL | NULL | | | shipcity | varchar(20) | YES | | NULL | | +
-------------+-------------+------+-----+---------+-------+ 2 rows in set (0.00
sec)
热门工具 换一换