mysql支持guid做外键_sql-server – GUID应该用作许多表的外键

我设计了一个数据库来为UserID使用GUID,但是我将UserId添加为许多其他表的外键,并且因为我计划拥有大量的数据库输入,所以我必须设计好这个.

我还使用ASP Membership表(不是仅限成员资格,用户和角色).

所以目前我在每个其他表中使用GUID作为PK和FK,这可能是糟糕的设计?

我认为可能更好,并且是我的问题的来源,我应该将Users表UserId(int)作为主键添加并使用此字段作为其他表的外键和用户GUID UserId仅引用aspnet_membership?

aspnet_membership{UserID(uniqueIdentifier)}

Users{

UserID_FK(uniqueIdentifier) // FK to aspnet_membership table

UserID(int) // primary key in this table --> Should I add this

...

}

In other tables user can create items in tables and I always must add UserId for example:

TableA{TableA_PK(int)..., CreatedBy(uniqueIdentifier)}

TableB{TableB_PK(int)..., CreatedBy(uniqueIdentifier)}

TableC{TableC_PK(int)..., CreatedBy(uniqueIdentifier)}

...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值