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

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

Jun 13, 2016 pm 01:22 PM
price

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

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

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

你从3NF开始看起吧……

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Fujifilm X-M5 price expectations rise as leaked selfie display adds complexity to the formerly affordable camera line Fujifilm X-M5 price expectations rise as leaked selfie display adds complexity to the formerly affordable camera line Sep 07, 2024 am 09:34 AM

Fujifilm fans were recently very excited at the prospect of the X-T50, since it presented a relaunch of the budget-oriented Fujifilm X-T30 II that had become quite popular in the sub-$1,000 APS-C category. Unfortunately, as the Fujifilm X-T50's launc

FiiO CP13 cassette player launches with transparent retro look FiiO CP13 cassette player launches with transparent retro look Jun 16, 2024 am 09:52 AM

TheFiiOCP13cassetteplayerwasannouncedinJanuary.Now,FiiOisexpandingitsportfoliowithtwonewmodels-onewitharedfrontandonewithatransparentfront.Thelatternotonlyperfectlymatchestheretrocharmoftheangulardesign,butalso

Klipsch unveils Flexus Core 300 flagship soundbar with 8K support, 12 speakers and room correction Klipsch unveils Flexus Core 300 flagship soundbar with 8K support, 12 speakers and room correction Sep 05, 2024 am 10:16 AM

The Klipsch Flexus Core 300 is the top model in the series and is positioned above the already available Flexus Core 200 in the company's soundbar line-up. According to Klipsch, this is the first soundbar in the world whose sound can be adapted to th

Light Phone 3 launches with 50% discount, monochrome OLED and minimalist design Light Phone 3 launches with 50% discount, monochrome OLED and minimalist design Jun 13, 2024 pm 10:18 PM

WhiletheLightPhone2from2018wasstillequippedwithaneconomicale-inkdisplay,theLightPhone3usesanOLEDdisplaythatcanonlydisplaygrayscale.Thereasonfortheswitchtothe3.92-inchOLEDpanelwithitsresolutionof1,240x1,080isth

Deal | Tesla Model 3 Long Range AWD regains full $7,500 tax incentive, drops to below $40,000 Deal | Tesla Model 3 Long Range AWD regains full $7,500 tax incentive, drops to below $40,000 Jun 19, 2024 am 09:55 AM

Shortly after Tesla launched the Model 3 Highland refresh towards the end of last year, the US federal EV tax incentive rules changed, cutting the potential discount in half for eligible buyers because of Tesla's use of Chinese LFP cells in the new M

Realme Pad 2 Lite: Affordable tablet launches with quad speakers, 90 Hz display and 15h battery life Realme Pad 2 Lite: Affordable tablet launches with quad speakers, 90 Hz display and 15h battery life Sep 14, 2024 am 06:28 AM

More than a year after the launch of the Realme Pad 2 the manufacturer presents the more affordable Realme Pad 2 Lite. The new model is slightly smaller, as the display shrinks from 11.5 inches to 10.95 inches, with the IPS panel achieving a resoluti

Tipster claims Snapdragon 8 Gen 4 costs nearly 21% more than its predecessor Tipster claims Snapdragon 8 Gen 4 costs nearly 21% more than its predecessor Sep 09, 2024 am 06:35 AM

There have been multiple reports about Qualcomm increasing the price of Snapdragon 8 Gen 4 compared to its current-gen flagship SoC. Digital Chat Station, a notable leakster, reported about it back in May, which was later reinforced with a separate r

Corsair MP600 Mini R2 promises 7,000 MB/s and 1 million IOPS in compact M.2-2230 format Corsair MP600 Mini R2 promises 7,000 MB/s and 1 million IOPS in compact M.2-2230 format Jun 22, 2024 am 08:21 AM

The brand new Corsair MP600 Mini R2 is currently the fastest M.2-2230 SSD on the market, as Corsair advertises a maximum read rate of 7,000 MB/s and a write rate of 6,200 MB/s. To achieve this speed, Corsair combines 176-layer TLC NAND with a Phison

See all articles