From 29f7e67e72e7ed880e1f8a97f0451fdd85a10390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E8=89=AF=E6=B6=9B?= <12071381+shiliangtao@user.noreply.gitee.com> Date: Mon, 11 Sep 2023 14:20:23 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=2020=20?= =?UTF-8?q?=E7=9F=B3=E8=89=AF=E5=A5=97=20=E4=B8=BA=2020=20=E7=9F=B3?= =?UTF-8?q?=E8=89=AF=E6=B6=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...47\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" | 0 ...47\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename "20 \347\237\263\350\211\257\345\245\227/20230905MySQL\351\253\230\347\272\247\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" => "20 \347\237\263\350\211\257\346\266\233/20230905MySQL\351\253\230\347\272\247\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" (100%) rename "20 \347\237\263\350\211\257\345\245\227/20230906MySQL\351\253\230\347\272\247\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" => "20 \347\237\263\350\211\257\346\266\233/20230906MySQL\351\253\230\347\272\247\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" (100%) diff --git "a/20 \347\237\263\350\211\257\345\245\227/20230905MySQL\351\253\230\347\272\247\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" "b/20 \347\237\263\350\211\257\346\266\233/20230905MySQL\351\253\230\347\272\247\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" similarity index 100% rename from "20 \347\237\263\350\211\257\345\245\227/20230905MySQL\351\253\230\347\272\247\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" rename to "20 \347\237\263\350\211\257\346\266\233/20230905MySQL\351\253\230\347\272\247\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" diff --git "a/20 \347\237\263\350\211\257\345\245\227/20230906MySQL\351\253\230\347\272\247\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" "b/20 \347\237\263\350\211\257\346\266\233/20230906MySQL\351\253\230\347\272\247\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" similarity index 100% rename from "20 \347\237\263\350\211\257\345\245\227/20230906MySQL\351\253\230\347\272\247\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" rename to "20 \347\237\263\350\211\257\346\266\233/20230906MySQL\351\253\230\347\272\247\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" -- Gitee From 2ae9b11fafe730a031ff9583b5cb02651fa2e829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E8=89=AF=E6=B6=9B?= <12071381+shiliangtao@user.noreply.gitee.com> Date: Mon, 11 Sep 2023 14:20:47 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 石良涛 <12071381+shiliangtao@user.noreply.gitee.com> --- .../20230908\347\273\223\346\236\204.md" | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 "20 \347\237\263\350\211\257\346\266\233/20230908\347\273\223\346\236\204.md" diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230908\347\273\223\346\236\204.md" "b/20 \347\237\263\350\211\257\346\266\233/20230908\347\273\223\346\236\204.md" new file mode 100644 index 0000000..deb1521 --- /dev/null +++ "b/20 \347\237\263\350\211\257\346\266\233/20230908\347\273\223\346\236\204.md" @@ -0,0 +1,122 @@ +### 结构 + +结构图分为: + +1. E-R图 +2. powerDesigner + +powerDesigner使用 + +1. 创建概念模型 类似于E-R图 以人的角度 +2. 转成逻辑模型 以计算机的角度 +3. 转换成物理模型 以数据库的角度 +4. 生成DDL语句 + +### 图书管理系统代码 + +~~~mysql +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/11 9:34:50 */ +/*==============================================================*/ +CREATE DATABASE take CHARSET utf8; +use take; +drop table if exists Admin; + +drop table if exists Borrowinfo; + +drop table if exists Readerinfo; + +drop table if exists book; + +drop table if exists limits; + +/*==============================================================*/ +/* Table: Admin */ +/*==============================================================*/ +create table Admin +( + A_id char(5) not null, + book_id char(10) not null, + Boor_id int not null, + A_name char(15) not null, + A_paw char(16), + A_tel char(11) not null, + primary key (A_id) +); + +/*==============================================================*/ +/* Table: Borrowinfo */ +/*==============================================================*/ +create table Borrowinfo +( + Boor_id int not null, + Reade_id char(10) not null, + book_id char(10) not null, + Rea_id char(10) not null, + Book_number char(10) not null, + Boor_time datetime not null, + due_time datetime not null, + return_time datetime not null, + state int not null, + admin_id char(10) not null, + primary key (Boor_id) +); + +/*==============================================================*/ +/* Table: Readerinfo */ +/*==============================================================*/ +create table Readerinfo +( + Reade_id char(10) not null, + Level char(10) not null, + name char(15) not null, + Reade_faculty char(10) not null, + Readejjtime timestamp not null, + primary key (Reade_id) +); + +/*==============================================================*/ +/* Table: book */ +/*==============================================================*/ +create table book +( + book_id char(10) not null, + title char(25) not null, + quantity int not null, + address varchar(25) not null, + author char(30) not null, + press char(30) not null, + time timestamp not null, + primary key (book_id) +); + +/*==============================================================*/ +/* Table: limits */ +/*==============================================================*/ +create table limits +( + Level char(10) not null, + MaxBookNum char(10) not null, + MaxDays char(10) not null, + primary key (Level) +); + +alter table Admin add constraint FK_admin foreign key (book_id) + references book (book_id) on delete restrict on update restrict; + +alter table Admin add constraint FK_regulate foreign key (Boor_id) + references Borrowinfo (Boor_id) on delete restrict on update restrict; + +alter table Borrowinfo add constraint FK_Borrowinfo foreign key (Reade_id) + references Readerinfo (Reade_id) on delete restrict on update restrict; + +alter table Borrowinfo add constraint FK_borrow foreign key (book_id) + references book (book_id) on delete restrict on update restrict; + +alter table Readerinfo add constraint FK_astrict foreign key (Level) + references limits (Level) on delete restrict on update restrict; + + +~~~ + -- Gitee