create table t_catalog_37
(
id bigint not null primary key auto_increment,
name varchar(50) not null unique,
description varchar(100)
);create table t_product_37
(
id bigint not null primary key auto_increment,
productname varchar(50) not null unique,
unitprice int not null,
description varchar(100),
catalog_id int
);create table t_user_37
(
id bigint not null primary key auto_increment,
u_id varchar(16) not null unique,
password varchar(16) not null ,
createtime date,
name varchar(10) ,
email varchar(32),
address varchar(255) ,
zipcode varchar(10),
telphone varchar(11),
homephone varchar(11),
officephone varchar(11),
score int
);create table t_order_37
(
id bigint not null primary key auto_increment,
createtime date,
status int not null,
totalprice int not null,
expirytime date,
user_id int
);create table t_item_37
(
id bigint not null primary key auto_increment,
quntity int not null,
cost int not null,
status int not null,
product_id  int references t_product_37(id),
order_id int references t_order_37(id)
);alter table t_product_37 add CONSTRAINT t_product_37_foreign_key foreign key (catalog_id) references t_catalog_37(id);
alter table t_order_37 add CONSTRAINT t_order_37_foreign_key foreign key (user_id) references t_user_37(id);
alter table t_item_37 add CONSTRAINT t_item_37_foreign_key foreign1 key (product_id) references t_product_37(id);
alter table t_item_37 add CONSTRAINT t_item_37_foreign_key foreign2 key (order_id) references t_order_37(id);

解决方案 »

  1.   

    varchar2-->varchar
    number-->INT
      

  2.   

    create sequence bookstore_seq; create table t_catalog_37 

    id int(6) primary key, 
    name varchar(50) not null unique, 
    description varchar(100) 
    ); create table t_product_37 

    id int(6) primary key, 
    productname varchar(50) not null unique, 
    unitprice int(6,2) not null, 
    description varchar(100), 
    catalog_id int(6) references t_catalog_37(id) 
    ); create table t_user_37 

    id int(6) primary key, 
    u_id varchar(16) not null unique, 
    password varchar(16) not null , 
    createtime date, 
    name varchar(10) , 
    email varchar(32), 
    address varchar(255) , 
    zipcode varchar(10), 
    telphone varchar(11), 
    homephone varchar(11), 
    officephone varchar(11), 
    score int(4) 
    ); create table t_order_37 

    id int(6) primary key, 
    createtime date, 
    status int(1) not null, 
    totalprice int(6,2) not null, 
    expirytime date, 
    user_id int(6) references t_user_37(id) 
    ); create table t_item_37 

    id int(6) primary key, 
    quntity int(4) not null, 
    cost int(6,2) not null, 
    status int(1) not null, 
    product_id  int(6) references t_product_37(id), 
    order_id int(6) references t_order_37(id) 
    );