I\'m trying to understand what a Null is and also what an Empty variable is. Are they the same? How do empty strings fit in?
When creating MS Access tables why d
Adding to HarveyFrench's answer...
The Variant of VBA gracefully handles NULL's, and it also handles Empty's. The concept of Empty is of debatable merit, and not represented in many database systems.
NULL means an unobtained or unobtainable value. It was a concept made essential to the proper handling of OUTER JOIN's. An OUTER JOIN begins with a table (or subquery) that will have all of its rows selected. The condition of the JOIN is then used to link to another table (or subquery). In the case of an INNER JOIN, if the condition cannot be satisfied (i.e. resolved to TRUE) between the tables (or subqueries), then the rows of such situations do not get selected. However, in the case of an OUTER JOIN, the unsatisfied JOIN condition will still result in rows from the first table (or subquery) being selected alongside a set of NULL's for each column of the other table (or subquery). These NULL's would signal the failure of the JOIN; these would be the unobtainable values.
An "Empty" isn't the same as a NULL. NULL means unobtained. "Empty" means "this field is intentionally blank." It's a subtle difference, but an "Empty" is somthing definitive, whereas a NULL is something left unknown. An intentional blank is deliberate, not a mistake, unambiguously there specifically to mean there is nothing to find in the first place.
Some folks may intentionally employ NULL to indicate an "Empty" for a column; or they may use NULL to indicate something else other than the unobtainable. There are some folks who would say using NULL in this way is bad practice. The reasoning to this is that now there isn't a clear way to distinguish the intentionally blank from the unknown, and you may confuse yourself in complicated queries. I would say to that "just be careful, and are you sure that NULL is the best or only way to make it all work?"
As for the empty string, the "", that is very much a value. As in something definitively known. It is also a specific datatype - namely that of a string (or text or varchar or whatever an array of characters may be taken as). Call it an "Empty" is you wish, although really it's limited to where strings are expected. In practice it may amount to the same thing. But it's not really "Empty", and it is most certainly not NULL.
Personally I regard NULL as more of a signal, like "not-a-number" conditions you may encounter in floating point numbers. In other words, NULL isn't a particular value. It's the signal of not having a value. When you look up three-valued logic (3VL), particularly where SQL and NULL get involved, you'll better understand why the condition NULL=NULL simply isn't TRUE.
"Empty" is also a signal, but a signal of "whatever amounts to the same as a blank." Hence, the conditions EMPTY="" and EMPTY=0 will both be TRUE - even though ""=0 probably won't compute.