简体   繁体   English

具有多种功能的产品的数据库设计

[英]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". 正在搜索产品“Businesscard”。 So "Businesscard" is the main product. 所以“Businesscard”是主打产品。 But when you look into it, you want to see different kind of grams like 125 Grams and 250 Grams. 但是当你研究它时,你想要看到不同种类的克,如125克和250克。 And different kind of features like folded and non-folded. 不同的功能,如折叠和非折叠。 The prices for 125 Grams and 250 grams are different. 125克和250克的价格是不同的。 And also they have different quantity. 而且他们有不同的数量。

So I'm building a webapplication where colleagues can login, add products and search products. 所以我正在建立一个web应用程序,同事可以登录,添加产品和搜索产品。 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). Product_name,Product_description,Product_category(到目前为止我得到了这个工作,这些是主要信息,不会改变)。

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 对于这个Web应用程序,我使用Laravel > 5.0和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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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