【发布时间】:2014-07-04 17:52:31
【问题描述】:
我正在尝试在数据库中创建一堆查找表,但在命名它们时被卡住了。表格是这样的:
1. dbo.AccountType (this is the highest level category)
2. dbo.AccountSubType (this is a 2nd level category)
3. dbo.AccountSubSubType (this is a 3rd level category)
上述命名约定很容易被打破。所以也许这样更好:
1. dbo.AccountType1 (highest level)
2. dbo.AccountType2 (second level)
3. dbo.AccountType3 (third level)
4. dbo.AccountType-N (and so on...)
我知道命名约定是基于意见的,但肯定必须有某种合乎逻辑的方式来做到这一点,这种方式可扩展且不会让开发人员感到困惑。
使用第二种解决方案的dbo.AccountType2 表中的数据外观示例:
AccountTypeID (FK) | AccountType1ID (FK) | AccountType2ID (PK) | AccountType2
=============================================================================
1 4 1 Credit Card
1 5 2 Savings
有没有更好的方法将分层数据存储在数据库中并正确命名表?
【问题讨论】:
标签: sql sql-server