且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我应该创建一个可以为空的外键还是创建一个新表?

更新时间:2023-11-30 13:42:22

我同意 Philip 和 Erwin 的观点,最合理、最灵活的设计是创建一个新表.

I agree with Philip and Erwin that the soundest and most flexible design is to create a new table.

基于空值的方法的另一个问题是不同的软件产品在 SQL 的可空外键的工作方式上存在分歧.甚至许多 IT 专业人士都无法正确理解它们,因此普通用户更不可能理解它.

One further issue with the null-based approach is that different software products disagree over how SQL's nullable foreign keys work. Even many IT professionals don't understand them properly so the general user is even less likely to understand it.