I need an advice if i am doing the right thing at MySQL database. I am connecting this database which i named inventory to a java application, this consist of a table named item and here are the details:
- id – int(11), AUTO_INCREMENT
- item_name – varchar(50)
- category – varchar(25)
- q_box – int(11)
- unit_price_box – double
- sub_total_box – double
- q_pc – int(11)
- unit_price_pc – double
- sub_total_pc – double
- grand_total – double
- recent_date_purchased – date
- last_date_modified – timestamp
I am already using this to store stocks in the development of an inventory application, but what i want to do now is to add a table which will store orders from customers.
I am planning to do this:
table name: orders
which consists of the following:
- order_id – int(11), AUTO_INCREMENT
- item_name – varchar(50)
- category – varchar(25)
- q_box – int(11)
- unit_price_box – double //this is the retail/wholesale price per box
- sub_total_box – double
- q_pc – int(11)
- unit_price_pc – double //this is the retail/wholesale price per pc
- sub_total_pc – double
- grand_total – double
- customer_name – varchar(50)
-
last_date_modified – timestamp
My question is: Am I violating any MySQL rules since I am using a same variable?
or do you have any advice? Any advice would be highly appreciated..
Thanks in advance 🙂
You might be better off with the items table, as well as an orders and order_items table.
orders
order_items
That way there is less repeated data.