diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230912 \347\224\265\345\275\261\346\236\266\346\236\204\345\233\276.md" "b/14 \346\235\216\344\277\212\345\205\264/20230912 \347\224\265\345\275\261\346\236\266\346\236\204\345\233\276.md" new file mode 100644 index 0000000000000000000000000000000000000000..a99c150257ff0274d11a7f728a1a0fad860cca35 --- /dev/null +++ "b/14 \346\235\216\344\277\212\345\205\264/20230912 \347\224\265\345\275\261\346\236\266\346\236\204\345\233\276.md" @@ -0,0 +1,191 @@ +### 电影架构图 + +![图片1](https://s2.loli.net/2023/09/12/lA7GCrDE1m54pbo.png) + +~~~mysql +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/12 18:32:00 */ +/*==============================================================*/ +CREATE DATABASE movie_db CHARSET utf8; +use movie_db; + +drop table if exists director; + +drop table if exists film; + +drop table if exists language; + +drop table if exists movieInfo; + +drop table if exists participants; + +drop table if exists protagonist; + +drop table if exists region; + +drop table if exists score; + +drop table if exists scriptwriter; + +drop table if exists user; + +/*==============================================================*/ +/* Table: director */ +/*==============================================================*/ +create table director +( + part_id char(10) not null, + movie_id char(8) not null, + primary key (part_id, movie_id) +); + +/*==============================================================*/ +/* Table: film */ +/*==============================================================*/ +create table film +( + film_id char(10) not null, + user_id char(10) not null, + film_name char(10) not null, + film_title char(10) not null, + text char(10) not null, + appraise char(10), + primary key (film_id) +); + +/*==============================================================*/ +/* Table: language */ +/*==============================================================*/ +create table language +( + lang_id char(10) not null, + lang_name varchar(5), + primary key (lang_id) +); + +/*==============================================================*/ +/* Table: movieInfo */ +/*==============================================================*/ +create table movieInfo +( + movie_id char(8) not null, + film_id char(10) not null, + sc_id char(10) not null, + lang_id char(10) not null, + movie_name varchar(20) not null, + movie_time int not null, + type_id char(5) not null, + release_date datetime not null, + alias varchar(20) not null, + primary key (movie_id) +); + +/*==============================================================*/ +/* Table: participants */ +/*==============================================================*/ +create table participants +( + part_id char(10) not null, + name char(10) not null, + age int, + primary key (part_id) +); + +/*==============================================================*/ +/* Table: protagonist */ +/*==============================================================*/ +create table protagonist +( + part_id char(10) not null, + movie_id char(8) not null, + sex char(1) not null, + birthday varchar(15) not null, + `else` varchar(10), + profession char(30) not null, + address varchar(15), + primary key (part_id, movie_id) +); + +/*==============================================================*/ +/* Table: region */ +/*==============================================================*/ +create table region +( + reg_id char(10) not null, + movie_id char(8), + reg_name char(25) not null, + primary key (reg_id) +); + +/*==============================================================*/ +/* Table: score */ +/*==============================================================*/ +create table score +( + sc_id char(10) not null, + user_id char(10) not null, + grade char(10) not null, + primary key (sc_id) +); + +/*==============================================================*/ +/* Table: scriptwriter */ +/*==============================================================*/ +create table scriptwriter +( + part_id char(10) not null, + movie_id char(8) not null, + primary key (part_id, movie_id) +); + +/*==============================================================*/ +/* Table: user */ +/*==============================================================*/ +create table user +( + user_id char(10) not null, + user_name varchar(20) not null, + user_sex char(1) not null, + primary key (user_id) +); + +alter table director add constraint FK_director foreign key (part_id) + references participants (part_id) on delete restrict on update restrict; + +alter table director add constraint FK_director2 foreign key (movie_id) + references movieInfo (movie_id) on delete restrict on update restrict; + +alter table film add constraint FK_write foreign key (user_id) + references user (user_id) on delete restrict on update restrict; + +alter table movieInfo add constraint FK_evaluate foreign key (film_id) + references film (film_id) on delete restrict on update restrict; + +alter table movieInfo add constraint FK_mark foreign key (sc_id) + references score (sc_id) on delete restrict on update restrict; + +alter table movieInfo add constraint FK_select foreign key (lang_id) + references language (lang_id) on delete restrict on update restrict; + +alter table protagonist add constraint FK_protagonist foreign key (part_id) + references participants (part_id) on delete restrict on update restrict; + +alter table protagonist add constraint FK_protagonist2 foreign key (movie_id) + references movieInfo (movie_id) on delete restrict on update restrict; + +alter table region add constraint FK_publish foreign key (movie_id) + references movieInfo (movie_id) on delete restrict on update restrict; + +alter table score add constraint FK_comment foreign key (user_id) + references user (user_id) on delete restrict on update restrict; + +alter table scriptwriter add constraint FK_scriptwriter foreign key (part_id) + references participants (part_id) on delete restrict on update restrict; + +alter table scriptwriter add constraint FK_scriptwriter2 foreign key (movie_id) + references movieInfo (movie_id) on delete restrict on update restrict; + + +~~~ +