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

One more quick thing. It might help....

Your Associative entity can be quite powerful. Simply adding a datetime stamp can turn it into an Event table.

In your 'empty' store setup, you might think of these entries as 'stocking' events, recording when and how much stock was put in the aisle. This is also another reason you want the Aisle entity, so you can model your stores, then 'fill' them.

From that you almost have a functional stock tracking system... if you can feed it the data.

2

u/qetuop1 Apr 03 '16

Thank you again for the help, I really appreciate it. I think I can at least get over the first hurdle and get something on the screen. My goal is really just a bare bones shopping app similar to:

https://play.google.com/store/apps/details?id=org.openintents.shopping&hl=en

And to learn a little about Android dev.....and make it rich with the next killer app. ;)