Web数据库的数据模型问题 [英] Data model problem for web database
问题描述
大家好,
我会说那些东西的新手,我希望我能在正确的论坛上。
I`m a newbie at that stuff I would say and I hope I`m at the right forum.
我想建立一个网络数据库(主题: 设备调查发明)。我有关于设备本身的数据然后我有关于设备位置的数据(在这种情况下在一个特定的建筑物中:我会把那个位置表放到
两个因为有城市,区,buildingno所以有可能有2个或更多的建筑物没有100,但他们在两个不同的城市)并且有一个所有者和一个维修公司。同一家公司可以同时成为所有者和维修者。并且
也有那些公司的联系人(带有电话号码和电子邮件)。
I want to build a web database (theme: equipment survey inventury). I`m having data about the equipment itsself and then I have data about the location of the equipment (in a specific building at this case: I would slip that location table into two because there are city, district, buildingno. So it is possible that there are 2 or more building with No 100 but they are in two different citys) and there are a owner and a repair company. Same company could be owner and repairer at the same time. And there are also a contact at that companies (with telephone number and email).
我会有一个tblEquipment和tblCity(带有来自Id的"联结"表)设备和来自城市的Id),tblBldg。所有公司在一个表中或两个单独的表中更好?
I would have a tblEquipment and tblCity (with a "junction" table with Id from equipment and Id from city), tblBldg. All companies in one table or better in two separate ones?
我感谢对该问题的任何评论或提示!抱歉我的英语很差!
I appreciate any comment or tip on that issue! And sorry for my poor english!
推荐答案
我认为你几乎是对的跟踪。
I think you are pretty much the right track.
>>您需要问的一些问题......公司只有一个联系人吗? (如果是,那么联系方式会在公司表格中找到。如果公司可以有多个联系人,则需要联系表)
>> Some questions you need to ask...will a company have only one contact? (If yes, then the contact details go in the company table. If a company can have more than on econtact you need a contact table)
>>每件设备只有一个维修人员或拥有者吗? (如果答案是一件设备可以有多个维修者所有者,则可能需要另外两个连接表......)
>> Will each piece of equipment have only one repairer or owner? (If the answer is a piece of equipment can have more than one repairer owner, you may need to two more junction tables...)
>>如果设备可以有一个不同的所有者和一个维修人员 - 在设备表中包含表中所有者ID和维修人员ID的字段。这两个字段都可以加入公司表格中的不同行。 当您创建
a查询时,您需要将公司表拖放到查询中两次 - 并为每个实例提供一个别名,如Repair Company和Owner Company。
>> If the equipment can have one different owner and one repairer - include in the equipment table a field for owner id and repairer id in the table. Both fields can join to different rows in the company table. When you create a query, you need to drag and drop the company table into the query twice - and give each instance an alias like Repair Company and Owner Company.
这篇关于Web数据库的数据模型问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!