From 412cf3ca114ad1d2d94eefca569374e811a465cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=96=87=E9=94=8B?= <2069827762@qq.com> Date: Wed, 13 Sep 2023 00:41:11 +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 --- ...65\345\275\261\347\256\241\347\220\206.md" | 202 ++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 "07 \345\210\230\346\226\207\351\224\213/20230912\347\224\265\345\275\261\347\256\241\347\220\206.md" diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230912\347\224\265\345\275\261\347\256\241\347\220\206.md" "b/07 \345\210\230\346\226\207\351\224\213/20230912\347\224\265\345\275\261\347\256\241\347\220\206.md" new file mode 100644 index 0000000..6db6cd2 --- /dev/null +++ "b/07 \345\210\230\346\226\207\351\224\213/20230912\347\224\265\345\275\261\347\256\241\347\220\206.md" @@ -0,0 +1,202 @@ + + +### 电影管理 + +``` java +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023-09-12 11:33:30 */ +/*==============================================================*/ + + +drop table if exists actor; + +drop table if exists director; + +drop table if exists film; + +drop table if exists "film language"; + +drop table if exists "film review"; + +drop table if exists "film types"; + +drop table if exists film_region; + +drop table if exists language; + +drop table if exists protagonist; + +drop table if exists region; + +drop table if exists scriptwriter; + +drop table if exists type; + +/*==============================================================*/ +/* Table: actor */ +/*==============================================================*/ +create table actor +( + actor_id int not null auto_increment, + actor_name varchar(4) not null, + primary key (actor_id) +); + +/*==============================================================*/ +/* Table: director */ +/*==============================================================*/ +create table director +( + film_id int not null, + actor_id int not null, + primary key (film_id, actor_id) +); + +/*==============================================================*/ +/* Table: film */ +/*==============================================================*/ +create table film +( + film_id int not null auto_increment, + film_name varchar(10) not null, + film_date date not null, + film_time time not null, + primary key (film_id) +); + +/*==============================================================*/ +/* Table: "film language" */ +/*==============================================================*/ +create table "film language" +( + film_id int not null, + lgg_id char(10) not null, + primary key (film_id, lgg_id) +); + +/*==============================================================*/ +/* Table: "film review" */ +/*==============================================================*/ +create table "film review" +( + fr_id char(10) not null, + film_id int not null, + fr_grade char(1) not null, + fr_title varchar(10), + fr_text text, + primary key (fr_id) +); + +/*==============================================================*/ +/* Table: "film types" */ +/*==============================================================*/ +create table "film types" +( + film_id int not null, + type_id int not null, + primary key (film_id, type_id) +); + +/*==============================================================*/ +/* Table: film_region */ +/*==============================================================*/ +create table film_region +( + film_id int not null, + region_id int not null, + primary key (film_id, region_id) +); + +/*==============================================================*/ +/* Table: language */ +/*==============================================================*/ +create table language +( + lgg_id char(10) not null, + lgg_name varchar(10) not null, + primary key (lgg_id) +); + +/*==============================================================*/ +/* Table: protagonist */ +/*==============================================================*/ +create table protagonist +( + film_id int not null, + actor_id int not null, + primary key (film_id, actor_id) +); + +/*==============================================================*/ +/* Table: region */ +/*==============================================================*/ +create table region +( + region_id int not null auto_increment, + region_name varchar(10) not null, + primary key (region_id) +); + +/*==============================================================*/ +/* Table: scriptwriter */ +/*==============================================================*/ +create table scriptwriter +( + film_id int not null, + actor_id int not null, + primary key (film_id, actor_id) +); + +/*==============================================================*/ +/* Table: type */ +/*==============================================================*/ +create table type +( + type_id int not null auto_increment, + type_name varchar(2) not null, + primary key (type_id) +); + +alter table director add constraint FK_director foreign key (film_id) + references film (film_id) on delete restrict on update restrict; + +alter table director add constraint FK_director2 foreign key (actor_id) + references actor (actor_id) on delete restrict on update restrict; + +alter table "film language" add constraint "FK_film language" foreign key (film_id) + references film (film_id) on delete restrict on update restrict; + +alter table "film language" add constraint "FK_film language2" foreign key (lgg_id) + references language (lgg_id) on delete restrict on update restrict; + +alter table "film review" add constraint "FK_movie evaluation" foreign key (film_id) + references film (film_id) on delete restrict on update restrict; + +alter table "film types" add constraint "FK_film types" foreign key (film_id) + references film (film_id) on delete restrict on update restrict; + +alter table "film types" add constraint "FK_film types2" foreign key (type_id) + references type (type_id) on delete restrict on update restrict; + +alter table film_region add constraint FK_film_region foreign key (film_id) + references film (film_id) on delete restrict on update restrict; + +alter table film_region add constraint FK_film_region2 foreign key (region_id) + references region (region_id) on delete restrict on update restrict; + +alter table protagonist add constraint FK_protagonist foreign key (film_id) + references film (film_id) on delete restrict on update restrict; + +alter table protagonist add constraint FK_protagonist2 foreign key (actor_id) + references actor (actor_id) on delete restrict on update restrict; + +alter table scriptwriter add constraint FK_scriptwriter foreign key (film_id) + references film (film_id) on delete restrict on update restrict; + +alter table scriptwriter add constraint FK_scriptwriter2 foreign key (actor_id) + references actor (actor_id) on delete restrict on update restrict; + + +``` + -- Gitee