求問數據庫問題
create database shop;
use shop;
create table shop_pro(
?? ?id int unsigned auto_increment key,
?? ?pName varchar(50) not null unique,
?? ?/*--商品貨號*/
?? ?pSn varchar(50) not null ,
?? ?/*--商品數量*/
?? ?pNum int unsigned default 1,
?? ?/*--商品進貨價格*/
?? ?mPrice decimal(10,2) not null,
?? ?/*--售賣價格*/
?? ?iPrice decimal(10,2) not null,
?? ?/*--商品圖片*/
?? ?pImg varchar(50) not null,
?? ?/*--上架時間*/
?? ?pubTime int unsigned not null,
?? ?/*--商品簡介*/
?? ?pDesc text not null,
?? ?/*--商品是否在賣*/
?? ?isShow tinyint(1) default 1,
?? ?/*--商品是否熱賣*/
?? ?isHot tinyint(1) default 0,
?? ?/*--商品屬于哪個分類之下*/
?? ?cId smallint unsigned(10,2) not null
);
請老師解答一下,一直建立不了表是怎么回事,還有正確應該怎么建立這張表。
2016-11-17
"id int unsigned auto_increment key,”主鍵少了primary. ?應該是“id int unsigned auto_increment primary key,”.
?"cId smallint unsigned(10,2) not null" ?unsigned(10,2)的參數取消掉就好了."cId smallint unsigned not null"
2016-11-17
已經解決了謝謝