前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >mysql 网上书店系统数据库

mysql 网上书店系统数据库

作者头像
week
发布2018-08-27 10:26:37
3K0
发布2018-08-27 10:26:37
举报
文章被收录于专栏:用户画像
代码语言:javascript
复制
create database bookStore;
use bookStore;
代码语言:javascript
复制
create table book(
bookid int auto_increment not null,
catalogid int not null,
bookname varchar(20) not null,
price int not null,
picture varchar(30) not null,
primary key(bookid)
);
代码语言:javascript
复制
create table catalog(
catalogid int auto_increment not null,
catalogname varchar(20) not null,
primary key(catalogid)
);
代码语言:javascript
复制
create table orderitem(
orderitemid int auto_increment not null,
bookid int not null,
orderid int not null,
quantity int not null,
primary key(orderitemid)
);
代码语言:javascript
复制
create table orders(
orderid int auto_increment not null,
userid int not null,
orderdate timestamp not null,
primary key (orderid)
);
代码语言:javascript
复制
create table user(
userid int auto_increment not null,
username varchar(20) not null,
password varchar(20) not null,
sex varchar(4),
age int,
primary key(userid)
);
代码语言:javascript
复制
alter table book add constraint FK_Relationship_3 foreign key(catalogid)
references catalog(catalogid) on delete restrict on update restrict;

alter table orderitem add constraint FK_Relationship_2 foreign key (orderid)
references orders(orderid) on delete restrict on update restrict;

alter table orderitem add constraint FK_Relationship_4 foreign key (bookid)
references book(bookid) on delete restrict on update restrict;

alter table orders add constraint FK_Relationship_1 foreign key (userid)
	references user(userid) on delete restrict on update restrict;
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2014年03月27日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档