Hi. I'm attending a databse designing course and I have a doubt writing the physical structure (I'm using MySQL). I can't understand how to choose to put or not the NOT NULL constrain. I mean, is there a particular reason or is it only a choosing whether a field has to be completed or not? On which basis do you decide to put it or not?
The strange thing I can't understand is this: when I've been taught how to design the conceptual structure of the database, I learned to use fields with multiplicity. If I wanted a field to be "optional", I would have used a multiplicity (0,1) for instance. So, my doubt: why could I want to allow a field to be NULL? I mean, if I wanted to allow it to be NULL, I should have used a multiplicity (0,1). Maybe it was only a stupid doubt.
Thanks for your answer.
Not Null Recommendations:
• In general, always use the not null option for a column if business data always exists.
• When using "not null with default" option, the default value may be
1) user-defined, or
2) system-created. The default value has to have a clear business meaning, in either case.
• Use the null option for a column only if business data is not available or not applicable to the columns, particularly columns with date or numeric data types.
• When implementing Relational Integrity, foreign keys should not be implemented as "not null with default" unless the default value appears in the related table. If the foreign key may be nullable, it is preferable not to use "not null with default".