I have been developing the MIS system for a long time, and the database has been designed for countless times. I didn't want to say anything when I first saw the blog of the inspiration source, but then I came out again.
First, I would like to summarize their reasons for completely eliminating null in the database design:
1. It is not conducive to the front-endProgramTo determine whether it is null.
2. null cannot exist in the actual business model, which is not conducive to OO ing.
3. Impact on programming efficiency
Counterargument:
1. txtname. Text = employee. Name & ""
2. null does not indicate that this attribute does not exist. Instead, it means that this attribute is "unknown" for the moment. For example, the date of birth field in the employee table, use default? 1900-01-01? Or 1990-01-01? Does this default value not need to be determined by the foreground program?
3. As described in Article 1st, I will not affect efficiency because of null.
Should null be used? Is it true or false? None of them. They are used when they are used. They cannot be used when they are not used, because they cannot be used for null queries, therefore, to avoid null in fields frequently to be queried, you can use default to process them. However, if "unknown" cannot be replaced by any default value, it can only be identified by null. For example, the value of a field may be negative infinity to positive infinity. So what default will you use to identify "unknown "?
So do I like to use null? In fact, I can't use a lot, but it can't be less. For example, an employee table has a diploma, phone number, and address .. I will allow them to be empty. The default values of null and ''are no different for me. The document date on the document must not be empty, if not null is true, this is for data integrity. For some Numeric Fields, I use 0 as the default value. First, it is for convenience of statistics, you do not need to write isnull (..,...), the second is to query speed.
In the database design, we should know the advantages and disadvantages of each feature, rather than rashly denying or praising the advantages and disadvantages of each feature, such as stored procedures, triggers, views, and custom data types... They all have their own advantages and disadvantages.