开发者

Is it bad to have 2 keys for identifying a valid information?

开发者 https://www.devze.com 2023-02-15 08:22 出处:网络
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

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
开发者_StackOverflow社区

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消