Make an order table for the order table and order number problems. The following orderid primary key customerid user number productid product number num quantity price... if the order number is used as the primary key, we generally buy many types of products with different quantities. in this case, only one product can be recorded in one row in a table. if multiple products are used, it should belong to the same order number, but the order number is the primary key, and the order table and order number are not allowed.
Create an order table as follows:
Orderid // primary key
Customerid // user ID
Productid // product No.
Num // quantity
Price // price
...
If the order number is used as the primary key, we generally buy many types of products with different quantities. in this case, only one product can be recorded in one row in a table. if multiple products are used, it should belong to the same order number, but the order number is the primary key and cannot be repeated. how can this problem be solved?
------ Solution --------------------
Make a table to save the items for each order. The orderid can be used as a foreign key and corresponds to your entire table.
Starting from 3NF ......