MySQL Forums
Forum List  »  Newbie

Re: Table Design Help
Posted by: Peter Brawley
Date: July 27, 2016 12:41PM

Three tables minimum. Each order may have 1 or more order_items rows. Order_items is a "bridge" table between orders and items in whuch each row points at one orders row and one items row, eg ...

orders(orderid int pk, ts timestamp, ...)
items(itemid, name, ...)
order_items(order_id,item_id)

For repeat customers you might want to add a customers table, and add an optional customerid to the orders table.

Read about database normalisation.

Options: ReplyQuote


Subject
Written By
Posted
July 27, 2016 10:49AM
Re: Table Design Help
July 27, 2016 12:41PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.