From 85f356868deeb5c9f22970673615ae7cfbfd9d7d Mon Sep 17 00:00:00 2001 From: unknown <2112572495@qq.com> Date: Tue, 12 Sep 2023 21:45:03 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=BA=94=E6=AC=A1=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...76\350\256\241\344\275\234\344\270\232.md" | 0 ...76\350\256\241\344\275\234\344\270\232.md" | 176 ++++++++++++++++++ 2 files changed, 176 insertions(+) rename "39 \351\203\255\346\202\246\350\277\216/202320908 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" => "39 \351\203\255\346\202\246\350\277\216/20230908 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" (100%) create mode 100644 "39 \351\203\255\346\202\246\350\277\216/20230912 \350\261\206\347\223\243\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" diff --git "a/39 \351\203\255\346\202\246\350\277\216/202320908 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" "b/39 \351\203\255\346\202\246\350\277\216/20230908 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" similarity index 100% rename from "39 \351\203\255\346\202\246\350\277\216/202320908 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" rename to "39 \351\203\255\346\202\246\350\277\216/20230908 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230912 \350\261\206\347\223\243\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" "b/39 \351\203\255\346\202\246\350\277\216/20230912 \350\261\206\347\223\243\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" new file mode 100644 index 0000000..436f896 --- /dev/null +++ "b/39 \351\203\255\346\202\246\350\277\216/20230912 \350\261\206\347\223\243\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" @@ -0,0 +1,176 @@ +## 笔记 + +今天丘丘老师让我们写豆瓣电影数据库设计的作业。。。。。 + +## 作业 + +```mysql +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023-09-12 11:35:16 */ +/*==============================================================*/ + +create database + +drop table if exists actor; + +drop table if exists film_comment; + +drop table if exists movie; + +drop table if exists movie_comment; + +drop table if exists scriptwriter; + +drop table if exists sheet; + +drop table if exists short; + +drop table if exists user; + +/*==============================================================*/ +/* Table: actor */ +/*==============================================================*/ +create table actor +( + comment_id int not null, + movie_id int not null, + actor_name varchar(6) not null, + actor_gender char(1) not null, + actor_constellation varchar(3) not null, + actor_birthday date not null, + actor_birthplace varchar(10) not null, + actor_work varchar(10) not null, + actor_alias varchar(10) not null, + actor_family varchar(20) not null, + actor_intro varchar(100) not null, + primary key (comment_id, movie_id) +); + +/*==============================================================*/ +/* Table: film_comment */ +/*==============================================================*/ +create table film_comment +( + comment_id int not null auto_increment, + user_id int not null, + comment_name varchar(20) not null, + comment_title varchar(30) not null, + comment_time datetime not null, + comment_content varchar(500) not null, + comment_evaluate char(2) not null, + primary key (comment_id) +); + +/*==============================================================*/ +/* Table: movie */ +/*==============================================================*/ +create table movie +( + movie_id int not null auto_increment, + movie_name varchar(10) not null, + movie_country varchar(6) not null, + movie_language varchar(6) not null, + movie_date date not null, + movie_time varchar(5) not null, + movie_alias varchar(50) not null, + primary key (movie_id) +); + +/*==============================================================*/ +/* Table: movie_comment */ +/*==============================================================*/ +create table movie_comment +( + comment_id int not null, + movie_id int not null, + director_name char(10), + primary key (comment_id, movie_id) +); + +/*==============================================================*/ +/* Table: scriptwriter */ +/*==============================================================*/ +create table scriptwriter +( + comment_id int not null, + movie_id int not null, + scriptwriter_name varchar(10) not null, + primary key (comment_id, movie_id) +); + +/*==============================================================*/ +/* Table: sheet */ +/*==============================================================*/ +create table sheet +( + sheet_name varchar(10) not null, + sheet_recommend varchar(20), + sheet_id int not null auto_increment, + movie_id int not null, + primary key (sheet_id) +); + +/*==============================================================*/ +/* Table: short */ +/*==============================================================*/ +create table short +( + short_id int not null auto_increment, + movie_id int not null, + user_id int not null, + short_name varchar(20) not null, + short_score int not null, + short_tag varchar(50) not null, + short_content varchar(350) not null, + short_chose char(2) not null, + primary key (short_id) +); + +/*==============================================================*/ +/* Table: user */ +/*==============================================================*/ +create table user +( + user_id int not null auto_increment, + movie_id int not null, + user_name varchar(20) not null, + primary key (user_id) +); + +alter table actor add constraint FK_actor foreign key (comment_id) + references film_comment (comment_id) on delete restrict on update restrict; + +alter table actor add constraint FK_actor2 foreign key (movie_id) + references movie (movie_id) on delete restrict on update restrict; + +alter table film_comment add constraint FK_Relationship_5 foreign key (user_id) + references user (user_id) on delete restrict on update restrict; + +alter table movie_comment add constraint FK_movie_comment foreign key (comment_id) + references film_comment (comment_id) on delete restrict on update restrict; + +alter table movie_comment add constraint FK_movie_comment2 foreign key (movie_id) + references movie (movie_id) on delete restrict on update restrict; + +alter table scriptwriter add constraint FK_scriptwriter foreign key (comment_id) + references film_comment (comment_id) on delete restrict on update restrict; + +alter table scriptwriter add constraint FK_scriptwriter2 foreign key (movie_id) + references movie (movie_id) on delete restrict on update restrict; + +alter table sheet add constraint FK_Relationship_7 foreign key (movie_id) + references movie (movie_id) on delete restrict on update restrict; + +alter table short add constraint FK_Relationship_4 foreign key (movie_id) + references movie (movie_id) on delete restrict on update restrict; + +alter table short add constraint FK_Relationship_6 foreign key (user_id) + references user (user_id) on delete restrict on update restrict; + +alter table user add constraint FK_Relationship_11 foreign key (movie_id) + references movie (movie_id) on delete restrict on update restrict; + + +``` + -- Gitee