473,385 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help with Home Inventory Database school project.

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.
Mar 26 '07 #1
12 3486
brynne
13
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
Mar 26 '07 #2
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. 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$room_name). I'm pretty sure I did this correctly, I could be confused on how to query the info I am looking for.

Could someone post an example of what the SQL should look like?
or would someone be willing to look at the database and point me in the right direction?
Thanks again for all of your help.
Mar 26 '07 #3
MMcCarthy
14,534 Expert Mod 8TB
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. 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$room_name). I'm pretty sure I did this correctly, I could be confused on how to query the info I am looking for.

Could someone post an example of what the SQL should look like?
or would someone be willing to look at the database and point me in the right direction?
Thanks again for all of your help.
Have a look at this tutorial and see if your table structures satisfy the rules.

Normalisation and Table structures

Mary
Mar 26 '07 #4
I believe the database is normalized to 3NF.

One question: Can a table have a one-to-many relationship with 6 other tables.
I have a ROOM table that has a one-to-many relationship with my ELECTRONICS, APPLIANCES, VEHICLES, MOVIES, FURNITURE, and GAMES tables.

I set it up this way because each room has many electronics, each room has many appliances and so on.


Thank you.
Mar 26 '07 #5
MMcCarthy
14,534 Expert Mod 8TB
That sounds fine.

What queries are you trying to set up? What information do you want to retrieve from the data?

Mary
Mar 26 '07 #6
I want to query what electronics,movies, games, furniture are in the family room.
This would enable me to report to the ins. co. what items were in that room.
Mar 26 '07 #7
MMcCarthy
14,534 Expert Mod 8TB
Try this ... (I had to make up the column names)

Expand|Select|Wrap|Line Numbers
  1. SELECT RoomName, ElectronicName, ApplicanceName, Vehicle, MovieName, FurnitureDesc, GameName
  2. FROM ((((((Room INNER JOIN Electronics
  3. ON Room.RoomName = Electronics.RoomName)
  4. INNER JOIN Appliances
  5. ON Room.RoomName = Appliances.RoomName)
  6. INNER JOIN Vehicles
  7. ON Room.RoomName = Vehicles.RoomName)
  8. INNER JOIN Movies
  9. ON Room.RoomName = Movies.RoomName)
  10. INNER JOIN Furniture
  11. ON Room.RoomName = Furniture.RoomName)
  12. INNER JOIN Games
  13.  ON Room.RoomName = Games.RoomName)
  14.  
Mary
Mar 26 '07 #8
NeoPa
32,556 Expert Mod 16PB
This is a 'Less Obvious' one.
Logically, you want all the 'Assets' in an asset table with potentially different properties associated with each type. That is, of course, if you want them on separate records rather than all together on one line. If the latter, then Mary's solution is about right (You will probably want to change all the INNER JOINs to LEFT JOINs though) for you.
You can show them on separate records with your current structure though, it just means 'bending' things a little. You will need to create a UNION query merging the data from all your Asset tables and then use the output from this as a recordsource in your main query. A LEFT JOIN from [Rooms] should do the trick from there.
Mar 27 '07 #9
NeoPa
32,556 Expert Mod 16PB
If you could provide MetaData for your tables I could knock something up for you (The general SQL at least).
Here is an example of how to post table MetaData :
Table Name=tblStudent
Expand|Select|Wrap|Line Numbers
  1. Field; Type; IndexInfo
  2. StudentID; Autonumber; PK
  3. Family; String; FK
  4. Name; String
  5. University; String; FK
  6. Mark; Numeric
  7. LastAttendance; Date/Time
Mar 27 '07 #10
NeoPa
32,556 Expert Mod 16PB
Sorry, I'm a bit slow today.
I just noticed that this is a school project/assignment and we have special rules for those.
Please see FAQ - Posting Homework or Coursework Questions and Answers
I can see that you have tried this so, as far as I'm concerned, you are in compliance with this. I merely mention this, as I will now not be able to post an answer ready made for you, but I am still happy to lead you in the right direction in a similar way to the way a tutor would.
BTW Please see earlier posts as they are also relevant.
Mar 27 '07 #11
My database has a few more tables but all are one-to-many from ROOM. All
have PK; ID. All have FK ROOM$id. All data types are the same.

What I want to do is run a query that would tell me what furniture, appliances, and electronics are in the family room.

I have asked my instructor for assistance and have been told that I should be able to get the query result I am looking for, but, he also was unable to get the result I am looking for. He is "refreshing his memory on SQL" and will get back to me. Below are my furniture, appliances, electronics, and room tables with their PK, FK, and other attributes.

Table Name = FURNITURE
ID; PK
ROOM$id; FK
make
description
style
cover

Table Name = APPLIANCES
ID; PK
ROOM$id; FK
make
model
description

Table Name = ELECTRONICS
ID; PK
ROOM$id; FK
make
model
serial_number
description

Table Name = ROOM
ID; PK
Room

Thank you for the assistance.
Mar 30 '07 #12
NeoPa
32,556 Expert Mod 16PB
We seem to have got a little bit out of step here.
There are a number of comments (going back to post #9) that you don't seem to have read or replied to.
Without a response to these points I have no way of knowing which way you would like to continue.
Also, when I requested the MetaData I provided a format to copy which included the data types for each field. The format of yours is different (Unhelpful but not a show-stopper), but more to the point, doesn't provide the type information requested (Again, without which, progress is difficult).
I'm sure this is down to inexperience rather than anything else.
Mar 30 '07 #13

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed...
2
by: Bobby | last post by:
Hello everyone I have a question. The school I am working for is in the beginning process of having a webpage that will direct students to download there homework and be able to view there info...
1
by: Glen | last post by:
I need to make a project for school that intergrates Frontpage, access, word and powerpoint. I wanted to make something that would be usefull for work also. Anyways, here goes. I hope to create...
3
by: Wired Hosting News | last post by:
Lets say I have 10 products in 10 different stores and every week I get a report from each store telling me how many items they have left for each of the 10 products. So each week I enter in 100...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.