创建数据库表 [英] Creating database table

查看:164
本文介绍了创建数据库表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个用于调查的数据库表,我需要记录报告该事件的人,这可以是供应商或用户表中的记录。最简单的方法是在我的调查表中同时显示一个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.

这篇关于创建数据库表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆