For what x
is
对于x是什么
The expression
x IS NOT NULL
isnot equal toNOT(x IS NULL)
, as is the case in 2VL表达式x IS NOT NULL不等于NOT(x IS NULL),如2VL中的情况
(quote from this answer, which is quoting F* Pascal Practical Issues in Database Management - A Reference for the Thinking Practitioner -- near the end of that answer)
(引用这个答案,引用F* Pascal数据库管理中的实际问题 - 思维从业者的参考 - 接近答案的结尾)
My guess is when
This guess was incorrect.x IS NULL
is NULL, but I cannot guess when that would be (i.e. I haven't checked the SQL standard).
我的猜测是当x IS NULL为NULL时,但我无法猜测是什么时候(即我没有检查SQL标准)。这个猜测是不正确的。
2 个解决方案
#1
15
From what I've read, F* Pascal is not referring to a scalar value in comparison to Null but the rarely implemented ROW type. In the standard, the idea was that you could compare a table (of rows) using IS NULL
to determine if all values were set to the NULL value. Thus, X IS NULL
would imply all values were set to the NULL value, X IS NOT NULL
would mean no values were set to the NULL value and NOT (X IS NULL)
would mean that not all values were set to the NULL value or, said another way, there existed at least one value not set to NULL. Granted, I'm treading lightly on the shoulders of giants here, but that's how I interpret his statement.
从我所读到的,F* Pascal并不是指与Null相比的标量值,而是很少实现的ROW类型。在标准中,我们的想法是您可以使用IS NULL比较一个表(行)来确定是否所有值都设置为NULL值。因此,X IS NULL意味着所有值都设置为NULL值,X IS NOT NULL意味着没有值设置为NULL值而NOT(X IS NULL)意味着并非所有值都设置为NULL值或换句话说,存在至少一个未设置为NULL的值。当然,我在这里轻轻地踩着巨人的肩膀,但这就是我对他的陈述的解释。
#2
10
x IS NULL
will never be NULL
so they are the same for all x
x IS NULL永远不会为NULL,因此它们对于所有x都是相同的
Truth table ahoy:
真相表啊啊:
+--------+-------------+---------+--------------+
| x |x IS NOT NULL|x IS NULL|NOT(x IS NULL)|
+--------+-------------+---------+--------------+
|NULL | FALSE | TRUE | FALSE |
|NOT NULL| TRUE | FALSE | TRUE |
+--------+-------------+---------+--------------+
Note that columns two and four are identical for all potential values of x
(either NULL
or NOT NULL
)
请注意,第2列和第4列对于x的所有可能值都是相同的(NULL或NOT NULL)
#1
15
From what I've read, F* Pascal is not referring to a scalar value in comparison to Null but the rarely implemented ROW type. In the standard, the idea was that you could compare a table (of rows) using IS NULL
to determine if all values were set to the NULL value. Thus, X IS NULL
would imply all values were set to the NULL value, X IS NOT NULL
would mean no values were set to the NULL value and NOT (X IS NULL)
would mean that not all values were set to the NULL value or, said another way, there existed at least one value not set to NULL. Granted, I'm treading lightly on the shoulders of giants here, but that's how I interpret his statement.
从我所读到的,F* Pascal并不是指与Null相比的标量值,而是很少实现的ROW类型。在标准中,我们的想法是您可以使用IS NULL比较一个表(行)来确定是否所有值都设置为NULL值。因此,X IS NULL意味着所有值都设置为NULL值,X IS NOT NULL意味着没有值设置为NULL值而NOT(X IS NULL)意味着并非所有值都设置为NULL值或换句话说,存在至少一个未设置为NULL的值。当然,我在这里轻轻地踩着巨人的肩膀,但这就是我对他的陈述的解释。
#2
10
x IS NULL
will never be NULL
so they are the same for all x
x IS NULL永远不会为NULL,因此它们对于所有x都是相同的
Truth table ahoy:
真相表啊啊:
+--------+-------------+---------+--------------+
| x |x IS NOT NULL|x IS NULL|NOT(x IS NULL)|
+--------+-------------+---------+--------------+
|NULL | FALSE | TRUE | FALSE |
|NOT NULL| TRUE | FALSE | TRUE |
+--------+-------------+---------+--------------+
Note that columns two and four are identical for all potential values of x
(either NULL
or NOT NULL
)
请注意,第2列和第4列对于x的所有可能值都是相同的(NULL或NOT NULL)