mysql 字段添加以及删除
mysql> select * from user; +------+-----------+-----------+ | id | name | address | +------+-----------+-----------+ | 1 | xiaoming | beijing | | 2 | xiaobai | shandong | | 3 | xiaohong | suzhou | | 4 | xiaohei | changchun | | 5 | xiaoli | dongjing | | 6 | xiaohuang | meiguo | | 1 | xiaoming | beijing | | 1 | xiaoming | beijing | | 1 | xiaoming | beijing | +------+-----------+-----------+ 9 rows in set (0.00 sec) mysql> alter table user add ziduan char(10) null; Query OK, 0 rows affected (0.05 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> select * from user; +------+-----------+-----------+--------+ | id | name | address | ziduan | +------+-----------+-----------+--------+ | 1 | xiaoming | beijing | NULL | | 2 | xiaobai | shandong | NULL | | 3 | xiaohong | suzhou | NULL | | 4 | xiaohei | changchun | NULL | | 5 | xiaoli | dongjing | NULL | | 6 | xiaohuang | meiguo | NULL | | 1 | xiaoming | beijing | NULL | | 1 | xiaoming | beijing | NULL | | 1 | xiaoming | beijing | NULL | +------+-----------+-----------+--------+ 9 rows in set (0.00 sec) mysql> alter table user drop column ziduan; Query OK, 0 rows affected (0.06 sec) Records: 0 Duplicates: 0 Warnings: 0 mysql> select * from user; +------+-----------+-----------+ | id | name | address | +------+-----------+-----------+ | 1 | xiaoming | beijing | | 2 | xiaobai | shandong | | 3 | xiaohong | suzhou | | 4 | xiaohei | changchun | | 5 | xiaoli | dongjing | | 6 | xiaohuang | meiguo | | 1 | xiaoming | beijing | | 1 | xiaoming | beijing | | 1 | xiaoming | beijing | +------+-----------+-----------+ 9 rows in set (0.00 sec)