Many elements in one order, SQL table design

I have one table of orders when a user came to the store where they could buy more than one item, for example. Can I find out what are the best practices for doing this? Does each item arrange one row in the order table or mix everything into one row in the order table?

Say a customer. Buy 3 items from the store. will there be 3 rows in the order table? or 1 row in the order table with all the details and a separate order with a separator?

My designed structure is as follows:

tblOrder
    OrderID (Primary Key)
    UserID
    TotalPrice

tblOrderItem
    OrderItemID (Primary Key)
    OrderID (Referencing tblOrder)
    Quantity
    ItemID (Referencing tblItem)
    TotalPrice 

Is it correct?

+3
source share
2 answers

I suggest you support 3 lines, because it will be easier for you to support them further.

Updated:

@SLim, . .

+1

, .

, , , , ? , .

, , . , , .

!

+1

All Articles