From 8235cfb61a01a26394f9a1f7240290e9f7bf609b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=BF=8A=E4=BC=9F?= <2421084001@qq.com> Date: Wed, 13 Sep 2023 22:35:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...65\345\275\261\344\275\234\344\270\232.md" | 2 +- .../0913\345\274\200\350\215\257.md" | 128 ++++++++++++++++++ 2 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 "12\346\236\227\344\277\212\344\274\237/0913\345\274\200\350\215\257.md" diff --git "a/12\346\236\227\344\277\212\344\274\237/0912\347\224\265\345\275\261\344\275\234\344\270\232.md" "b/12\346\236\227\344\277\212\344\274\237/0912\347\224\265\345\275\261\344\275\234\344\270\232.md" index 616082a..efeb9cf 100644 --- "a/12\346\236\227\344\277\212\344\274\237/0912\347\224\265\345\275\261\344\275\234\344\270\232.md" +++ "b/12\346\236\227\344\277\212\344\274\237/0912\347\224\265\345\275\261\344\275\234\344\270\232.md" @@ -1,6 +1,6 @@ . -/*==============================================================*/. +/*==============================================================*/ /* DBMS name: MySQL 5.0 */ /* Created on: 2023/9/12 19:57:54 */ /*==============================================================*/ diff --git "a/12\346\236\227\344\277\212\344\274\237/0913\345\274\200\350\215\257.md" "b/12\346\236\227\344\277\212\344\274\237/0913\345\274\200\350\215\257.md" new file mode 100644 index 0000000..87acce0 --- /dev/null +++ "b/12\346\236\227\344\277\212\344\274\237/0913\345\274\200\350\215\257.md" @@ -0,0 +1,128 @@ +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/13 22:31:16 */ +/*==============================================================*/ + + +drop table if exists departement; + +drop table if exists doctor; + +drop table if exists kf; + +drop table if exists medicine; + +drop table if exists patient; + +drop table if exists prescription; + +drop table if exists window; + +/*==============================================================*/ +/* Table: departement */ +/*==============================================================*/ +create table departement +( + departement_id int(11) not null auto_increment, + departement_name varchar(11) not null, + departement varchar(11) not null, + departement_number int not null, + primary key (departement_id) +); + +/*==============================================================*/ +/* Table: doctor */ +/*==============================================================*/ +create table doctor +( + doctor_id int(11) not null auto_increment, + departement_id int not null, + doctor_name varchar(11) not null, + doctor_sex char(1) not null, + doctor_age int not null, + doctor_type varchar(11) not null, + primary key (doctor_id) +); + +/*==============================================================*/ +/* Table: kf */ +/*==============================================================*/ +create table kf +( + prescription_id int not null, + medicine_id int not null, + primary key (prescription_id, medicine_id) +); + +/*==============================================================*/ +/* Table: medicine */ +/*==============================================================*/ +create table medicine +( + medicine_id int(11) not null auto_increment, + doctor_id int not null, + patient_id int not null, + medicine_type varchar(11) not null, + medicine_no varchar(11) not null, + medicine_rules varchar(11) not null, + primary key (medicine_id) +); + +/*==============================================================*/ +/* Table: patient */ +/*==============================================================*/ +create table patient +( + patient_name varchar(11) not null, + patient_age int not null, + patient_sex char(1) not null, + patient_id int(111) not null auto_increment, + window_id int not null, + doctor_id int not null, + primary key (patient_id) +); + +/*==============================================================*/ +/* Table: prescription */ +/*==============================================================*/ +create table prescription +( + prescription_id int(11) not null auto_increment, + prescription_idd int not null, + prescription_time datetime not null, + primary key (prescription_id) +); + +/*==============================================================*/ +/* Table: window */ +/*==============================================================*/ +create table window +( + window_num int not null, + window_money int not null, + window_record int not null, + window_id int(11) not null auto_increment, + primary key (window_id) +); + +alter table doctor add constraint FK_bm foreign key (departement_id) + references departement (departement_id) on delete restrict on update restrict; + +alter table kf add constraint FK_kf foreign key (prescription_id) + references prescription (prescription_id) on delete restrict on update restrict; + +alter table kf add constraint FK_kf2 foreign key (medicine_id) + references medicine (medicine_id) on delete restrict on update restrict; + +alter table medicine add constraint FK_gz foreign key (doctor_id) + references doctor (doctor_id) on delete restrict on update restrict; + +alter table medicine add constraint FK_ny foreign key (patient_id) + references patient (patient_id) on delete restrict on update restrict; + +alter table patient add constraint FK_jq foreign key (window_id) + references window (window_id) on delete restrict on update restrict; + +alter table patient add constraint FK_zd foreign key (doctor_id) + references doctor (doctor_id) on delete restrict on update restrict; + -- Gitee