Why does MySQL allow to update a NOT NULL column to NULL?

前端 未结 2 424
暗喜
暗喜 2021-01-12 20:07

I\'m running MySql in ubuntu 10.10. I created a table called \'employee\' having 3 field names empno, name and salary

2条回答
  •  天命终不由人
    2021-01-12 20:45

    I don't see the problem, you set the column to NOT NULL, (which doesn't allow NULL values) and now it won't let you set it to NULL, which would be the expected behaviour.

    The reason you have 0s in your DB is because 0 would be the result of casting NULL to an int.

提交回复
热议问题