r/DatabaseHelp • u/qetuop1 • Apr 02 '16
Many-to-many, reference, table linking, mapping, filtering, composite keys, ???
Not exactly sure what words to describe my question as I'm a novice when it comes to databases.
I am trying to make a simple grocery list app using sqlite. At this point I want to display a list of Items and the Aisle they are in for a given Store.
I'm thinking I need a Item table(id, name), a Store table(id, name) and possibly an Aisle number table(id,aisle)? With extra mapping tables between them all?
EX:
Item(Milk) --> Store(Wegmans) --> Aisle(2)
Item(Milk) --> Store(Safeway) --> Aisle(15)
2
Upvotes
View all comments
Show parent comment
1
u/qetuop1 Apr 02 '16
Thank you for the help! Do I have this right?
Table:Store
Table:Product
Table:Aisle
Table:ProductAisle
Is the Aisle table absolutly necessary if the ProductAisle table can provide a unique row/lookup?
Is the idea that an Aisle can exist regardless of the products within it and should not be created only when a product is created?
That is, you create your Store row, then an Aisle row, and then when the Product row is created, it plus the Aisle generates the ProductAisle?