Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2005
    Posts
    7

    Choosing NOT NULL fields

    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?
    Thanks.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    That's basically it. If the field needs to have a value, then set it to NOT NULL.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Dec 2005
    Posts
    7
    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.

  4. #4
    Join Date
    Feb 2005
    Location
    Colorado Springs
    Posts
    222
    Another issue with NULL values is not to use them on key fields.

  5. #5
    Join Date
    May 2003
    Posts
    13
    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.

    Null Recommendations:
    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".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •