From e1bb5f906e84926ce6d3130c4ba7bb719f8c9788 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=B5=81=E6=B6=9B?= <1841582040@qq.com> Date: Tue, 12 Sep 2023 11:28:21 +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 --- ...06\346\225\260\346\215\256\345\272\223.md" | 0 ...61\346\225\260\346\215\256\345\272\223.md" | 212 ++++++++++++++++++ 2 files changed, 212 insertions(+) rename "57 \351\273\204\346\265\201\346\266\233/20230911 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" => "57 \351\273\204\346\265\201\346\266\233/20230910 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" (100%) create mode 100644 "57 \351\273\204\346\265\201\346\266\233/20230912 \347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230911 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" "b/57 \351\273\204\346\265\201\346\266\233/20230910 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" similarity index 100% rename from "57 \351\273\204\346\265\201\346\266\233/20230911 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" rename to "57 \351\273\204\346\265\201\346\266\233/20230910 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230912 \347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" "b/57 \351\273\204\346\265\201\346\266\233/20230912 \347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" new file mode 100644 index 0000000..018567c --- /dev/null +++ "b/57 \351\273\204\346\265\201\346\266\233/20230912 \347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" @@ -0,0 +1,212 @@ +# 作业 + +### 电影数据库设计 + +影片(编号,影名,上映时间,片长,评分,剧情简介) +类型表(编号,类型) +制片国家地区表(编号,国家) +语言表(编号,语言) +演员表(编号,姓名,年龄,性别) +影评(编号,评价,标题,正文) +片单(编号,片单名,豆列名,推荐语选填) + +![image-20230912112258740](https://s2.loli.net/2023/09/12/jmYw7k6tUfdEA3R.png) + +![image-20230912112346931](https://s2.loli.net/2023/09/12/MhJpcjiPSkfyFm8.png) + +![image-20230912112441142](https://s2.loli.net/2023/09/12/JTlnI2z4brV75St.png) + +``` mysql +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023-09-12 11:37:46 */ +/*==============================================================*/ +create database dy charset utf8; +use dy; + +drop table if exists actor; + +drop table if exists "add"; + +drop table if exists director; + +drop table if exists film; + +drop table if exists filmily; + +drop table if exists filmreview; + +drop table if exists language; + +drop table if exists scriptwriter; + +drop table if exists sheet; + +drop table if exists staff; + +drop table if exists type; + +/*==============================================================*/ +/* Table: actor */ +/*==============================================================*/ +create table actor +( + film_id char(10) not null, + staff_id char(5) not null, + primary key (film_id, staff_id) +); + +/*==============================================================*/ +/* Table: "add" */ +/*==============================================================*/ +create table "add" +( + sheet_id int not null, + film_id char(10) not null, + add_time datetime not null, + primary key (sheet_id, film_id) +); + +/*==============================================================*/ +/* Table: director */ +/*==============================================================*/ +create table director +( + film_id char(10) not null, + staff_id char(5) not null, + primary key (film_id, staff_id) +); + +/*==============================================================*/ +/* Table: film */ +/*==============================================================*/ +create table film +( + film_id char(10) not null, + language_id int not null, + filmily_id int not null, + type_id int not null, + film_name varchar(10) not null, + film_date date not null, + film_time int not null, + film_score char(1) not null, + film_introduce varchar(255) not null, + primary key (film_id) +); + +/*==============================================================*/ +/* Table: filmily */ +/*==============================================================*/ +create table filmily +( + filmily_id int not null auto_increment, + filmily_name varchar(20) not null, + primary key (filmily_id) +); + +/*==============================================================*/ +/* Table: filmreview */ +/*==============================================================*/ +create table filmreview +( + filmreview_id int not null auto_increment, + film_id char(10) not null, + filmreview_evaluate char(1) not null, + filmreview_headline varchar(30) not null, + filmreview_text varchar(255) not null, + primary key (filmreview_id) +); + +/*==============================================================*/ +/* Table: language */ +/*==============================================================*/ +create table language +( + language_id int not null auto_increment, + language_name varchar(15) not null, + primary key (language_id) +); + +/*==============================================================*/ +/* Table: scriptwriter */ +/*==============================================================*/ +create table scriptwriter +( + film_id char(10) not null, + staff_id char(5) not null, + primary key (film_id, staff_id) +); + +/*==============================================================*/ +/* Table: sheet */ +/*==============================================================*/ +create table sheet +( + sheet_id int not null auto_increment, + sheet_name char(10) not null, + sheet_column char(10) not null, + sheet_recommend varchar(255), + primary key (sheet_id) +); + +/*==============================================================*/ +/* Table: staff */ +/*==============================================================*/ +create table staff +( + staff_id char(5) not null, + staff_name char(4) not null, + staff_age char(2) not null, + staff_sex char(1) not null, + primary key (staff_id) +); + +/*==============================================================*/ +/* Table: type */ +/*==============================================================*/ +create table type +( + type_id int not null auto_increment, + type_name char(2) not null, + primary key (type_id) +); + +alter table actor add constraint FK_actor foreign key (film_id) + references film (film_id) on delete restrict on update restrict; + +alter table actor add constraint FK_actor2 foreign key (staff_id) + references staff (staff_id) on delete restrict on update restrict; + +alter table "add" add constraint FK_add foreign key (sheet_id) + references sheet (sheet_id) on delete restrict on update restrict; + +alter table "add" add constraint FK_add2 foreign key (film_id) + references film (film_id) on delete restrict on update restrict; + +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 (staff_id) + references staff (staff_id) on delete restrict on update restrict; + +alter table film add constraint FK_are foreign key (type_id) + references type (type_id) on delete restrict on update restrict; + +alter table film add constraint FK_have foreign key (language_id) + references language (language_id) on delete restrict on update restrict; + +alter table film add constraint FK_make foreign key (filmily_id) + references filmily (filmily_id) on delete restrict on update restrict; + +alter table filmreview add constraint FK_evaluate foreign key (film_id) + references film (film_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 (staff_id) + references staff (staff_id) on delete restrict on update restrict; + + +``` + -- Gitee