The conceptual differences between NULL and the empty string are real and very important in database design, but are often misunderstood and misapplied - here is a brief description of two:
NULL - means that we DO NOT know what a value is, it may exist, but it may not exist, we simply do not know.
Empty-String - means that we know what the value is and that it is nothing.
Here is a simple example: Suppose you have a table with the names of people, including separate columns for first_name, middle_name and last_name. In a scenario where first_name = 'John', last_name = 'Doe' and middle_name IS NULL, this means that we do not know what the middle name is, or even it exists. Change this script so that middle_name = '' (i.e., an empty string), and now that means we know that there is no middle name.
I once heard a SQL Server instructor advance the creation of each character type column in a required database, and then assign a DEFAULT VALUE value to each of the "(empty row)" or "unknown". Pointing this out, the instructor demonstrated that he did not have a clear understanding of the difference between NULL and blank lines. Admittedly, the differences may seem confusing, but for me, the above example helps clarify the difference. In addition, it is important to understand the difference when writing SQL code and correctly handle NULL as well as empty strings.
Gordon J Jul 03 '17 at 16:24 2017-07-03 16:24
source share