有 2 个密钥来识别有效信息是不是很糟糕?
使用 2 个密钥来识别有效信息是不是一个坏主意?
公司信息表为洗车表和汽车服务表提供服务
假设我们有一个表,其中包含类别
=== 类别表 ===
id
category_name
active
position
path
然后我有一个为两个不同表提供服务的表。
====公司信息====
id
parent_id
category_id
company_name
company_adress
bank_name
两个不同类别的桌子
====洗车桌=======
id ( this will be the parent id in company information )
category_id
...other_fields
汽车服务桌===
id ( this will be the parent id in company information )
category_id
...other_fields
Is it a bad ideea to have 2 keys for identifying a valid information ?
Company information table serves the car wash table and also the car service table
Let's say We have a table that has the categories
=== Category Table ===
id
category_name
active
position
path
Then i have the table that serves the two different tables.
==== Company Information ====
id
parent_id
category_id
company_name
company_adress
bank_name
The two tables that are from different categories
==== Car wash table ===
id ( this will be the parent id in company information )
category_id
...other_fields
=== Car service table ===
id ( this will be the parent id in company information )
category_id
...other_fields
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在一个表中使用相同的键被其他表中的多个外键引用并没有什么根本性的错误。这是很正常的。
There is nothing fundamentally wrong with having the same same key in one table referenced by multiple foreign keys in other tables. It is quite normal.