drop table if exists cart_user;
drop table if exists cart_product;
drop table if exists cart_order;
drop table if exists cart_item;
create table cart_user(
id integer primary key auto_increment,
name varchar(32) not null unique,
password varchar(32) not null,
address varchar(512),
postcode varchar(10),
email varchar(32),
home_phone varchar(32),
cell_phone varchar(32),
office_phone varchar(32)
);
insert into cart_user values(1,'tarena','tarena','dazhongsi','100081','tarena@tarena.com.cn','62136369','62136369','62136369');
create table cart_product(
id integer primary key auto_increment,
name varchar(32) not null,
description varchar(64),
price double(8,2) not null
);
insert into cart_product values(1,'pencil','pencil',2.00);
insert into cart_product values(2,'pen','pen',5.00);
insert into cart_product values(3,'rubber','rubber',1.00);
insert into cart_product values(4,'notebook','notebook',2.00);
insert into cart_product values(5,'gluewater','gluewater',5.00);
insert into cart_product values(6,'pencilcase','pencilcase',10.00);
insert into cart_product values(7,'ballpen','ballpen',2.00);
create table cart_order(
id integer primary key auto_increment,
status tinyint,
user_id int references user(id),
cost double(10,2)
);
create table cart_item(
id integer primary key auto_increment,
amount int,
product_id int references product(id),
order_id int references user_order(id)
);