Question: I am trying to structure a database for optimal use. But I have no idea how to make that happen. Here is what i will have

A category which will have many products and a count for each on of those products 

For example

Restaurants will be the category and the products will be the computer system, cash register and each one of these products has a count so maybe there will be 2 cash registers and 3 computer systems and so on. Another catagory might be a bar, which might or might not have the same products. Then the user has the option of choosing a 2 restarant package which might have a discount rate for getting all the products.

I just need to structure the ERB if i can get some help, Thanks

Answer: 
PRODUCTS
--------

* PRODUCT\_ID (primary key)
* PRODUCT\_NAME

CATEGORIES
----------

* CATEGORY\_ID (primary key)
* CATEGORY\_NAME

PRODUCT\_CATEGORIES\_MAP
------------------------

* PRODUCT\_ID (primary key, foreign key to `PRODUCTS`)
* CATEGORY\_ID (primary key, foreign key to `CATEGORIES`)
* QUANTITY

This'll allow you to associate a product to more than one category, but not allow duplicates.
### Establishment

* ID
* Name
* <address info>

### Product

* ID
* Name

### Estab\_Prod\_Bridge

* ID\_Product
* ID\_Establishment
* Quantity

### Discounts

* ID\_Establishment
* Percent\_Purchase
* Discount

---

**Note:** 

1. Establishment is a long word, I just used it here for example. You could easily replace it with location/loc, venue, or anything else you see fit.
2. Depending on how the data changes, I added the discount table, thinking there would be different discounts for variant amount of products purchased. 

**Example:** *80% of products purchased would yield a 5% discount, but 100% of purchases might yield a 10% discount.*