Hacker News new | past | comments | ask | show | jobs | submit login

A few things I've seen with null values:

* You're storing multiple types of data in the same table (often paired with a column indicating type). Some types have nulls in a column, other types have non-nulls.

* You've created an arbitrary limit on the data. Ex: a books table with author1, author2, and author3 columns.

* You add complexity to your queries making them less maintainable. For instance, you might start injecting COALESCE, IS NOT NULL, empty string checks, etc. all over the place.

* You need to be more careful with math. Ex: what is null + 10?

Null isn't universally bad, but it comes with issues you need to be aware of.




Good reasons I try to give all my columns a default and have been trying to cut down on the use of null in general. More when programming in for example javascript the multiple null thing really annoys me is it null, NAN or undefined or "" who knows, so much conditional logic to arrive at nothing lol.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: