[英]Design table with similar columns/attributes
I have 2 forms, let's say a product_with_refund_form and product_without_refund_form. 我有2种表格,假设是product_with_refund_form和product_without_refund_form。 In table 1 I have these fields: 在表1中,我具有以下字段:
In the 2nd table I have: 在第二张表中,我有:
My question is, how do you design the table? 我的问题是,您如何设计桌子? Do I create each table for both of them or create 1 table with all similar fields, another table for product_with_refund_form that has fields unique to it then another table for product_without_refund_form. 我要为它们两个创建每个表,还是创建一个包含所有相似字段的表,为product_with_refund_form创建另一个具有唯一字段的表,然后为product_without_refund_form创建另一个表。
Instead of trying to work with two similar tables, why not combine the two into a single table. 与其尝试使用两个相似的表,不如将它们合并为一个表。
Note: 注意:
Product_Transactions - Field Names Product_Transactions-字段名称
id, name, transaction_number, status, amount, cashier, DateCreated, po_number, isRefund
Table Creation Code 表创建代码
CREATE TABLE Product_Transactions (`id` int AUTO_INCREMENT, `name` varchar(100), `status` varchar(10), 'amount' DECIMAL(10,2), 'cashier' varchar(100), 'DateCreated' TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 'po_number' varchar(100), 'isRefund' varchar(1), PRIMARY KEY (id))
;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.