From 54035414bb1a8091609a5a589060bd89adbe529b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=BA=86=E5=BC=BA?= Date: Sun, 10 Sep 2023 21:53:24 +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 --- .../20230908\345\233\276\344\271\246.md" | 280 ++++++++++++++++++ 1 file changed, 280 insertions(+) create mode 100644 "17 \350\221\243\345\272\206\345\274\272/20230908\345\233\276\344\271\246.md" diff --git "a/17 \350\221\243\345\272\206\345\274\272/20230908\345\233\276\344\271\246.md" "b/17 \350\221\243\345\272\206\345\274\272/20230908\345\233\276\344\271\246.md" new file mode 100644 index 0000000..b482a82 --- /dev/null +++ "b/17 \350\221\243\345\272\206\345\274\272/20230908\345\233\276\344\271\246.md" @@ -0,0 +1,280 @@ +笔记 + +教了新软件powerdesigner + +逻辑模型LDM + +物理模型PDM + +概念模型CDM + +```MYSQL +/*==============================================================*/ +/* DBMS name: Sybase SQL Anywhere 12 */ +/* Created on: 2023/9/10 21:43:57 */ +/*==============================================================*/ + + +if exists(select 1 from sys.sysforeignkey where role='FK_RELATION_RELATIONS_XS') then + alter table Relationship_3 + delete foreign key FK_RELATION_RELATIONS_XS +end if; + +if exists(select 1 from sys.sysforeignkey where role='FK_RELATION_RELATIONS_SB') then + alter table Relationship_3 + delete foreign key FK_RELATION_RELATIONS_SB +end if; + +if exists(select 1 from sys.sysforeignkey where role='FK_HS_RELATIONS_XS') then + alter table hs + delete foreign key FK_HS_RELATIONS_XS +end if; + +if exists(select 1 from sys.sysforeignkey where role='FK_LX_RELATIONS_TS') then + alter table lx + delete foreign key FK_LX_RELATIONS_TS +end if; + +if exists(select 1 from sys.sysforeignkey where role='FK_SB_RELATIONS_LX') then + alter table sb + delete foreign key FK_SB_RELATIONS_LX +end if; + +drop index if exists Relationship_3.Relationship_5_FK; + +drop index if exists Relationship_3.Relationship_3_PK; + +drop table if exists Relationship_3; + +drop index if exists hs.Relationship_4_FK; + +drop index if exists hs.hs_PK; + +drop table if exists hs; + +drop index if exists lx.Relationship_1_FK; + +drop index if exists lx.lx_PK; + +drop table if exists lx; + +drop index if exists sb.Relationship_2_FK; + +drop index if exists sb.sb_PK; + +drop table if exists sb; + +drop index if exists ts.ts_PK; + +drop table if exists ts; + +drop index if exists xs.xs_PK; + +drop table if exists xs; + +if exists(select 1 from sys.syssequence s + where sequence_name='S_hs') then + drop sequence S_hs +end if; + +if exists(select 1 from sys.syssequence s + where sequence_name='S_lx') then + drop sequence S_lx +end if; + +if exists(select 1 from sys.syssequence s + where sequence_name='S_sb') then + drop sequence S_sb +end if; + +if exists(select 1 from sys.syssequence s + where sequence_name='S_ts') then + drop sequence S_ts +end if; + +if exists(select 1 from sys.syssequence s + where sequence_name='S_xs') then + drop sequence S_xs +end if; + +create sequence S_hs; + +create sequence S_lx; + +create sequence S_sb; + +create sequence S_ts; + +create sequence S_xs; + +/*==============================================================*/ +/* Table: Relationship_3 */ +/*==============================================================*/ +create table Relationship_3 +( + xs_id integer not null, + sb_id integer not null, + constraint PK_RELATIONSHIP_3 primary key (xs_id, sb_id) +); + +/*==============================================================*/ +/* Index: Relationship_3_PK */ +/*==============================================================*/ +create unique index Relationship_3_PK on Relationship_3 ( +xs_id ASC, +sb_id ASC +); + +/*==============================================================*/ +/* Index: Relationship_5_FK */ +/*==============================================================*/ +create index Relationship_5_FK on Relationship_3 ( +sb_id ASC +); + +/*==============================================================*/ +/* Table: hs */ +/*==============================================================*/ +create table hs +( + hs_time time not null, + hs_name char(20) not null, + hs_id integer not null default (S_hs.nextval), + xs_id integer not null, + constraint PK_HS primary key (hs_id) +); + +/*==============================================================*/ +/* Index: hs_PK */ +/*==============================================================*/ +create unique index hs_PK on hs ( +hs_id ASC +); + +/*==============================================================*/ +/* Index: Relationship_4_FK */ +/*==============================================================*/ +create index Relationship_4_FK on hs ( +xs_id ASC +); + +/*==============================================================*/ +/* Table: lx */ +/*==============================================================*/ +create table lx +( + lx_id integer not null default (S_lx.nextval), + ts_id integer not null, + lx_name char(20) not null, + lx_wz char(20) not null, + constraint PK_LX primary key (lx_id) +); + +/*==============================================================*/ +/* Index: lx_PK */ +/*==============================================================*/ +create unique index lx_PK on lx ( +lx_id ASC +); + +/*==============================================================*/ +/* Index: Relationship_1_FK */ +/*==============================================================*/ +create index Relationship_1_FK on lx ( +ts_id ASC +); + +/*==============================================================*/ +/* Table: sb */ +/*==============================================================*/ +create table sb +( + sb_id integer not null default (S_sb.nextval), + lx_id integer not null, + sb_name char(20) not null, + constraint PK_SB primary key (sb_id) +); + +/*==============================================================*/ +/* Index: sb_PK */ +/*==============================================================*/ +create unique index sb_PK on sb ( +sb_id ASC +); + +/*==============================================================*/ +/* Index: Relationship_2_FK */ +/*==============================================================*/ +create index Relationship_2_FK on sb ( +lx_id ASC +); + +/*==============================================================*/ +/* Table: ts */ +/*==============================================================*/ +create table ts +( + ts_id integer not null default (S_ts.nextval), + ts_name char(20) not null, + ts_dz char(20) not null, + constraint PK_TS primary key (ts_id) +); + +/*==============================================================*/ +/* Index: ts_PK */ +/*==============================================================*/ +create unique index ts_PK on ts ( +ts_id ASC +); + +/*==============================================================*/ +/* Table: xs */ +/*==============================================================*/ +create table xs +( + xs_id integer not null default (S_xs.nextval), + xs_name char(20) not null, + constraint PK_XS primary key (xs_id) +); + +/*==============================================================*/ +/* Index: xs_PK */ +/*==============================================================*/ +create unique index xs_PK on xs ( +xs_id ASC +); + +alter table Relationship_3 + add constraint FK_RELATION_RELATIONS_XS foreign key (xs_id) + references xs (xs_id) + on update restrict + on delete restrict; + +alter table Relationship_3 + add constraint FK_RELATION_RELATIONS_SB foreign key (sb_id) + references sb (sb_id) + on update restrict + on delete restrict; + +alter table hs + add constraint FK_HS_RELATIONS_XS foreign key (xs_id) + references xs (xs_id) + on update restrict + on delete restrict; + +alter table lx + add constraint FK_LX_RELATIONS_TS foreign key (ts_id) + references ts (ts_id) + on update restrict + on delete restrict; + +alter table sb + add constraint FK_SB_RELATIONS_LX foreign key (lx_id) + references lx (lx_id) + on update restrict + on delete restrict; + + +``` + + -- Gitee