图1
在test_user_two
表中添加一个名为year1
,数据类型是int
,且不可为空的字段;
执行相关sql
语句;
mysql> alter table test_user_two add year1 int not null;
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql>
看下表结构;
mysql> desc test_user_two;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| id | int | NO | PRI | NULL | |
| name | varchar(25) | YES | | NULL | |
| deptid | int | YES | | NULL | |
| howmoney | int | YES | | NULL | |
| year | int | YES | | NULL | |
| year1 | int | NO | | NULL | |
+----------+-------------+------+-----+---------+-------+
6 rows in set (0.00 sec)
mysql>
重启数据库
错误提醒了一半?