帮助Home Inventory Database学校项目。 [英] Help with Home Inventory Database school project.

查看:74
本文介绍了帮助Home Inventory Database学校项目。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我获得了一项创建MS Access家庭库存数据库的任务,该数据库至少有5个表。


我有7张桌子(电器,车辆,电影,家具,游戏,电器和房间)房间表与其他六张桌子有一对多的关系。

每个表都有一个主键,除了房间表之外的每个表都有一个外键将它链接到父表(房间)


问题我我有的是,当我尝试运行查询以查找特定房间中的所有资产时,我要么得到一遍又一遍重复的记录组,否则我什么都得不到。我是Access的新手,所以请善待。


提前感谢您提供任何帮助。

I was given an assignment to create a MS Access home inventory database that has a minimum of 5 tables.

I have 7 tables (Appliances,Vehicles,Movies,Furniture,Games,Electr onics, and Rooms) The rooms table has a one-to-many relationship with the six other tables.
Each table has a primary key and every table except the room table has a foreign key that links it to the parent table (room)

The problem I am having is that when I try to run a query to find all assets in a particular room I either get groups of records that repeat over and over or I get nothing at all. I am very new to Access so please be kind.

Thank you in advance for any help you can give.

推荐答案

您好,

通常,表中的主键用作另一个链表中的外键。无需为此目的创建单独的标识符,例如如果Appliance表中的主键是autonumber类型的ApplicanceID,则可以通过创建名为ApplianceID且类型为number的字段将其链接到Room表。这是家用电器的外键。


如果你正确指定了主键和外键,可能是你的查询有问题。


B
Hi there,

Usually the primary key in a table is used as the foreign key in another linked table. No need to create a separate identifier for that purpose, e.g. if your primary key in the Appliance table was ApplicanceID of type ''autonumber'', you would link it to the Room table by creating a field called ApplianceID with type ''number''. This is then the foreign key for Appliance in Room.

If you have specified the primary and foreign keys correctly, it may be that there is something wrong with your query.

B


我将父表中的主键作为Room_name。 (我知道更大的数据库应该设置为自动编号或ID)对于我的数据库,每个房间名称都是唯一且不可更新的。子表中的外键是PARENTTABLE
I have the primary key in the parent table as Room_name. ( I know for a larger database this should be set as autonumber or ID) For my database each room name is unique and non-updateable. The foreign keys in the child tables are PARENTTABLE


parenttableprimarykey。例如,我有一个父表(ROOM)与PK(ROOM_NAME),它与子表有一对多的关系(电子)电子有​​自己的PK,它有一个外键(ROOM
parenttableprimarykey. For example I have a parent table (ROOM) with a PK (ROOM_NAME) it has a one-to-many relationship with a child table (ELECTRONICS) electronics has its own PK and it has a foreign key (ROOM


这篇关于帮助Home Inventory Database学校项目。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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