Home > Backend Development > PHP Tutorial > 订单表和订单号的有关问题

订单表和订单号的有关问题

WBOY
Release: 2016-06-13 13:22:19
Original
981 people have browsed it

订单表和订单号的问题
做一个订单表,如下
orderid //主键
customerid //用户号
productid //产品号
num //数量
price //价格
...

如果把订单号作为主键的话,一般买东西都是买很多种类,不同数量,我这么做的表一行只能记录一种产品的情况,如果多种产品,应该都属于同一个订单号,但是订单号是主键,不允许重复,那怎么解决?

------解决方案--------------------
做一个表保存每个订单的东西啊。其中的orderid可以作为外键和你整个表对应。

你从3NF开始看起吧……

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template