diff --git "a/11 \351\202\271\344\272\250\344\274\237/1.PNG" "b/11 \351\202\271\344\272\250\344\274\237/1.PNG" new file mode 100644 index 0000000000000000000000000000000000000000..b73784eb4ca367ca096ff64b19d0cff1644027c4 Binary files /dev/null and "b/11 \351\202\271\344\272\250\344\274\237/1.PNG" differ diff --git "a/11 \351\202\271\344\272\250\344\274\237/2.PNG" "b/11 \351\202\271\344\272\250\344\274\237/2.PNG" new file mode 100644 index 0000000000000000000000000000000000000000..f9e944ea5539c9b5e308c50301efe542084fd0cf Binary files /dev/null and "b/11 \351\202\271\344\272\250\344\274\237/2.PNG" differ diff --git "a/11 \351\202\271\344\272\250\344\274\237/3.PNG" "b/11 \351\202\271\344\272\250\344\274\237/3.PNG" new file mode 100644 index 0000000000000000000000000000000000000000..87359ecc6c92ee6678658bffa1c3bb8a7011d11f Binary files /dev/null and "b/11 \351\202\271\344\272\250\344\274\237/3.PNG" differ diff --git "a/11 \351\202\271\344\272\250\344\274\237/9.10\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/11 \351\202\271\344\272\250\344\274\237/9.10\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" new file mode 100644 index 0000000000000000000000000000000000000000..cb0e9bbaf86b988b3c0f1b216711889f5436fa38 --- /dev/null +++ "b/11 \351\202\271\344\272\250\344\274\237/9.10\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" @@ -0,0 +1,184 @@ +## 图书馆管理系统 + + + +``` + + + +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/11 10:47:30 */ +/*==============================================================*/ + + +drop table if exists Book; + +drop table if exists Bookshelf; + +drop table if exists Floor; + +drop table if exists Librarian; + +drop table if exists Library; + +drop table if exists Return_book; + +drop table if exists borrower; + +drop table if exists type; + +drop table if exists 借书; + +drop table if exists 入库; + +drop table if exists 分类; + +/*==============================================================*/ +/* Table: Book */ +/*==============================================================*/ +create table Book +( + book_id int not null, + Li_num int not null, + book_name char(255) not null, + primary key (book_id) +); + +/*==============================================================*/ +/* Table: Bookshelf */ +/*==============================================================*/ +create table Bookshelf +( + Bo_shelf_id int not null auto_increment, + Fl_num int not null, + Bo_shelf_name char(255) not null, + primary key (Bo_shelf_id) +); + +/*==============================================================*/ +/* Table: Floor */ +/*==============================================================*/ +create table Floor +( + Fl_num int not null auto_increment, + Lib_num int not null, + Fl_belong char(255) not null, + primary key (Fl_num) +); + +/*==============================================================*/ +/* Table: Librarian */ +/*==============================================================*/ +create table Librarian +( + Li_num int not null, + Li_name char(255) not null, + primary key (Li_num) +); + +/*==============================================================*/ +/* Table: Library */ +/*==============================================================*/ +create table Library +( + Lib_num int not null, + Lib_name char(255) not null, + primary key (Lib_num) +); + +/*==============================================================*/ +/* Table: Return_book */ +/*==============================================================*/ +create table Return_book +( + Re_book int not null, + Re_name char(255) not null, + primary key (Re_book) +); + +/*==============================================================*/ +/* Table: borrower */ +/*==============================================================*/ +create table borrower +( + borr_num int not null, + borr_name char(255) not null, + borr_date date not null, + borr_add char(255) not null, + primary key (borr_num) +); + +/*==============================================================*/ +/* Table: type */ +/*==============================================================*/ +create table type +( + Book_type_id int not null, + Bo_shelf_id int not null, + Book_type_name char(255) not null, + primary key (Book_type_id) +); + +/*==============================================================*/ +/* Table: 借书 */ +/*==============================================================*/ +create table 借书 +( + borr_num int not null, + book_id int not null, + primary key (borr_num, book_id) +); + +/*==============================================================*/ +/* Table: 入库 */ +/*==============================================================*/ +create table 入库 +( + Re_book int not null, + Li_num int not null, + primary key (Re_book, Li_num) +); + +/*==============================================================*/ +/* Table: 分类 */ +/*==============================================================*/ +create table 分类 +( + book_id int not null, + Book_type_id int not null, + primary key (book_id, Book_type_id) +); + +alter table Book add constraint FK_管理 foreign key (Li_num) + references Librarian (Li_num) on delete restrict on update restrict; + +alter table Bookshelf add constraint FK_包含 foreign key (Fl_num) + references Floor (Fl_num) on delete restrict on update restrict; + +alter table Floor add constraint FK_包括 foreign key (Lib_num) + references Library (Lib_num) on delete restrict on update restrict; + +alter table type add constraint FK_下级 foreign key (Bo_shelf_id) + references Bookshelf (Bo_shelf_id) on delete restrict on update restrict; + +alter table 借书 add constraint FK_借书 foreign key (borr_num) + references borrower (borr_num) on delete restrict on update restrict; + +alter table 借书 add constraint FK_借书2 foreign key (book_id) + references Book (book_id) on delete restrict on update restrict; + +alter table 入库 add constraint FK_入库 foreign key (Re_book) + references Return_book (Re_book) on delete restrict on update restrict; + +alter table 入库 add constraint FK_入库2 foreign key (Li_num) + references Librarian (Li_num) on delete restrict on update restrict; + +alter table 分类 add constraint FK_分类 foreign key (book_id) + references Book (book_id) on delete restrict on update restrict; + +alter table 分类 add constraint FK_分类2 foreign key (Book_type_id) + references type (Book_type_id) on delete restrict on update restrict; + + +``` \ No newline at end of file