-2

Hi I am making a restaurant management system for an assignment and I have a customer table, item table and order table. I want to enter the customer ID and the item ID to the order table when a customer places an order. My question is how to handle this when one customer orders several items together, how can I insert this to the order table? Is there a way to enter the foreign key of multiple items to the item ID column of the order table?

I am using MySQL server 5.7, Java 1.8 and NetBeans 8.2

Thanks!

Ravi
  • 30,829
  • 42
  • 119
  • 173

2 Answers2

0

You need two table. Order and Order Details.

Order Table will contain Order ID, Customer ID, Date, Total Price, Tax, Offer, Coupon and other details regarding order. And Order Details will contain Order ID, Item IT, Price, Quantity, Discount, and other details regarding each order item.

0

Entry in Order table should per user not per Item. And if you want to insert items their are two ways one is in Order table as meta with order entry and second is create another item table with order id as ref key.

Bhuvnesh
  • 44
  • 5