Hacker News new | ask | show | jobs
by GuB-42 1871 days ago
In SQL it may be a NULL value, which has a weird logic but one that makes perfect sense here.

Otherwise, it can be represented as two booleans, one that tells if the gender is specified, and another one for the gender itself. Or it can be a 3 value enum, which is my preferred solution, even if we don't consider non-binary genders.

We should always consider the case when a field has no value. And I hope those who stored gender as a boolean did. Because what if you don't have that information? You can put a default (ex: male), but what if later, in another database, that person is explicitly female and you want to merge. You now have a conflict where you shouldn't.