sergeidave Posted April 10, 2009 Share Posted April 10, 2009 Hi guys, If I create a field in a table as a "Not Null" would this prevent a new record to be created unless that field is properly filled? I'm playing around with a test website and I tried leaving blank a "Not null" field but the record was created anyway with that field empty. Maybe I'm not understanding the Null vs Notnull stuff correctly? If so, how would one restrict the creation of new records unless a not null field contains valid (or data at all) data? Thanks!! Link to comment https://forums.phpfreaks.com/topic/153556-null-vs-not-null/ Share on other sites More sharing options...
Yesideez Posted April 11, 2009 Share Posted April 11, 2009 Let's say you have a numeric field. You won't be able to insert nothing into the field (as it must be a number) so setting the field to NULL allows you to enter NULL instead. INSERT INTO table (`age`) VALUES (NULL) Link to comment https://forums.phpfreaks.com/topic/153556-null-vs-not-null/#findComment-807141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.