Results 1 to 3 of 3
  1. #1
    Join Date
    May 2015
    Posts
    2

    Unanswered: Database design - If yes, then what date...

    I am not a database designer or programmer, but I am modeling, as best as I can an new database using MySQL Workbench so that I can pass it on to the database developer...

    Here's my question...I am creating my tables, and have a field A that is a yes/no answer...The next field B is a date field..."If row A is "yes", then provide the date in field "B"...

    Since field B is dependent on the answer to Field A, is this just issue addressed in the code, or do I need do something special with the fields in the table? So if Field A is yes, then a date is required in Field B, otherwise field B is blank...

    I know this is a trivial question, so I appreciate your patience and your help...

    Thanks.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Since this is a MySQL question, I moved it from the Microsoft SQL Server forum into the MySQL forum.

    If a value in the date field indicates that there was a "Yes" to the "Yes/No" field, then only have the Date field. If the Date Field is NULL, then the value in the "Yes/No" field is "No". If there is a date in the date field, then the value in the "Yes/No" field is "Yes". This simplifies the design and removes the possibility of conflict between the fields (such as a Yes with no date or a No with a date).

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    May 2015
    Posts
    2

    Makes perfect sense!

    Quote Originally Posted by Pat Phelan View Post
    Since this is a MySQL question, I moved it from the Microsoft SQL Server forum into the MySQL forum.

    If a value in the date field indicates that there was a "Yes" to the "Yes/No" field, then only have the Date field. If the Date Field is NULL, then the value in the "Yes/No" field is "No". If there is a date in the date field, then the value in the "Yes/No" field is "Yes". This simplifies the design and removes the possibility of conflict between the fields (such as a Yes with no date or a No with a date).

    -PatP
    Thanks...That makes perfect sense!

Posting Permissions

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