sql - Relationship between Customer and Order in a Shopping Cart -
i'm making erd, can build shopping cart.
i confused relationship between order , customer.
if im not mistaken, customer can order many products,
an order can placed 1 customer
so
create table orderproduct( orderproductid int primary key, productid int, quantity int ) create table orders( orderid int primary key, orderproductid int, //foregin key customerid int, date ) am correct, or mu table structure wrong?
that seems fine me, need orderid in orderproduct table in order link order details order - drop orderproductid orders.
some of other columns productid , customerid should foreign keys, of course.
is "order" finalized order or there later invoicing step? because typically may want lock in unit price @ order (from product file @ time of order, or perhaps signed/approved quote).
Comments
Post a Comment