问题描述
我正在创建一个用于调查的数据库表,我需要记录报告该事件的人,这可以是供应商或用户表中的记录。最简单的方法是在我的调查表中同时显示一个suppleir和一个用户id列,但这似乎是错误的,更好的方法是这样做?
谢谢。
您可以有另外两个表 - IncidentsReportedBySupplier(IncidentID,SupplierID)
和 IncidentsReportedByUser(IncidentID,UserID)
- 这将删除空列。
但这也有缺点。然后,您可能会遇到任何人都没有报告的事件。
I am creating a database table for investigations and i need to log the person who reported the incident, this could be a record from the supplier or user tables. The easiest way to do this would be to have both a suppleir and a user id column in my investigations table but that seems wrong, what's a better way to do this?
Thank you.
You could have another two tables - IncidentsReportedBySupplier (IncidentID, SupplierID)
and IncidentsReportedByUser (IncidentID, UserID)
- which would remove the empty columns.
But this has disadvantages too. You can then potentially have incidents which aren't reported by anybody.
这篇关于创建数据库表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!