d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > Homework Help > Anyone Good W/ Microsoft Access? > Figuring Out Relationships
Add Reply New Topic New Poll
Member
Posts: 9,496
Joined: Jul 21 2008
Gold: 0.00
Jun 15 2016 07:29pm
I am tasked to make a database for an eGrocery store of sorts.

For tables I have...

Categories
Category ID
Category Name

Customers
Customer ID
Customer Name
Customer Address
Contact Phone

Items
Item ID
Item Name
Unit
Unit Price
Category

OrderDetails
Order
Item
Quantity

Orders
Order ID
Order Date
Customer


I need to figure out what the relationships are between these tables... At the end I am going to make a form so that a customer can place an order of xx item in xx category
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jun 15 2016 07:50pm
Quote

I need to figure out what the relationships are between these tables


looks like your relationships are already there. i added the FK mentioned. the only questionable one was how items and categories relate, but if you have a column it's likely one-to-many as opposed to many-to-many

Quote (Burton_air89 @ Jun 15 2016 09:29pm)
Categories
Category ID
Category Name

Customers
Customer ID
Customer Name
Customer Address
Contact Phone

Items
Item ID
Item Name
Unit
Unit Price
Category - FK to Categories.CategoryID

OrderDetails
Order - FK to Orders.OrderID
Item - FK to Items.ItemID
Quantity

Orders
Order ID
Order Date
Customer - FK to Customers.CustomerID


This post was edited by carteblanche on Jun 15 2016 07:51pm
Member
Posts: 9,496
Joined: Jul 21 2008
Gold: 0.00
Jun 15 2016 08:03pm
Quote (carteblanche @ Jun 15 2016 06:50pm)
looks like your relationships are already there. i added the FK mentioned. the only questionable one was how items and categories relate, but if you have a column it's likely one-to-many as opposed to many-to-many


Thank you for this.

The relationship between items and categories is like a grocery store. In the DAIRY category I may have the items cheese, milk, yogurt, etc. etc.
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jun 15 2016 08:13pm
don't pm me. stick to the topic.



the reason you have an OrderDetails table is to allow multiple items on the order. if OrderDetails and Orders had a 1:1 relationship, then you wouldn't need the OrderDetails table at all. so it's n:1 relationship.
Member
Posts: 9,496
Joined: Jul 21 2008
Gold: 0.00
Jun 15 2016 08:23pm
Quote (carteblanche @ Jun 15 2016 07:13pm)
don't pm me. stick to the topic.
the reason you have an OrderDetails table is to allow multiple items on the order. if OrderDetails and Orders had a 1:1 relationship, then you wouldn't need the OrderDetails table at all. so it's n:1 relationship.


Sorry about that. I deleted that image so I could crop my name out of the top... Here it is again:




I've changes that relationship to 1 to many and it appears to be working. Now I just need to figure out how to "place" some orders.

This post was edited by Burton_air89 on Jun 15 2016 08:31pm
Member
Posts: 9,496
Joined: Jul 21 2008
Gold: 0.00
Jun 15 2016 08:56pm
Here's where I am now... How would I make a form to place orders from here? Been toying with it for awhile and not making much progress...



Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jun 15 2016 09:14pm
I don't have any experience with the GUI-side of access, so i couldn't give you a starting point on what their "forms" are. i'm only familiar with the sql. if you dont like documentation, i suggest trying out youtube videos: https://www.youtube.com/results?search_query=ms+access+forms

but to place an order, you'd first need data in your Items table. then you have to create a customer, then create an order, then add items to the order.
Go Back To Homework Help Topic List
Add Reply New Topic New Poll