以下段落是我从 http://msdn.microsoft.com/en-us/library/ms175464(v=sql.105).aspx
A FOREIGN KEY constraint can contain null values; however, if any column of a composite FOREIGN KEY constraint contains null values, verification of all values that make up the FOREIGN KEY constraint is skipped. To make sure that all values of a composite FOREIGN KEY constraint are verified, specify NOT NULL on all the participating columns.
有人可以给我提供一个简单的例子来帮助我理解上述内容吗?外键约束会做什么验证?我认为这与引用完整性有关。
非常感谢。
最佳答案
如果您以另一种方式思考,则不需要示例。
如果复合外键中的任何字段为NULL
,则不会检查其他字段的完整性,直到所有字段提供了 key 。
关于sql - 外键中的空值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10888089/