数据库
create database productstore character set utf8 collate utf8_bin;
USE productstore;
-- 用户表
CREATE TABLE `user` (
`id` INT(11) AUTO_INCREMENT,
`userName` VARCHAR(20) ,
`password` VARCHAR(20) ,
`gender` VARCHAR(10) ,
`email` VARCHAR(50) ,
`telephone` VARCHAR(20) ,
`introduce` VARCHAR(100),
`activeCode` VARCHAR(50) ,
`state` INT(11) ,
`role` VARCHAR(20) default 'defaultUser',
`registTime` TIMESTAMP ,
PRIMARY KEY (`id`)
);
-- 商品表
CREATE TABLE `products` (
`id` VARCHAR(100) ,
`name` VARCHAR(40) ,
`price` DOUBLE ,
`category` VARCHAR(40) ,
`pnum` INT(11) ,
`imgurl` VARCHAR(100) ,
`description` VARCHAR(255) ,
PRIMARY KEY (`id`)
);
-- 订单表
CREATE TABLE `orders` (
`id` VARCHAR(100),
`money` DOUBLE,
`receiverAddress` VARCHAR(255),
`receiverName` VARCHAR(20),
`receiverPhone` VARCHAR(20),
`paystate` INT(11),
`ordertime` TIMESTAMP,
`user_id` INT(11),
PRIMARY KEY (`id`),
FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
);
-- 订单项表
CREATE TABLE `orderitem` (
`order_id` VARCHAR(100) ,
`product_id` VARCHAR(100),
`buynum` INT(11) ,
PRIMARY KEY (`order_id`,`product_id`),
FOREIGN KEY (`order_id`) REFERENCES `orders` (`id`),
FOREIGN KEY (`product_id`) REFERENCES `products` (`id`)
)
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。