Let's say you have an application that has a boolean field in its User
table called Inactive
.
Is there anything inherently wrong with just storing false as null? If so can you please explain what the down side should be? I have discussed this with someone a few months ago and we both agreed it shouldn't matter as long as you do it consistently throughout the app/database. Recently, someone I know was emphatic that "true" true
or false
should be used, but they didn't really give an explanation as to why.
Null is a special marker used in Structured Query Language (SQL) to indicate that a data value does not exist in the database
This is the accepted wisdom and you shouldn't redefine what Null means in your application. It will be confusing to everybody else working with your code.SELECT * FROM foo WHERE bar = FALSE
doesn't give the results you expect.