From 37a57427d4bd20b32abe284f7ca03efd1b58798a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E8=B5=B7=E7=91=9E?= <3148024859@qq.com> Date: Mon, 11 Sep 2023 14:21:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E5=9B=9B=E6=AC=A1=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...41\347\220\206\347\263\273\347\273\237.md" | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 "50 \345\274\240\350\265\267\347\221\236/20230909 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230909 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/50 \345\274\240\350\265\267\347\221\236/20230909 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" new file mode 100644 index 0000000..7060ed7 --- /dev/null +++ "b/50 \345\274\240\350\265\267\347\221\236/20230909 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" @@ -0,0 +1,111 @@ +## PowerDesigner + +第一步:创建概念模型(类似E-R图)CDM以用户角度 + +第二步:转换成逻辑模型(LDM) 以计算机角度 + +第三步:转换成物理模型 PDM(以数据库角度) + +第四步:生成DDL + +数据库设计步骤 + +1.需求分析,了解要开发的系统的需求,明确数据和格式 + +2.概念结构设计:将需求分析得到的抽象成概念模型,将ER图向关系模型转化 + +3.逻辑结构设计:将概念结构转化成DBMS所支持的数据模型 + +4.物理结构设计:将概念模型,转换成选定数据库管理系统需要的物理模型 + +5.数据库实施:根据物理模型生成对应的DDL + +6.数据库维护 + +```java +CREATE DATABASE test22 charset utf8; +use test22; + + +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/11 10:13:52 */ +/*==============================================================*/ + + +drop table if exists bookrent; + +drop table if exists bookreturn; + +drop table if exists bookse; + +drop table if exists uesr; + +/*==============================================================*/ +/* Table: bookrent */ +/*==============================================================*/ +create table bookrent +( + rent_id numeric(10,0) not null, + book_id int, + rent_date date not null, + book_odate date not null, + primary key (rent_id) +); + +/*==============================================================*/ +/* Table: bookreturn */ +/*==============================================================*/ +create table bookreturn +( + re_id numeric(10,0) not null, + book_id int, + re_date date not null, + primary key (re_id) +); + +/*==============================================================*/ +/* Table: "bookse-+" */ +/*==============================================================*/ +create table bookse +( + book_id int not null auto_increment, + user_id numeric(10,0) not null, + book_name char(5) not null, + book_bname char(10) not null, + book_number numeric(30,0) not null, + floor numeric(10,0) not null, + price int not null, + book_bid char(65) not null, + primary key (book_id) +); + +/*==============================================================*/ +/* Table: uesr */ +/*==============================================================*/ +create table uesr +( + user_id numeric(10,0) not null, + re_id numeric(30,0), + user_name char(10) not null, + password numeric(10,0) not null, + primary key (user_id) +); + +alter table bookrent add constraint FK_Relationship_2 foreign key (book_id) + references bookse (book_id) on delete restrict on update restrict; + +alter table bookreturn add constraint FK_Relationship_5 foreign key (book_id) + references bookse (book_id) on delete restrict on update restrict; + +alter table bookse add constraint FK_rent foreign key (user_id) + references uesr (user_id) on delete restrict on update restrict; + +alter table uesr add constraint FK_Relationship_4 foreign key (re_id) + references bookreturn (re_id) on delete restrict on update restrict; + + +``` + + + -- Gitee