I'm attempting to structure a database for optimal use. However I have no clue steps to make which happen. Here's what i'll have

A category that will have numerous items along with a count for every on of individuals items

For instance

Restaurants would be the category and also the items would be the computer, check out and every one of these items includes a count so perhaps you will see 2 cash registers and three personal computers and so forth. Another catagory may well be a bar, that might or might possibly not have exactly the same items. Then your user has a choice of selecting a couple restarant package that might possess a discount rate to get all of the items.

I simply need to structure the ERB basically could possibly get outside assistance, Thanks

Items

  • PRODUCT_ID (primary key)
  • PRODUCT_Title

Groups

  • CATEGORY_ID (primary key)
  • CATEGORY_Title

PRODUCT_Groups_MAP

  • PRODUCT_ID (primary key, foreign answer to PRODUCTS)
  • CATEGORY_ID (primary key, foreign answer to CATEGORIES)
  • QUANTITY

This'll permit you to connect an item to several category, although not allow replicates.

Establishment

  • ID
  • Title
  • <address info>

Product

  • ID
  • Title

Estab_Push_Bridge

  • ID_Product
  • ID_Establishment
  • Quantity

Discount rates

  • ID_Establishment
  • Percent_Purchase
  • Discount

Note:

  1. Establishment is really a lengthy word, I simply tried on the extender here for instance. You can easily change it with location/loc, venue, or other things the thing is fit.

  2. For the way the information changes, I added the discount table, thinking there'd differ discount rates for variant quantity of items bought.

    Example: 80% of items bought would yield a 5% discount, but 100% of purchases might yield a tenPercent discount.