From 2385b8e99eac6227bb69832d23fab2f80fc1f4de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E8=88=92=E6=B1=B6?= <3228916049@qq.com> Date: Wed, 13 Sep 2023 04:51:20 +0000 Subject: [PATCH] =?UTF-8?q?9.2=E7=94=B5=E5=BD=B1=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李舒汶 <3228916049@qq.com> --- ...61\346\225\260\346\215\256\345\272\223.md" | 209 ++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 "49 \346\235\216\350\210\222\346\261\266/9.12\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.12\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" "b/49 \346\235\216\350\210\222\346\261\266/9.12\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" new file mode 100644 index 0000000..97b726c --- /dev/null +++ "b/49 \346\235\216\350\210\222\346\261\266/9.12\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" @@ -0,0 +1,209 @@ +```java +create DATABASE actors charset utf8; +use actors; +create table actor +( + actor_name varchar(22) not null, + director_name varchar(20) not null, + plot varchar(6) not null, + language varchar(20) not null, + primary key (actor_name) +); + +/*==============================================================*/ +/* Table: alias */ +/*==============================================================*/ +create table alias +( + alias_name varchar(20) not null, + movies_name varchar(20) not null, + primary key (alias_name) +); + +/*==============================================================*/ +/* Table: director */ +/*==============================================================*/ +create table director +( + director_name varchar(20) not null, + language varchar(20) not null, + director_gender char(1) not null, + director_constellation char(4) not null, + director_date date not null, + director_birthplace varchar(20) not null, + director_occupation varchar(20) not null, + director_alias char(20) not null, + director_family char(22) not null, + director_imdb int, + primary key (director_name) +); + +/*==============================================================*/ +/* Table: film */ +/*==============================================================*/ +create table film +( + film_name varchar(20) not null, + movies_name varchar(20) not null, + film_headline varchar(30) not null, + film_main body varchar(10) not null, + primary key (film_name) +); + +/*==============================================================*/ +/* Table: language */ +/*==============================================================*/ +create table language +( + language varchar(20) not null, + production_state varchar(20) not null, + director_name varchar(20) not null, + primary key (language) +); + +/*==============================================================*/ +/* Table: movie */ +/*==============================================================*/ +create table movie +( + movie_select varchar(20) not null, + movie_collect char(20) not null, + movie_recommend varchar(22) not null, + primary key (movie_select) +); + +/*==============================================================*/ +/* Table: movies */ +/*==============================================================*/ +create table movies +( + movies_name varchar(20) not null, + director_name varchar(20) not null, + movie_select varchar(20) not null, + movies_director varchar(22) not null, + movies_scriptwriter varchar(22) not null, + primary key (movies_name) +); + +/*==============================================================*/ +/* Table: production */ +/*==============================================================*/ +create table production +( + production_state varchar(20) not null, + director_name varchar(20) not null, + production_region varchar(20) not null, + primary key (production_state) +); + +/*==============================================================*/ +/* Table: "release" */ +/*==============================================================*/ +create table `release` +( + date date not null, + production_state varchar(20) not null, + director_name varchar(20) not null, + primary key (date) +); + +/*==============================================================*/ +/* Table: short */ +/*==============================================================*/ +create table short +( + short_id int not null auto_increment, + movies_name varchar(20) not null, + short_gender char(1) not null, + short_name varchar(20) not null, + short_account int not null, + primary key (short_id) +); + +/*==============================================================*/ +/* Table: time */ +/*==============================================================*/ +create table `time` +( + `time` date not null, + production_state varchar(20) not null, + primary key (`time`) +); + +/*==============================================================*/ +/* Table: type */ +/*==============================================================*/ +create table type +( + plot varchar(6) not null, + time date not null, + director_name varchar(20) not null, + primary key (plot) +); + +alter table actor add constraint FK_关系 foreign key (plot) + references type (plot) on delete restrict on update restrict; + +alter table actor add constraint FK_同事1 foreign key (director_name) + references director (director_name) on delete restrict on update restrict; + +alter table actor add constraint FK_属于1 foreign key (language) + references language (language) on delete restrict on update restrict; + +alter table alias add constraint FK_关系1 foreign key (movies_name) + references movies (movies_name) on delete restrict on update restrict; + +alter table director add constraint FK_决定4 foreign key (language) + references language (language) on delete restrict on update restrict; + +alter table film add constraint FK_关系6 foreign key (movies_name) + references movies (movies_name) on delete restrict on update restrict; + +alter table language add constraint FK_决定 foreign key (production_state) + references production (production_state) on delete restrict on update restrict; + +alter table language add constraint FK_决定5 foreign key (director_name) + references director (director_name) on delete restrict on update restrict; + +alter table movies add constraint FK_属于 foreign key (director_name) + references director (director_name) on delete restrict on update restrict; + +alter table movies add constraint FK_添加 foreign key (movie_select) + references movie (movie_select) on delete restrict on update restrict; + +alter table production add constraint FK_同事 foreign key (director_name) + references director (director_name) on delete restrict on update restrict; + +alter table release add constraint FK_Relationship_3 foreign key (director_name) + references director (director_name) on delete restrict on update restrict; + +alter table release add constraint FK_决定3 foreign key (production_state) + references production (production_state) on delete restrict on update restrict; + +alter table short add constraint FK_关系3 foreign key (movies_name) + references movies (movies_name) on delete restrict on update restrict; + +alter table `time` add constraint FK_定 foreign key (production_state) + references production (production_state) on delete restrict on update restrict; + +alter table type add constraint FK_决定1 foreign key (time) + references `time` (`time`) on delete restrict on update restrict; + +alter table type add constraint FK_决定6 foreign key (director_name) + references director (director_name) on delete restrict on update restrict; + +``` + + + + + + + +```ER +![a3a0e05f-7bed-468b-a899-78b826de90db](file:///C:/Users/user/Pictures/Typedown/a3a0e05f-7bed-468b-a899-78b826de90db.png) +``` + + + +![a3a0e05f-7bed-468b-a899-78b826de90db](file:///C:/Users/user/Pictures/Typedown/a3a0e05f-7bed-468b-a899-78b826de90db.png) -- Gitee