Is there any point in following up a AUTO INCREMENT with a NOT NULL?
Seeing as the db takes care of this, I assumed a AUTO INCREMENT will always have a value?
Mysql – Using Auto Increment and Not Null
MySQL
MySQL
Is there any point in following up a AUTO INCREMENT with a NOT NULL?
Seeing as the db takes care of this, I assumed a AUTO INCREMENT will always have a value?
Best Answer
Yes, because it is possible to manually insert data into this field. You wouldn't want anyone intentionally or accidentally adding a record that placed a NULL in your identity field.
On the flip side, if you are not using the field as an artificial key but for some other purpose, and having a null value is ok, then sure leave it off.