r/DatabaseHelp • • 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

5 comments sorted by

View all comments

Show parent comment

2

u/phunkygeeza Apr 03 '16

Yes that data looks right.

An entity needs a table. Putting Aislename or any other Aisle attribute into Product Aisle would mean its value would be repeated. That would be denormalising your model.

The ProductAisle table is your Many-to-many resolver. "Associative Entity"