/*==============================================================*/
/* DBMS name: MySQL 5.0 */
/* Created on: 2012-11-11 15:47:35 */
/*==============================================================*/
drop table if exists Book;
drop table if exists BookAdmin;
drop table if exists BookCategory;
drop table if exists Indent;
drop table if exists IndentItem;
drop table if exists RegUser;
/*==============================================================*/
/* Table: Book */
/*==============================================================*/
create table Book
(
BookId int not null,
Book_CategoryId bigint,
BookName varchar(1024),
CategoryId int,
Author varchar(1024),
Publish varchar(1024),
ISBN varchar(1024),
Content varchar(1024),
Price float(8,2),
Amount int,
AvailableBooks int,
RegTime datetime,
primary key (BookId)
);
/*==============================================================*/
/* Table: BookAdmin */
/*==============================================================*/
create table BookAdmin
(
AdminId varchar(20) not null,
AdminPwd varchar(20),
primary key (AdminId)
);
/*==============================================================*/
/* Table: BookCategory */
/*==============================================================*/
create table BookCategory
(
CategoryId int not null,
Category varchar(1024),
primary key (CategoryId)
);
/*==============================================================*/
/* Table: Indent */
/*==============================================================*/
create table Indent
(
IndentId varchar(20) not null,
UserId varchar(1024),
SubmitTime datetime,
ConsignmentTime varchar(1024),
TotalPrice float(8,0),
IsPayOff tinyint,
IsSend tinyint,
primary key (IndentId)
);
/*==============================================================*/
/* Table: IndentItem */
/*==============================================================*/
create table IndentItem
(
Indent_IndentId varchar(20) not null,
BookId varchar(20) not null,
Amount varchar(1024),
primary key (BookId, Indent_IndentId),
foreign key (Indent_IndentId) references Indent (IndentId)
);
/*==============================================================*/
/* Table: RegUser */
/*==============================================================*/
create table RegUser
(
UserId varchar(20) not null,
Password varchar(1024),
UserName varchar(1024),
Sex varchar(1024),
Address varchar(1024),
Phone varchar(1024),
Post varchar(1024),
Email varchar(1024),
RegTime datetime,
RegIpAddress varchar(1024),
primary key (UserId)
);w
alter table Book add constraint FK_R_2 foreign key (Book_CategoryId)
references BookCategory (CategoryId) on delete restrict on update restrict;
alter table IndentItem add constraint FK_R_1 foreign key (Indent_IndentId)
references Indent (IndentId) on delete restrict on update restrict;
|
|