Expressing “is null” in Relational algebra

北战南征 提交于 2019-12-29 09:25:10

问题


In SQL, if I want to know whether an expression is NULL, I can use is null.

But I don't understand how I can express is null in relational algebra.

Can I use δ Field_Name=NULL(Table_Name)?


回答1:


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.

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.

See also What to do with null values when modeling and normalizing?.



来源:https://stackoverflow.com/questions/43427852/expressing-is-null-in-relational-algebra

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!