From def609f8201cd30dab86db128c95be333384f103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A8=8A=E5=B0=8F=E9=83=AD?= <2966479092@qq.com> Date: Tue, 12 Sep 2023 23:03:23 +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\345\240\202\347\254\224\350\256\260.md" | 0 ...30\347\272\247\344\275\234\344\270\232.md" | 173 ++++++++++++++++++ 2 files changed, 173 insertions(+) rename "47 \346\250\212\345\260\217\351\203\255/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\211\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" => "47 \346\250\212\345\260\217\351\203\255/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\345\233\233\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" (100%) create mode 100644 "47 \346\250\212\345\260\217\351\203\255/20230912 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\211\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" "b/47 \346\250\212\345\260\217\351\203\255/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\345\233\233\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" similarity index 100% rename from "47 \346\250\212\345\260\217\351\203\255/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\211\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" rename to "47 \346\250\212\345\260\217\351\203\255/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\345\233\233\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230912 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" "b/47 \346\250\212\345\260\217\351\203\255/20230912 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" new file mode 100644 index 0000000..5327fe1 --- /dev/null +++ "b/47 \346\250\212\345\260\217\351\203\255/20230912 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" @@ -0,0 +1,173 @@ +# 作业 + +用豆瓣评分里的电影页面制作一个数据库: + +```mysql +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023-09-12 11:50:37 */ +/*==============================================================*/ + +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; + + +``` \ No newline at end of file -- Gitee