drop table if EXISTS kind;
create table kind(
`kindId` int PRIMARY key auto_increment,
`kindName` VARCHAR(50) not null UNIQUE comment '种类名称'
);
create table smallKind(
sid int auto_increment,
sname varchar(100) not null,
kindId int not null,
CONSTRAINT smallKind_sid_Pk PRIMARY key(sid),
unique(sname),
CONSTRAINT smallKind_kindId_FK foreign key(kindId) REFERENCES kind(kindId)
)
drop table if EXISTS item;
create table item(
id int auto_increment,
name VARCHAR(255) not null,
salePoint VARCHAR(255),
salePrice DOUBLE not null,
marketPrice NUMERIC(11,2) not null,
inPrice double,
description text,
createDate date,
updateDate datetime,
constraint item_id_pk primary key(id)
)
alter table item add status int default '0' comment'0-新增,1-上架,2-下架';
alter table item add inPrice double;
alter table item add newLine varchar(30) UNIQUE;
alter table item MODIFY column sid long;
alter table post change COLUMN annotationOld annotationNew varchar(255);
alter table item change smallKindId sid int;
alter table item add foreign key(sid) REFERENCES smallkind(sid);
alter table item rename to xxx;
alter table xxx rename to item;
alter table item disable CONSTRAINT;
alter table item enable CONSTRAINT;
alter table kind DEFAULT CHARACTER set utf8;
alter table `kind` convert to character set utf8;
alter database sms character set utf8;
alter table item drop inprice;
drop table item;