create database Book;
//购书单号
//用户名
//书名
//交易数量
//交易金额
//交易日期
create table traderecord(
ordernumber int auto_increment not null,
username varchar(16),
bookname varchar(20),
bookprice double,
tradenumber int(8),
tradesum double,
tradedate TIMESTAMP,
primary key(ordernumber))
;
//用户名
//用户密码
//真实姓名
//用户性别
//身份证号
//电话
//邮件地址
//联系电话
//用户级别
//注册时间
create table user(
username varchar(50) not null,
userpassword varchar(30) not null,
realname varchar(30),
usersex varchar(10),
pid varchar(50),
phone varchar(30),
email varchar(50),
address varchar(50),
useragree varchar(10),
registerdate date,
primary key(username))
;
//图书编号
//图书名称
//图书作者
//出版社
//出版日期
//图书价格
//图书类别
//库存数量
//上架日期
create table book(
bookid int(10) auto_increment not null,
bookname varchar(20) not null,
bauthor varchar(10) not null,
bpublisher varchar(100) not null,
bpdate date not null,
bprice double not null,
bcategory varchar(20) not null,
bcount int not null,
bupdate date,
primary key(bookid))
;
//管理员名
//管理员密码
create table operator(
operatorname varchar(20) not null,
operatorpwd varchar(20) not null,
primary key(operatorname))
;
create table message(
messageid INT AUTO_INCREMENT not null primary key,
username VARCHAR(10) not null,
title VARCHAR(100) not null,
content TEXT,
messagetime TIMESTAMP not null);
insert into operator(operatorname,operatorpwd) values("liukun","19851012");
insert into book(bookid,bookname,bauthor,bpublisher,bpdate,bprice,bcategory,bcount,bupdate) values(1,"数据结构","严蔚敏","清华大学",19801012,50,"计算机",20,20071012);
insert into book(bookid,bookname,bauthor,bpublisher,bpdate,bprice,bcategory,bcount,bupdate) values(2,"操作系统","邓文操","清华大学",19801012,80,"计算机",50,20071012);
insert into book(bookid,bookname,bauthor,bpublisher,bpdate,bprice,bcategory,bcount,bupdate) values(3,"jsp从入门到精通","邹竹彪","清华大学",19850415,100,"计算机",65,20061025);
insert into book(bookid,bookname,bauthor,bpublisher,bpdate,bprice,bcategory,bcount,bupdate) values(4,"邓小平理论与指导","赵宏伟","电子工业出版社",19870415,100,"文学",35,20051024);
insert into user(username,userpassword ,realname,usersex,pid,phone,email,address,useragree,registerdate)values("lk", "19851012", "刘坤", "男","210", "8732026", "163.com", "沈阳","1", 20071022);
insert into traderecord(username,bookname,bookprice,tradenumber,tradesum)values("liukun","java",50.0,5,250);
update book set bcount=6 where bookid=1;
select * from book where bupdate>=20070101;
评论0