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 616082a09315d42847f5940faa3be37ad7625eb6..efeb9cf2972124c025415cc686f7c7ac77a53dac 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 0000000000000000000000000000000000000000..87acce0e60dfd8db10969dd5dd3ce583ff7b70da --- /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; +