I am modeling a database that should be used as generic non-functional requisite for all services of the startup company, like persons, users, services and commercial data like coupons, signature packages, etc.

I am thinking about the gender model. In these modern days and with different laws across countries about subjective identity, should I take that into consideration and model my Person entity with more than just the male and female options?

Options are: undefined, not-answered, other, transgender... or any other industry standard that I am unaware of...

Or does this offend LGBT people by saying that they are not truly male or female?

  • 58
    Simple solution: don't ask the question. Commented Nov 17, 2018 at 13:26
  • 8
    It is not a solution, as some of the services created involve health care, where it is important to know the gender of the person.
    – NaN
    Commented Nov 17, 2018 at 13:45
  • 29
    If it involves health care, gender doesn't help. You need specific information, as both primary and secondary sexual characteristics vary within genders. You need a free-form text field where detailed confidential information can be filled in.
    – Jasmijn
    Commented Nov 17, 2018 at 14:01
  • 29
    If this is about health care, then you need a field for "sex" not "gender". This will allow you to store it as male or female.
    – Clay07g
    Commented Nov 17, 2018 at 18:17
  • 7
    "Or does this offend LGBT people by saying that they are not truly male or female" is such a weird phrasing; there are plenty of LGBT folks who are absolutely truly male or female, and there are plenty of LGBT folks who are not and would absolutely bristle at the implication that to not be considered such is somehow "lesser."
    – fluffy
    Commented Nov 18, 2018 at 3:41

4 Answers 4


Sometimes the term gender may be used when sex is meant. Sex is defined by a person's biological traits whereas gender is determined by identity.

The standard for sex is codified by the ISO/IEC 5218 standard [download].

There are four available values

0 = not known,
1 = male,
2 = female,
9 = not applicable

Similar values can be given for gender

prefer not to say
  • 5
    While there may be such a standard, it's out of touch with reality and should not be used. Commented Nov 18, 2018 at 2:43
  • 7
    @R.. - What about it is outdated, and any suggestions on better ones?
    – Malady
    Commented Nov 18, 2018 at 3:50
  • 7
    And "out of touch with reality" doesn't mean "outdated". It was no more correct in the past. Commented Nov 18, 2018 at 4:01
  • 8
    @R.. Could you explain how this is "out of touch with reality"? It sounds like you are mixing gender (what someone identifies as) and sex (what someone is born as, determined via genitalia). The ISO/IEC standard is only for sex, not gender.
    – n_b
    Commented Nov 18, 2018 at 6:16
  • 5
    @n_b A small percentage of people are born without a clearly determined sex, see Intersex. Some athletes don't find out until later in life when they are banned from competing as a female because they have abnormal chromosomes.
    – Carl Walsh
    Commented Nov 18, 2018 at 20:16

First consider why you need to collect this data. Do not collect it if it is unnecessary. For example:

  • You would like to address the individuals properly. Then, simply ask for their preferred form of address/honorific/title, such as “Mr.” or “Mx.”. This should be a free-form field, not dropdown list. There are more possible forms of address than can be enumerated, especially if you consider clerical, academic, or military forms. There is not necessarily any relation between gender and honorific.

  • You would prefer to analyze behavior by gender. Then you will likely not be interested in genders other than male/female. In that case, offer three choices: female, male, or other/prefer not to say. The last could be a free-form text box that can be left empty.

    Note that collecting and using this kind of data may be subject to privacy laws, so make sure the collection and analysis is legal. E.g. under the GDPR you may have to acquire the user's informed consent first, but that only applies if you or potential users are in the EU.

  • You need to process this data for a specific legal or medical reason. Then, do not guess which information may be needed but find out your actual requirements. E.g. in some jurisdictions only two genders are legally recognized, but the legal gender might be irrelevant in software used for a sexual health clinic.

    You may want to keep your software portable and future-proof, so do not assume that there is a fixed enumeration of genders. Make it possible to update this list e.g. by updating a config file. You may also want to assume the possibility that there is no fixed list. In a database, a VARCHAR field may be appropriate.

Because of these differences in purpose and context, it is difficult to build an universal model for the “gender” concept.

Note: the English word “gender” describes a social role or identity, whereas the term “sex” describes biological aspects such as physiology or genetics. Neither of these concepts is unambiguous. Again, it depends on the context as to which of these concepts is relevant (if at all) and which values are “allowed” in that context.

  • 1
    Even Google asks for gender when we create a Google Account...
    – NaN
    Commented Nov 17, 2018 at 15:19
  • 11
    @PSyLoCKe Google also lets you leave the gender unspecified and also allows user-specified genders. They use it to determine suitable pronouns (e.g. “him” or “her”) and to tailor ads. → support.google.com/accounts/answer/27442?hl=en#gender
    – amon
    Commented Nov 17, 2018 at 15:24
  • 10
    Not just a "sexual health clinic," any health facility is going to want info about your biology. It affects what medicines you can use, what problems you're at risk for, and the likelihood of different outcomes. Given the modern debates around all this, I'd hesitate to use the term "gender" for a question asking for your biological details, as I don't know how a transgender person would respond to that inquiry. I don't know how you can ask for that info in a medical setting now, since the terminology has been so confused.
    – jpmc26
    Commented Nov 17, 2018 at 21:52
  • 5
    @PSyLoCKe: "That's a good model" - for Google. But your application is has probably different requirements.
    – Doc Brown
    Commented Nov 17, 2018 at 23:04
  • 2
    That's good advice about not collecting unless you need it. The question is inherently personal and likely to alienate at least a few users who were on the fence about using your product.
    – Owen
    Commented Nov 18, 2018 at 3:00

As you mentioned Healthcare, it's worth looking at the NHS Data Dictionary for an example, used in the UK as one of the national coding systems for health data (alongside SNOMED).

Depending on whether you want sex or gender, there are two codings: for gender, it's the PERSON STATED GENDER CODE, whilst for sex it's PERSON PHENOTYPIC SEX CLASSIFICATION.

As it turns out both coding schemes are currently identical, but they may diverge. As at time of writing, they are:

  • 1 - Male
  • 2 - Female
  • 9 - Indeterminate

Within the international SNOMED classifications, the concept 365873007 has gender codes for male, female, unknown and transgender; and the UK extensions to international SNOMED have added an option for non-binary. For biological sex, the concept 429019009 has codes for female, male, intersex, indeterminate, and transsexual.

  • Very good! I will search.
    – NaN
    Commented Nov 18, 2018 at 2:47

If you do not need the gender, do not ask or store it. As you mentioned laws, nowadays laws in various countries increasingly disourage use of personal information unless it's essentional to the functionality. Snap googling shows that Brazil is not excluded from it. Easies way to stay safe is do not handle the information at all. Do not include this field, or others like it, to the "basic information". Limit it to nickname and email, to recover password, that's it. For rest, provide free-form text area where the person can describe oneself, who wants could write there all their first names and surname, as well as their gender, religion, sexual orientation, what they eat or whatever.

If you do need the gender for some purpose, it should be be defined by the purpose. You said healthcare. For healthcare such matter should be unambiguously defined by relevant regulations. I have not worked with healthcare myself, but those who did say dealing with them is not easily avoided. Also, I would say it should be handled with same security standards as other medical information.

Not the answer you're looking for? Browse other questions tagged or ask your own question.