2020年10月26日 / 11次阅读 / Last Modified 2020年10月26日
SQL allows any value to be assigned a NULL. NULL is not a value in itself (SQLite actually implements it as a unique valueless type), but is used as a marker or flag to represent unknown or missing data. The thought is that there are times when values for a specific row element may not be available or may not be applicable.
（SQLite允许primary key取null，所以要显示定义not null）
A NULL may not be a value, but it can be assigned to data elements that normally have values, and can therefore show up in expressions. The problem is that NULLs don’t interact well with other values. If a NULL represents an unknown that might be any possible value, how can we know if the expression NULL > 3 is true or false?
To deal with this problem, SQL must employ a concept called three-valued logic. Three-valued logic is often abbreviated TVL or 3VL, and is more formally known as ternary logic. 3VL essentially adds an “unknown” state to the familiar true/false Boolean logic
False and Null = False，因为and只要出现false，就false；
True and Null = Null，因为 Null 是不知道，可能是True，也可能是False；
同理可得到Null or （True or False）的情况。
-- EOF --
©Copyright 麦新杰 Since 2019 Python笔记