From aaa28c4a9bfa5a2d41d91ff97585031167ddd737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E6=AD=A3=E6=B3=A2?= <1938448998@qq.com> Date: Sun, 10 Sep 2023 20:03:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B9=9D=E6=9C=88=E5=85=AB=E5=8F=B7=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...56\345\272\223\351\253\230\347\272\247.md" | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 "09 \346\233\271\346\255\243\346\263\242/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" new file mode 100644 index 0000000..f858ae9 --- /dev/null +++ "b/09 \346\233\271\346\255\243\346\263\242/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" @@ -0,0 +1,88 @@ +# 笔记 + +## 操作步骤 + +1.创建概念模型(E-R图) CDM + +2.转换成逻辑模型 LDM + +3.转换成物理模型 PDM + +4.生成DDL + + + +# 作业 + +```mysql +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/10 19:49:40 */ +/*==============================================================*/ + + +drop table if exists Books; + +drop table if exists Borrowing; + +drop table if exists Borrowing2; + +drop table if exists publishinghouse; + +/*==============================================================*/ +/* Table: Books */ +/*==============================================================*/ +create table Books +( + bo_id varchar(20) not null, + pu_id varchar(10) not null, + bo_name varchar(10) not null, + bo_loc varchar(20) not null, + primary key (bo_id) +); + +/*==============================================================*/ +/* Table: Borrowing */ +/*==============================================================*/ +create table Borrowing +( + borr_id varchar(2) not null, + borr_name varchar(5) not null, + primary key (borr_id) +); + +/*==============================================================*/ +/* Table: Borrowing2 */ +/*==============================================================*/ +create table Borrowing2 +( + bo_id varchar(20) not null, + borr_id varchar(2) not null, + borr_date varchar(10) not null, + "Return" varchar(10) not null, + primary key (bo_id, borr_id, borr_date) +); + +/*==============================================================*/ +/* Table: publishinghouse */ +/*==============================================================*/ +create table publishinghouse +( + pu_id varchar(10) not null, + pu_call char(11) not null, + pu_zip char(6) not null, + primary key (pu_id) +); + +alter table Books add constraint FK_publication foreign key (pu_id) + references publishinghouse (pu_id) on delete restrict on update restrict; + +alter table Borrowing2 add constraint FK_Borrowing foreign key (bo_id) + references Books (bo_id) on delete restrict on update restrict; + +alter table Borrowing2 add constraint FK_Borrowing2 foreign key (borr_id) + references Borrowing (borr_id) on delete restrict on update restrict; + + +``` + -- Gitee