How to set values to a field in database using sql server 2005

  • Hello World:-)

    How should i set a values from my database like...

    I have 3 tables...namely Bio Table, Sex Table, Status Table

    *Bio Table

    BioID

    Firstname

    Middlename

    Lastname

    sexID

    statusID

    *Sex Table

    sexID

    sex(male or female)

    *Status Table

    statusID

    status(single, married or divorced)

    question..

    how should i set the sex and status table, in such a way in only contains male or female,,,,or single or married or divorce

    Please help me??...

    God Speed!!!

  • You can add CHECK constraints to the table.

    CHECK Constraints

    On a sidenote: is it really necessary to normalize the sex table? You can easily store 'M' and 'F' in the bio table. One character takes up the same space as an integer and it saves you a join.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Thank you my friend:-)

    yeah you are right that is also my question why the sex and status table should be normalize..

    what do you think is the reason??...

  • enriquezreyjoseph (9/19/2013)


    Thank you my friend:-)

    yeah you are right that is also my question why the sex and status table should be normalize..

    what do you think is the reason??...

    Normalization is very important in OLTP systems, in order to deduplicate data, have better consistensy and allow for faster updates and inserts.

    However, it seems to me a bit overkill to normalize for only two values.

    The advantage of normalization could be for example if one day they decide not to represent the gender by M (male) and F (female) but by G (garçon) and F (femma) because of a French acquisition, you only need to update the sex table, instead of the whole bio table.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Thank you my friend 🙂

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply