问题描述
我有3张桌子:
客户: CustomerId ,FName,LName
订单: OrderId , CustomerId ,商品,价格
OrderTransaction: OrderId ,金额......
因此,客户&订单表(1对多)
我的问题是,如何正确关联 OrderTransaction 表?
我应该将OrderTransaction表与Orders表联系起来,并在两者之间建立一对多的关系吗?那么1交易可以有很多订单吗?
处理此问题的最佳方法是什么?
我尝试了什么:
我在网上发现了这个经典模式,这让我对如何去做有了解。但首先我想问你们你的建议是什么?
I have 3 tables:
Customers: CustomerId, FName, LName
Orders: OrderId, CustomerId, Item, Price
OrderTransaction: OrderId, Amount...
Thus, Customers & Orders table (1-to-many)
My question is, how can I correctly relate the OrderTransaction table?
Should I relate the OrderTransaction table to the Orders Table and make a 1-to-Many relationship between the two? So 1-transaction can have many orders?
What's the best way to handle this?
What I have tried:
I found this classical schema online which kind of gives me an idea of how to go about it. But first I wanted to ask you guys what your recommendation would be classical schema
推荐答案
这篇关于如何建立3表customer_order_transaction关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!