表中外键列位置的最佳做法

表中外键列位置的最佳做法

本文介绍了表中外键列位置的最佳做法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个愚蠢的问题,但是这里有:



是否存在描述mssql表中外键列顺序的标准或最佳实践?



我想说PK是表中的第一列,然后是所有外键,然后是与该表相关的所有其他列。 / p>

另一种方法是将PK作为第一列,然后是所有支持列,然后是所有外键...



我想这真的没关系,但是我想在整个组织中获得一个标准。

解决方案

有趣的想法,但我个人认为为此制定整个组织的标准弊大于利。



培训和最佳做法听起来不错,但盲目执行的规则是认为有害。


This might be a silly question, but here goes:

Is there a standard or best practice that describes the order of foreign key column in a mssql table?

I for one like the idea of the PK being the very first column in the table followed by all the foreign keys and then all other columns thats relevant to that table.

Another way of doing it is having the PK as the very first column then all the supporting columns and then all foreign keys...

I guess it really doesn't matter, but I would like to get a standard across my organisation.

解决方案

Interesting idea, but personally I think that having "a standard across my organisation" for this would do more harm than good.

Training and best practices sound fine, but a blindly enforced rule is "considered harmful".

这篇关于表中外键列位置的最佳做法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 02:28