⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 create_mysql.sql

📁 一个小型的购物商店
💻 SQL
字号:
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)
);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -