gpt4 book ai didi

mysql - [MySQL] : Is there a more 'efficient' way to link these tables?

转载 作者:行者123 更新时间:2023-11-29 04:14:06 25 4
gpt4 key购买 nike

我有三个表 -

Transaction:
ID TimeStamp

Discount:
Code Amount

Transaction_Discount:
ID Code

它几乎是您所能得到的最基本的。

是否有更“有效”的方式将这些表链接在一起?

最佳答案

如果您正在建模一个交易可以有 0 个或多个折扣,并且一个折扣可以应用于 0 个或多个交易,那么这种 3 表方法是标准方法。

我要做的唯一更改是在代码字段之外为折扣提供一个数字主键,并将其用作 Transaction_Discount 中的外键。

关于mysql - [MySQL] : Is there a more 'efficient' way to link these tables?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2150993/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com