預設是空的。
除非你這個新加的列, 是 NOT NULL , 並且設定了 DEFAULT
例子程式碼如下:
mysql> create table test11(id int);
Query OK, 0 rows affected (0.01 sec)
mysql> insert into test11 values(100);
Query OK, 1 row affected (0.00 sec)
mysql> ALTER TABLE test11 ADD name varchar(10) not null default "ABC";
Query OK, 1 row affected (0.02 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> select * from test11;
+------+------+
| id | name |
| 100 | ABC |
1 row in set (0.00 sec)
預設是空的。
除非你這個新加的列, 是 NOT NULL , 並且設定了 DEFAULT
例子程式碼如下:
mysql> create table test11(id int);
Query OK, 0 rows affected (0.01 sec)
mysql> insert into test11 values(100);
Query OK, 1 row affected (0.00 sec)
mysql> ALTER TABLE test11 ADD name varchar(10) not null default "ABC";
Query OK, 1 row affected (0.02 sec)
Records: 1 Duplicates: 0 Warnings: 0
mysql> select * from test11;
+------+------+
| id | name |
+------+------+
| 100 | ABC |
+------+------+
1 row in set (0.00 sec)