这里讲的有点模糊,有错误
老师你2-13这一集的01:10~01:25时段应该刚错了,UNIQUE KEY 约束的字段其实可以有多个空值,你说成只能有一个空值了
>show columns from user4;
+----------+---------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------------------+------+-----+---------+----------------+
| id | smallint(6) | NO | PRI | NULL | auto_increment |
| username | varchar(20) | YES | UNI | NULL | |
| age | tinyint(3) unsigned | YES | | NULL | |
+----------+---------------------+------+-----+---------+----------------+
>select * from user4;
+----+----------+------+
| id | username | age |
+----+----------+------+
| 1 | NULL | 23 |
| 2 | tom | 23 |
| 3 | NULL | 24 |
+----+----------+------+