在phpMyAdmin
,當我們創建表時,默認情況下,所有字段都不存在空約束......並且根據我的知識,當我們將約束設置爲非空時......它不允許用戶保留字段爲空這是不是null按照該鏈接.....非空混淆
http://www.techopedia.com/definition/27370/not-null-constraint
現在我的問題is..according這個環節,而不是null表示數據的每一行必須包含一個價值 - 它不能在插入或更新操作期間留空白.....但是當我像insert into
一樣以編程方式插入數據時,我能夠在兩個字段中插入數據,而其他字段仍保持空白,儘管在該字段上沒有空約束......並且仍然不會產生任何錯誤....所以我不明白如何不空作品?
例如,我創建表,可以說5場......
create table myTable
(
Column1 int not null,
Column2 int not null,
Column3 int not null,
Column4 int not null,
Column5 int not null,
)
,並在短短的領域,如
"INSERT INTO myTable (column1,column2) VALUES(10,20)";
插入值,但其他領域我不給任何''
所以它需要0
作爲值....仍然我能夠插入數據沒有錯誤...這怎麼可能?
可能的重複[我設置MySQL列爲「NOT NULL」,但我仍然可以插入一個空值](http://stackoverflow.com/questions/7264702/i-set-a-mysql-column-to -not-null-but-still-i-can-insert-an-empty-value) –