Our mall currently uses two tables, the ORDER table and the ORDER_DETAIL table. The ORDER table only saves user information, addresses, total prices, etc. The specific product information is stored in the DETAIL store, but now it is divided into two tables for different merchants. After the order is completed, how to design the database table structure based on the existing split?
Can you consider the following two points:
You may also need to consider shipping, returns and refunds, reconciliation information, and display a total order number to the buyer (which contains the merchant’s product information)
1. Keep the historical data unchanged, design a parent-child relationship in the ORDER table, for example, the original order number is automatically order_no, now add an order_p_no (0 is an order, a value indicates that this is a child order), user information Redundant storage, total price information is calculated and stored based on the corresponding product
2.DETAIL table still corresponds to order_no in ORDER table
Similar to the idea on the first floor