Should you have NULL's in your database?
So recently I made a post regarding NULL’s and “ with respect to numeric fields in a database. I asked questions on a couple different mailing lists for help and one of the interesting responses I got was that You Shouldn’t Have NULL’s In Your Database Unless Required.
Now, I totally understand that for strings, which is all the noted article actually discusses. But my issue wasn’t with a string, it was with a number. I’d say that 0 is not the same as NULL when it comes to data. How many kids to you have? Oh you didn’t answer. That must mean none. Seriously?
I think for non-text fields, converting “ to NULL makes perfect sense. After all, when someone does a submit from the browser it must be a string so unless you are doing something special you have to convert and filter and validate the input as a string anyway.
So tell me I am wrong. Show me a good reason why non-string field’s shouldn’t be NULL. I am certainly not as smart as other programmers, but I haven’t seen a good argument yet.
(Note: I meant to post this before but I apparently forgot to press publish :-/)
Posted Sun, Jul 12, 2009If you're interested in being notified when new posts are published, you can subscribe here; you'll get an email once a week at the most.