我已創建了一個表,它是Employee表(MySQL的NOT NULL約束不起作用
create table person(
+--------+-----------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+-----------------+------+-----+---------+----------------+
| p_id | int(3) unsigned | NO | PRI | NULL | auto_increment |
| p_name | var char(50) | NO | | NULL | |
| p_add | var char(50) | NO | | NULL | |
| p_mob | int(10) | YES | | NULL | |
+--------+-----------------+------+-----+---------+----------------+
4 rows in set (0.02 sec)
而在插入過程中,如果我寫的查詢等,在集
insert into employee values ('1','','','');
+------+--------+-------+-----------+
| p_id | p_name | p_add | p_mob |
+------+--------+-------+-----------+
| 1 | | | 908765432 |
| 2 | | | 90 |
+------+--------+-------+-----------+
2行(0.00秒)
如果我留下所有其餘列空白,那麼它必須給出一些錯誤,因爲我已經在我的查詢中寫入這些所有列爲不爲空,但爲什麼仍然插入空白的空值,無論我嘗試小號甲骨文的代碼,然後它在工作。 MySQL有沒有問題?