Order table and order number problems

Source: Internet
Author: User
Make an order table for the order table and order number problems, as shown in the following orderid // primary key customerid // user number productid // product number 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, issues with the order form and order number
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 ......

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.