数据库的结构

发布于 2024-09-15 21:31:59 字数 249 浏览 7 评论 0原文

我正在尝试构建一个数据库以实现最佳使用。但我不知道如何实现这一点。这是我将拥有的

类别,其中包含许多产品以及每种产品的计数

例如

餐厅将是该类别,产品将是计算机系统、收银机,并且每一种产品都有一个计数,所以也许会有2个收银机和3个计算机系统等等。另一个类别可能是酒吧,它可能有也可能没有相同的产品。然后,用户可以选择 2 家餐厅的套餐,该套餐可能有获得所有产品的折扣率。

如果我能得到一些帮助,我只需要构建 ERB,谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

白芷 2024-09-22 21:32:00

机构

  • ID
  • 名称
  • <地址信息>

产品

  • ID
  • 名称

Estab_Prod_Bridge

  • ID_产品
  • ID_Establishment
  • 数量

折扣

  • ID_Establishment
  • 百分比_购买
  • 折扣

注意:

  1. Establishment 是一个很长的词,我只是在这里举例。您可以轻松地将其替换为位置/地点、地点或您认为合适的任何其他内容。

  2. 根据数据的变化,我添加了折扣表,认为购买不同数量的产品会有不同的折扣。

    示例: 80% 的购买产品可享受 5% 的折扣,但 100% 的购买产品可享受 10% 的折扣。

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.

花落人断肠 2024-09-22 21:31:59

PRODUCTS

  • PRODUCT_ID(主键)
  • PRODUCT_NAME

CATEGORIES

  • CATEGORY_ID(主键)
  • CATEGORY_NAME

PRODUCT_CATEGORIES_MAP

  • PRODUCT_ID(主键,PRODUCTS 的外键)
  • CATEGORY_ID(主键,CATEGORIES 的外键)
  • QUANTITY

这将允许您将一种产品关联到多个类别,但不允许重复。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文