From 74c0cd71d52c2f1319e6e89e358ff0e4189aee0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E4=BA=A8=E8=80=80?= <2640788668@qq.com> Date: Wed, 13 Sep 2023 12:42:42 +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 --- ...\225\260\346\215\256\345\272\223.markdown" | 137 ++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 "21 \345\215\242\344\272\250\350\200\200/\347\224\265\345\275\261\347\275\221\347\253\231\346\225\260\346\215\256\345\272\223.markdown" diff --git "a/21 \345\215\242\344\272\250\350\200\200/\347\224\265\345\275\261\347\275\221\347\253\231\346\225\260\346\215\256\345\272\223.markdown" "b/21 \345\215\242\344\272\250\350\200\200/\347\224\265\345\275\261\347\275\221\347\253\231\346\225\260\346\215\256\345\272\223.markdown" new file mode 100644 index 0000000..9ef32cc --- /dev/null +++ "b/21 \345\215\242\344\272\250\350\200\200/\347\224\265\345\275\261\347\275\221\347\253\231\346\225\260\346\215\256\345\272\223.markdown" @@ -0,0 +1,137 @@ +![](https://s2.loli.net/2023/09/13/qR8Qv3GLXerBpS1.png) + +---------------------------------------------------------------------------------------------------------- + +``` mysql +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/13 12:34:05 */ +/*==============================================================*/ + +create database movie_db charset utf8; +use movie_db; + +drop table if exists account; + +drop table if exists film_review; + +drop table if exists member; + +drop table if exists movie; + +drop table if exists scomment; + +drop table if exists type; + +drop table if exists watch; + +/*==============================================================*/ +/* Table: account */ +/*==============================================================*/ +create table account +( + account_id int not null auto_increment, + account_name varchar(20) not null, + primary key (account_id) +); + +/*==============================================================*/ +/* Table: film_review */ +/*==============================================================*/ +create table film_review +( + account_id int, + movie_id int, + film_review_Score decimal(2), + film_review_caption char(10), + film_review_comment char(10), + film_review_datetime datetime +); + +/*==============================================================*/ +/* Table: member */ +/*==============================================================*/ +create table member +( + member_director char(10) not null, + member_screenwriter char(10) not null, + member_actor char(10) not null, + movie_id int, + primary key (member_director, member_screenwriter, member_actor) +); + +/*==============================================================*/ +/* Table: movie */ +/*==============================================================*/ +create table movie +( + movie_id int not null auto_increment, + movie_name varchar(20) not null, + movie_country varchar(10) not null, + movie_language varchar(10) not null, + movie_release_date char(10) not null, + movie_time int not null, + movie_alternate_name varchar(20) not null, + IMDb varchar(20) not null, + movie_introduce text, + primary key (movie_id) +); + +/*==============================================================*/ +/* Table: scomment */ +/*==============================================================*/ +create table scomment +( + scoment_lable varchar(20), + scomment_review text, + scomment_time datetime, + scomment_id int not null auto_increment, + account_id int, + watch_id int, + primary key (scomment_id) +); + +/*==============================================================*/ +/* Table: type */ +/*==============================================================*/ +create table type +( + type_id int not null auto_increment, + movie_id int, + tyoe_name char(2) not null, + primary key (type_id) +); + +/*==============================================================*/ +/* Table: watch */ +/*==============================================================*/ +create table watch +( + watch_id int not null auto_increment, + watch_type char(2) not null, + primary key (watch_id) +); + +alter table film_review add constraint FK_影评 foreign key (movie_id) + references movie (movie_id) on delete restrict on update restrict; + +alter table film_review add constraint FK_评论 foreign key (account_id) + references account (account_id) on delete restrict on update restrict; + +alter table member add constraint FK_制作 foreign key (movie_id) + references movie (movie_id) on delete restrict on update restrict; + +alter table scomment add constraint FK_短评账户 foreign key (account_id) + references account (account_id) on delete restrict on update restrict; + +alter table scomment add constraint FK_观看情况 foreign key (watch_id) + references watch (watch_id) on delete restrict on update restrict; + +alter table type add constraint FK_属于 foreign key (movie_id) + references movie (movie_id) on delete restrict on update restrict; + + +``` + + + -- Gitee