如何选择关系代数中 Outer Join 给出的空值

How to Choose the null value given by an Outer Join in Relational algebra

我需要一些关系代数问题的帮助:

假设我们有 table A 和 table B,并且使用外连接,我创建了一个新的 table 并且 table 有几个元组其中属性 x 等于 null.

只有这些元组 select 我该怎么办?

作为 selection 谓词使用是否正确

TabC.x = "null"

还有其他方法吗?

请尝试TabC.x IS NULL

NULL 与任何值(包括另一个 NULL)的比较结果本身为 NULL,然后转换为 FALSE

the attribute x is equal to null

判断TabC.x是否为NULL的标准SQL3VL方式为TabC.x IS NULL。在SQL中,=不是“等于”;它 returns NULL 如果任一操作数是 NULL。 (人们NULL不等于NULL”,但是“等于”是SQL-=,而不是“等于”。)(他们的意思是“不是 SQL-=”,而不是“SQL-<>”,因为“NULL SQL-<> NULL”是 NULL 但他们的陈述被认为是真实的。

There is no NULL or 3VL or OUTER JOIN in relational algebra.

There is no NULL in relational algebra. In SQL the operators treat the value NULL specially, syntactically and semantically, differently than other values, usually by returning NULL when comparing two values when one of them is NULL. So "=" in a WHERE is not equality, it is an operator like equality that acts differently for NULL. So SQL WHERE is not the same operator as algebraic RESTRICT.

人们提出的系统喜欢关系代数并且它为关系代数。谁给了你你正在使用的系统谁可以告诉你NULL是如何处理的。

If someone wants to use NULL with the relational algebra to set or query relation variables you have to get straight what operators they mean when they say things like "AND" and "=" (also relational operators like RESTRICT and PROJECT), and whether NULL is a value treated specially by them.