Alex Rivera | Logout

Should I use NULL or an empty string to represent no data in table column?

Asked 2008-10-03T17:21:13.047
30

Null or empty string -- is one better than the other to represent no data in a table column? (I specifically use MySQL, but I'm thinking this is system-independent.) Are there major advantages/disadvantages to using one over the other, or is it simply programmer preference?

Edit
Report

2 Answers

29

Null. An empty string isn't "no data", it's data that happens to be empty.

answered 2008-10-03T17:22:37.957
2

Always use NULL. Consider the difference between "I don't know what this person's phone number is" (NULL) and "this person left it blank" (blank).

answered 2008-10-03T17:44:37.650

Your Answer