Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Booleans have 2 states - true and false. A 3 state equivalent is a Trivalent (Someone correct me if i'm wrong here).

Unless you plan on making use of the third state to indicate something in particular, just set it to 0 and call it a day. Space is cheap, and unless you want to constantly write NULL checks to handle it without the need for a 3rd case, in which case you'd most likely assume NULL is 0, you're only causing problems for yourself down the road

Just my opinion, I'm sure others may disagree

Edit: Potential Caveat

Say it's a table to hold answers from a questionnaire, you may see some value for adding it as a NULLable so you can say "Oh, this guy skipped that question", if such a thing were possible in the application.

So for that situation, i'd say the choice is more of a case by case thing



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: