Wednesday 15 August 2012

Best technique to store gender in MySQL Database -


What is the best way to store sex in my SQL database? I am a bit confused about this issue because different people express differently. Some people recommend storing it in INT , but there are other suggestions that TINYINT and Enum , but some others suggest that they

Despite this, in view of my storage in CRAR, it is more susceptible to any CHAR (1) strong> M for women and men

Better idea, because it offers more robustness than ENUM? Apart from this I am concerned about scalability

An important suggestion from a specialist is highly appreciated.

individually (because it is some subjective question) I ENUM MySQL check does not support constraints, so actually the only way to ensure that value is M or F ( Or m or f ). For me, this is the most important point.

In addition, ENUM should only require one byte storage space (according to it), so it will only be used as efficient storage-wise CHAR (1) or TINYINT .

I did not understand TINYINT with questions like this:

  SELECT * to myTable WHERE gender = 1;   

What is 1 male or female? And if this is a man, then is woman 0 ? Or is it 2 ? Or maybe 16 ? You already have to remember a heap of writing (and retaining) an application; There is no need to add that stack.

No comments:

Post a Comment