logo资料库

图书管理系统sql语句.doc

第1页 / 共3页
第2页 / 共3页
第3页 / 共3页
资料共3页,全文预览结束
数据库使用的是 mysql Create database db_library; Use db_library; Create table admin( admin_id varchar(6) primary key, password varchar(6), name varchar(10), IDCard varchar(18), tel varchar(14) ); Create table leader( leader_id varchar(6) primary key, password varchar(6) ); Create table member( member_id varchar(11) primary key, password varchar(6), name varchar(10), IDCard char(18), tel varchar(14), outTimeCount int, loseCount int, scores int ); Create table memberlendimfo( member_id varchar(11), book_id varchar(16) reference book(book_id), primary key(member_id,book_id) ); Create table bookclass ( classtag varchar(4) primary key, class varchar(30) ); Create table bookimfo( books_id varchar(16) primary key, bookname varchar(30),
references bookclass(classtag), classtag varchar(4) fromwhere varchar(30), author varchar(10), price decimal(8,2), buyTime sellprice decimal(8,2), count int ); varchar(8)yyyymmdd………………………………………………………….. Create table book( book_id varchar(16) primary key, books_id varchar(16) references bookimfo(books_id), islend Boolean, lendTime date,…………………………………………………………….. getTime date……………………………………………………………….. ); Create table relose( book_id varchar(16) primary key, relosetime date…………………………………………. ); Create table lose( book_id varchar(16) primary key, isgotmoney Boolean ); Create table maxtime(day int);………………………… Create table bookcount( books_id varchar(16) primary key, month date,……………………………………………. tatol int ); 为 memberlendimfo 添加 book_id 外键 book,member_id 外键 member alter table memberlendimfo add constraint FK_M_B foreign key memberlendimfo(book_id) references book(book_id); alter table memberlendimfo add constraint FK_M_B
foreign key memberlendimfo(book_id) references book(book_id);
分享到:
收藏