当前位置:网站首页>Design of library management database system

Design of library management database system

2022-04-23 19:42:00 X heart

The first 1 Turn off : Database table design - The book list

# Please add the implementation code here 
########## Begin ##########
# stay library_db Create... In the library books surface 
use library_db;
create table books(
    bookId int(11) primary key not null,
    bookName varchar(255) not null,
    publicationDate datetime not null,
    publisher varchar(255) not null,
    bookrackId int(11) not null,
    roomId int(11) not null
);


########## End ##########

The first 2 Turn off : Database table design - Reader table

# Please add the implementation code here 
########## Begin ##########
# stay library_db Create... In the library reader surface 
use library_db;
create table reader(
    borrowBookId int(11) primary key,
    name varchar(20) not null,
    age int(11) not null,
    sex varchar(2) not null,
    address varchar(255) not null
);


########## End ##########

  The first 3 Turn off : Database table design - Association table

# Please add the implementation code here 
########## Begin ##########
# stay library_db Create... In the library bookrack surface 
use library_db;
create table bookrack(
    bookrackId int(11) primary key,
    roomId int(11) not null,
    constraint FK_bookrack_bookrackId foreign key(bookrackId) references books(bookrackId),
    constraint FK_bookrack_roomId foreign key(roomId) references books(roomId)
);


# stay library_db Create... In the library borrow surface 
create table borrow(
    borrowBookId int(11) primary key,
    bookId int(11) not null,
    borrowDate datetime not null,
    returnDate datetime not null,
    constraint FK_borrow_borrowBookId foreign key(borrowBookId) references reader(borrowBookId),
    constraint FK_borrow_bookId foreign key(bookId) references books(bookId)
);


########## End ##########

版权声明
本文为[X heart]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231927030692.html