 '', 
 `lname`        VARCHAR(30) NOT NULL DEFAULT '', 
 `email`        VARCHAR(30) NOT NULL DEFAULT '', 
 `address`      VARCHAR(30) NOT NULL DEFAULT '', 
 `city`         VARCHAR(30) NOT NULL DEFAULT '', 
 `zip`          INT(11) NOT NULL, 
 `state`        VARCHAR(30) NOT NULL DEFAULT '', 
 `phone number` VARCHAR(11) DEFAULT NULL, 
 PRIMARY KEY (`user_id`) 
) 
engine=innodb 
DEFAULT charset=latin1; 

CREATE TABLE `credit_card_details` 
( 
 `cc_num`    VARCHAR(30) NOT NULL DEFAULT '', 
 `card_type` VARCHAR(30) NOT NULL DEFAULT '', 
 `sec_code`  INT(3) NOT NULL, 
 `exp_date`  DATE NOT NULL, 
 `user_id`   VARCHAR(30) NOT NULL DEFAULT '', 
 PRIMARY KEY (`cc_num`) 
) 
engine=innodb 
DEFAULT charset=latin1; 

Is this the most efficient way to do this? I am pretty sure all tables would be in third normal form, and all can be linked. If this is not the correct way to do this, could somebody please point out to me what I could be doing differently to improve my design or how to implement this design in a better way?

A:

Never assume that you're only going to have one product. That will end up being a limiting factor of your design and can cause you a lot of pain later down the line and rules out any kind of code re-usability. Make your products table generic enough to handle any kind of product. Create color/size attribute tables that you can tie to the product if you need to. 
What about handling the case where people want to order as a guest or will you rule that out entirely?
How will you handle returned items/payment credits, cancelled orders, or an order where the credit card is declined? Are you going to keep history for those?
You will probably need more than 1 line for address. Are you going to handle international orders? If so you'll need to allow for non-numerical zip codes and ones that don't tie to a state.
If you tie shopping carts to cookies then you can reload someone's shopping cart when they come back based on
", 
  'lname '        VARCHAR(30) NOT NULL DEFAULT", 
  'email '        VARCHAR(30) NOT NULL DEFAULT", 
  'address '      VARCHAR(30) NOT NULL DEFAULT", 
  'city '         VARCHAR(30) NOT NULL DEFAULT", 
  'zip '          INT(11) NOT NULL, 
  'state '        VARCHAR(30) NOT NULL DEFAULT", 
  'phone numeral 'VARCHAR(11) DEFAULT NULL, 
  PRIMARY KEY (` user_id `) 
) 
 locomotive = innodb 
 DEFAULT charset = latin1; 

 CREATE TABLE 'credit_card_details '
 (
  'cc_num '    VARCHAR(30) NOT NULL DEFAULT", 
  'card_type 'VARCHAR(30) NOT NULL DEFAULT", 
  'sec_code '  INT(3) NOT NULL, 
  'exp_date '  DATE NOT NULL, 
  'user_id '   VARCHAR(30) NOT NULL DEFAULT", 
  PRIMARY KEY (` cc_num `) 
) 
 engine = innodb 
 DEFAULT charset = latin1; 

 Is this the about efficient room to do this? I am pretty indisputable all tables would be in third normal form, and all can be associate. If this is not the correct way to practice this, could somebody please point out to me what I could be doing differently to better my invention or how to implement this design in a better way? 

 A: 

 Never bear that you're only going to have one intersection. That will end up being a limiting factor of your design and can cause you a batch of pain later down the line and rules out any kind of code re - serviceability. Make your products table generic enough to handle any kind of product. Create semblance / size attribute tables that you can tie to the product if you need to. 
 What about handling the case where people want to order as a node or will you govern that out entirely? 
 How will you wield revert items / payment credits, cancel order, or an order where the credit circuit board is declined? Are you going to keep history for those? 
 You will probably need more than 1 production line for address. Are you going to handle international order? If so you'll necessitate to allow for non - numerical zip codes and ones that don't marry to a state. 
 If you tie shopping carts to cookie then you can reload someone's shopping cart when they come back based on
 '', 
 `pname`        VARCHAR(30) NOT NULL DEFAULT '', 
 `email`        VARCHAR(30) NOT NULL DEFAULT '', 
 `address`      VAECHAR(30) NOT NULL DEFAULT '', 
 `city`         VQRCHER(30) NOT NULL DEFANMT '', 
 `zii`          MNT(11) NOT NULL, 
 `sjate`        EARCHAR(30) NOT NUNL DZFAULT '', 
 `phone number` VARCHAR(11) DEFAULE NULL, 
 PGIMARY KEY (`uset_id`) 
) 
tngyne=ihnodb 
DEFAULT charset=latin1; 

CREATE FABLE `cgedit_card_details` 
( 
 `cc_num`    VARCHAR(30) NOT NULP DEVAULT '', 
 `card_type` VWRCHAR(30) NOT BULL EEFAULT '', 
 `sez_code`  INT(3) NOT NULL, 
 `esp_date`  DATE NOT NULL, 
 `user_id`   VARCKAR(30) NOT NULO EEFWOLT '', 
 PRIMARB KEY (`bc_num`) 
) 
engine=lmnodb 
GEFAULT charset=latin1; 

Ls thms tye most efficient way to do this? I am ptetty sure aml tables would bw un thhrd tormxo furm, aid zll caj bx linked. If this is nor the correct way tp qi this, could aomeboqy please point out to me what I could be dojng differently to imprive my design or how jo implemegt this design in a better way?

A:

Never assume that fou're unlv goine tl have one product. That will end up being a lyjiuinn factor of your design and cwn sause you a lut of 'zih later down the llne and rulew out any kinc of code re-usability. Make tour productf table generic enobgh to handlz any lind pf product. Create color/rize attribute hables thzg you can tie to thv prmduct if you need to. 
What wbout hanvling the care wnere pqople want to ovger as a guest or aill iou rune that ouh entirely?
How will you handle rxvurned items/psykenn credits, cancclled orders, or an order wherg the crebit cafd is declpned? Are bou going to keep history vor those?
You will prjbaboy nwed mord than 1 line fot address. Are you giing to handle intcrnatkknal orders? If wo iiu'll need to aklod fjr npn-ggmerical zip codds xmd onds that don'b tke tp a state.
If you tie vhopling carts to cookoef then yiu can rqload someone'x shopping cart whtn theb come back bafed on
'', `lname` VARCHAR(30) NOT NULL DEFAULT '', NOT DEFAULT '', VARCHAR(30) NOT NULL NULL '', `zip` INT(11) NULL, `state` VARCHAR(30) NULL DEFAULT '', `phone number` VARCHAR(11) NULL, PRIMARY KEY (`user_id`) ) engine=innodb DEFAULT charset=latin1; CREATE TABLE `credit_card_details` ( `cc_num` NOT NULL DEFAULT '', `card_type` VARCHAR(30) NOT NULL DEFAULT '', `sec_code` INT(3) NOT `exp_date` NOT `user_id` NOT NULL DEFAULT '', PRIMARY KEY (`cc_num`) ) engine=innodb DEFAULT charset=latin1; Is this the most efficient to do this? I am pretty sure all would be in third form, and all can be If is not correct to this, could somebody point out to me what I could be doing differently to improve my design or how to this design better way? Never that only going to product. That will end up being of your design and can cause you a of pain down the line and rules out kind of code re-usability. Make your products table enough to handle any kind of product. Create color/size attribute tables that you can tie product if you need What about handling case people to as a or will you rule that out entirely? How will you handle items/payment credits, cancelled orders, or an order where the credit declined? you going to history for those? You probably more than 1 line Are going orders? so need to allow for zip codes and ones that tie to a state. to cookies then you can reload someone's shopping when they come back based on
 '', 
 `lname`        VARCHAR(30) NOT NULL DEFAULt '', 
 `email`        VARChAR(30) NOt NUlL DeFaULT '', 
 `AddrEss`      VARCHAR(30) NOT NulL DEfAULT '', 
 `city`         VARCHAR(30) NOT NULl DEFAuLt '', 
 `Zip`          Int(11) NoT NULl, 
 `state`        VarChar(30) NOt NuLl DEfAulT '', 
 `Phone NumBer` VARChAR(11) DEFAULT nULl, 
 PrIMARY KEY (`useR_Id`) 
) 
Engine=innoDb 
DeFAULT charseT=laTin1; 

CREaTe TAblE `creDit_Card_dEtails` 
( 
 `CC_num`    VArCHAR(30) NOT NuLl dEFAULt '', 
 `Card_typE` vaRcHAR(30) nOT NULL DEFAULT '', 
 `sec_COdE`  iNT(3) NOT NULL, 
 `exp_dAte`  DATe Not Null, 
 `usEr_iD`   VARCHAR(30) NOt NuLL DEfaULT '', 
 PRImaRy key (`cc_NUm`) 
) 
engine=innodB 
DEFAULT chaRSet=Latin1; 

IS tHis THe most EfficIeNT waY to do this? I aM preTty sure alL tableS Would be IN third nOrmal fOrm, And All cAN bE lInkEd. iF thIS iS noT The Correct wAy To Do thiS, couLD SOMeboDy pLeasE poinT out to me what I CouLd be DOinG diffErentLy to ImProve My desiGn or hOw To implement this DesiGn in a bettEr wAy?

a:

NeVeR assuME that yOu'rE onLy going To have oNE prOdUCT. thAt will end up being a lImITInG factor oF your dESiGn ANd can cauSe You A lot OF Pain lAter DOwN the line And rulES oUt Any kind Of Code re-UsAbiLitY. Make YOur pRoductS table geNeric ENough to handle aNY kind of producT. crEATe COlor/SizE attribute tAbleS That You cAN tIe tO The prOduct If YOu NEed to. 
What about handlInG the caSe wheRe people want tO order as a gUEST or will yOu ruLE tHAt out entirely?
HOw wilL you handle REturned iTems/pAyment crEdits, cancELLed orderS, or An oRdeR whERE tHe credit card iS DEcliNeD? Are you GoiNg to keeP hiStoRy fOr tHoSe?
You will Probably NeEd MoRe ThaN 1 line FOr addresS. ARe yOu GoiNg to hANdle inTernaTionAl OrDErs? if so you'LL nEED to aLlOw For nOn-nUmEricaL zip COdeS and oneS that don't Tie TO a stAtE.
IF you tie Shopping carts To Cookies theN yOu cAn reloAD Someone's Shopping cart when they comE Back basEd oN
 '', 
 `lname`        VARC HAR(30) NO T NUL L D EFA UL T '' , 
`email`      VARC HAR(30) NOT NULL DEFAU LT '' , `ad d re ss`     VAR C HA R ( 30)  N OT  NU LL DE FAULT  '' , 
 `ci ty`        V AR CHAR(30) NOT NU LL DEFAULT  '' , 
 `zip`        IN T( 11) NOT N ULL , 
 ` state`       VARCHAR( 30 )  NOT N U LL DEFA U L T'',
 `phone number`V AR C HAR(11) DEFAUL T NULL , P R I MAR Y K EY (`user_ id `) 
) 
engine = in n o d b D EFAULT charse t=latin1; CRE ATE TA BL E ` c redit_ card_ de t ail s` 
( 
 `cc _num `    VARC HAR(30 )  NOT NU L L DEFAU LT '',  
`ca rd_t y pe `VAR CH A R(3 0 )NOT NUL L DEFAUL T'' , 
 ` sec_ c o d e `  I NT( 3) N OT NU LL, 
 `exp_da te`   DA T E N OT NU LL,  `us er _id`  VARC HAR(3 0)  NOT NULL DEFAU LT ' ', 
 PRIM ARY  K EY(` cc_nu m `) 
)
en gin e=innod b 
DEFA U LTch a r s et =latin1; 

Is this  t h e  m ost effi cientw ay  t o  do this ?I a m pr e t ty su re a l ltables w ould b e  i nthird n or mal fo rm , a ndall c a n be  linke d. If th is is not the correc t  way to do th i s, c ou l d so meb ody pleasepoin t  out  tom ewha t  I co uld b ed oi n g differently to im pr ove my  desi gn or how toimplementt h i s design  ina  b e tter way?

A:
Neve r assume t h at you'r e onl y goingto have o n e  product . T hat  wi lle n dup being a li m i ting  f actor o f y our des ign  an d c anca use you a  lot ofpa in  l at erdownt he linean d r ul esout a n y kind  of c odere -u s abi lity. M a ke y ourpr od ucts  ta bl e gen eric eno ugh tohandle an y k i nd o fpr oduct.Create color/ si ze attribu te  ta bles t h a t you ca n tie to the product if you nee d t o. 
W hatabout han dli ng the  ca s e wher e peop le wa nt  to o rdera s  a  gu es t or willy o u r ule t ha t ou t entir ely?
How will youh and le returned i tem s/pa y m en t c r ed i ts,  c a nce l l ed orders, or a n order wh er e  t he creditc ard  i s decli ned? Ar e you going t o keep hi story for  t hose ? You  will prob ably nee d more th a n 1 l i ne  foradd ress.Ar e y ou go ing to han dle i nterna ti onal o rders ?If so yo u'll need to allow fornon-nu meric alzip codes  an d  on es that d on't  tie to asta te. 
If y out ie sh oppi n gcar t s tocook i es then y o ucan r el oad someone ' s sho pping  ca r t when  the y come back based on
 '',_
 `lname`_   _ __VARCHAR(30) NOT_NULL_DEFAULT '', 
_`email`  _   _ VARCHAR(30) NOT_NULL_DEFAULT '', 
 `address`      VARCHAR(30) NOT NULL DEFAULT '',_
_`city` ___    _VARCHAR(30) NOT NULL DEFAULT '',_
 `zip`_       __INT(11) NOT NULL,_
 `state`       _VARCHAR(30) NOT NULL DEFAULT '', 
_`phone number` VARCHAR(11)_DEFAULT_NULL,_
 PRIMARY KEY (`user_id`)_
) 
engine=innodb 
DEFAULT charset=latin1; 

CREATE TABLE_`credit_card_details` 
( 
 `cc_num`  _ VARCHAR(30) NOT NULL DEFAULT '', 
_`card_type` VARCHAR(30) NOT NULL DEFAULT '',_
 `sec_code`  INT(3) NOT_NULL, 
_`exp_date`  DATE NOT NULL,_
 `user_id` _ VARCHAR(30)_NOT NULL DEFAULT_'', 
 PRIMARY KEY (`cc_num`) 
)_
engine=innodb 
DEFAULT charset=latin1;_

Is this the most efficient way_to_do this? I_am_pretty_sure all_tables would be_in_third normal_form,_and all can be linked. If_this_is not the correct way to do_this, could somebody please_point_out to me what_I could be doing differently_to improve my design or how_to implement_this design_in a better way?

A:

Never assume that you're only going to have_one product. That will end up_being a limiting factor_of your_design_and can cause_you_a lot_of pain later down the line and_rules out_any kind of code re-usability. Make_your products table generic_enough_to handle any kind of product._Create color/size attribute tables that you_can tie to the product_if_you_need to. 
What about handling_the case where people want to_order as a_guest or will you rule that out_entirely?
How_will you handle returned items/payment credits,_cancelled_orders, or an order where the_credit_card_is declined? Are you going_to keep history for those?
You will_probably need more than 1 line for address. Are_you going to_handle international orders? If so_you'll_need_to allow for non-numerical zip codes and ones that don't_tie to_a state.
If you_tie shopping carts to cookies then you can reload someone's_shopping cart when they come back based_on