首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >地点,单主+多中学

地点,单主+多中学
EN

Database Administration用户
提问于 2017-07-26 05:46:43
回答 1查看 23关注 0票数 1

我正在寻找实现位置管理DB的建议/最佳实践。

位置有一个主接入点和潜在的无限个辅助接入点。它们必须有一个并且只有一个主接入点。这些接入点可以由其他位置以不同的方式引用。(一个地点的二级接入点可能是另一个地点的主要接入点)。为了干爽起见,我想要一张“地点”表和另一张"AccessPoints“表。为了执行这种行为,我正在努力处理中间表/规则。

EN

回答 1

Database Administration用户

发布于 2017-07-26 06:16:16

听起来很简单,所以也许有什么我不明白的?

代码语言:javascript
复制
CREATE TABLE LOCATIONS
( location_key ... primary key not null
, location attribute_1 ... not null
, ...
, location attribute_n ... not null );

CREATE TABLE ACCESS_POINTS
( access_point_key ... not null
, location_key ... not null
, access_point attribute_1 ... not null
, ...
, access_point attribute_m ... not null
,    constraint ... primary key (access_point_key, location_key)
,    constraint ... foreign key (location_key)
                    references LOCATIONS (location_key)
);

这里假设多个位置可以共享相同的access_point。

票数 0
EN
页面原文内容由Database Administration提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://dba.stackexchange.com/questions/181800

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档