I have database which that store the sold products in Orders Table and another table called Transaction to set the time and the total price for the individual order ,my question is: How to combined more than one order with only one Transaction number , If there is any tables that I should to create or any thing to do to achieve the desired result. Thanks
1 Answer
It looks like you're most of the way there, but the Foreign Key should go the other way around. The Orders
table should have a FK reference to Transaction
. This allows a Transaction to be connected to 1 or more Orders.
-
How I can use Transaction P.K. as a F.K. at Orders programmatically, Orders Table is filled first then will Transaction Table! Commented Apr 24, 2014 at 12:10
-
The FK can be nullable, and then when the
Transaction
is created, it can be updated. Commented Apr 24, 2014 at 13:06 -
A Nullable FK almost certainly indicates that the FK relationship is backward. To make a blanket statement such as you did, with out an indication of which business rules that model supports and which it doesn't, is way out of line. Commented Sep 2, 2014 at 2:08