需要帮助设计食物银行的ERD [英] Need help designing ERD for food bank

查看:148
本文介绍了需要帮助设计食物银行的ERD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我校外的第一个项目,所以我生疏且缺乏实践.

This is my first project outside of school so I'm rusty and lacking practice.

我想创建一个数据库,但是目前还不确定我是否做得很好.我需要有关报告表的一点帮助.

I want to create a database but I'm not sure if I'm doing ok so far. I need a little help with the reports table.

情况:

  • 食物银行有多个分发食物的机构
  • 每个代理商都必须提交一份报告,其中包含一长列邮政编码为多少个家庭/人服务.
  • 我想到了在"Zips报告"表上添加一个fk.但这会使选择多个拉链成为不可能吗?

也许我离基地远了.有人对我有建议吗?

Maybe I'm way off base. Does someone have a suggestion for me?

推荐答案

此表的更好名称可能是FoodService或其他名称.我以为您真正想要结束的报告类型不只是该表中的一行,因此将其命名为Report会有些混乱.

A better name for this table might be FoodService or something. I imagine the kind of reports you really want to end up are not just a single row in this table, so naming it Report is a bit confusing.

在任何情况下,每个报告都是{机构ID,邮政编码,日期}的唯一组合,并且机构ID当然是外键.如您所指出的,该表中的其他列将是家庭人数和服务的人数.这意味着您将为每个代理商-邮政编码日期组合添加一行,如下所示:

In any case, each Report is the unique combination of {Agency ID, ZIP code, Date} and of course Agency ID is a foreign key. The other columns in this table would be number of families and people served, as you've indicated. This means you'll have rows for each agency-ZIP-date combination like this:

Agency   | ZIP   | Date   | FamiliesServed | PeopleServed
Agency A | 12345 | Jan-12 | 100            | 245
Agency A | 12340 | Jan-12 | 20             | 31
Agency B | 12345 | Jan-12 | 80             | 178
Agency B | 12340 | Jan-12 | 0              | 0

这些总数是否也按程序"分类?如果是这样,则程序需要成为该表的主键的一部分.否则,程序不属于此处.

Are these totals also broken down by "program"? If so, program needs to be part of the primary key for this table. Otherwise, program doesn't belong here.

最后,除非您要开始存储有关邮政编码的 数据,否则不需要邮政编码表.

Finally, unless you're going to start storing data about the ZIP codes themselves, you don't need a table for ZIP codes.

这篇关于需要帮助设计食物银行的ERD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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