简体   繁体   中英

Database design for products with multiple features

Suppose you are designing a searchable price database for a local pricelist, and have a situation like the following:

Example:

Searching for a product "Businesscard". So "Businesscard" is the main product. But when you look into it, you want to see different kind of grams like 125 Grams and 250 Grams. And different kind of features like folded and non-folded. The prices for 125 Grams and 250 grams are different. And also they have different quantity.

So I'm building a webapplication where colleagues can login, add products and search products. But I want to build it as simple as possible.

Information needed to add product:

Product_name, Product_description, Product_category (so far I got this working, these are the main information, does not change).

I'm sorry, cant even explain it correctly, so i will sketch whats in my mind, something like this:

This is what information i need and how I want to display it when searched (below the basic main information

For this webapplication I use Laravel >5.0 and mySQL DB

From this data model you'll be able to extract all the data you need.

- Product
    - Product_Type  : "000102", //Main Article Nr
    - Product_Nr    : "001", //Added Article Nr
    - Product_Name  : "Businesscard Folded",

    - Product_Type  : "000102",
    - Product_Nr    : "002",
    - Product_Name  : "Businesscard Non-Folded",


- Product_Property
    - Product_Nr*, //Relation to Product.
    - Property_Name : "100gr",
    - Quantity : 100, //You could also make this a relation and notworry about invalid quantities same goes for Property_Names
    - Cost: 10

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM