From 8519c639ffb12765e0af5962fe622bdc9f9ce1a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E5=AF=8C?= <2744975513@qq.com> Date: Tue, 12 Sep 2023 19:08:13 +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 --- ...61\346\225\260\346\215\256\345\272\223.md" | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 "17 \345\221\250\345\257\214/\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" diff --git "a/17 \345\221\250\345\257\214/\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" "b/17 \345\221\250\345\257\214/\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" new file mode 100644 index 0000000..69ed06b --- /dev/null +++ "b/17 \345\221\250\345\257\214/\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" @@ -0,0 +1,180 @@ +![屏幕截图 2023-09-12 184900](https://s2.loli.net/2023/09/12/BzADMuUEZWYQvl9.png) + + + +~~~MYSQL +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/12 18:42:47 */ +/*==============================================================*/ + + +drop table if exists actor; + +drop table if exists country; + +drop table if exists director; + +drop table if exists evaluate; + +drop table if exists info; + +drop table if exists language; + +drop table if exists movie; + +drop table if exists scriptwriter; + +drop table if exists type; + +drop table if exists user; + +/*==============================================================*/ +/* Table: actor */ +/*==============================================================*/ +create table actor +( + info_id int not null, + mov_id int not null, + primary key (info_id, mov_id) +); + +/*==============================================================*/ +/* Table: country */ +/*==============================================================*/ +create table country +( + cou_id int not null auto_increment, + cou_name char(10) not null, + primary key (cou_id) +); + +/*==============================================================*/ +/* Table: director */ +/*==============================================================*/ +create table director +( + info_id int not null, + mov_id int not null, + primary key (info_id, mov_id) +); + +/*==============================================================*/ +/* Table: evaluate */ +/*==============================================================*/ +create table evaluate +( + user_id int not null, + mov_id int not null, + headline char(50) not null, + content varchar(255) not null, + primary key (user_id, mov_id) +); + +/*==============================================================*/ +/* Table: info */ +/*==============================================================*/ +create table info +( + info_id int not null auto_increment, + info_name char(10) not null, + info_sex char(1) not null, + constellation char(3) not null, + date_of_birth datetime not null, + birthplace char(10) not null, + occupation char(5) not null, + primary key (info_id) +); + +/*==============================================================*/ +/* Table: language */ +/*==============================================================*/ +create table language +( + lang_id int not null auto_increment, + lang_name char(10) not null, + primary key (lang_id) +); + +/*==============================================================*/ +/* Table: movie */ +/*==============================================================*/ +create table movie +( + mov_id int not null auto_increment, + type_id int not null, + cou_id int not null, + lang_id int not null, + mov_name char(10) not null, + "be on_time" datetime not null, + min int not null, + mov_brief varchar(255) not null, + primary key (mov_id) +); + +/*==============================================================*/ +/* Table: scriptwriter */ +/*==============================================================*/ +create table scriptwriter +( + info_id int not null, + mov_id int not null, + primary key (info_id, mov_id) +); + +/*==============================================================*/ +/* Table: type */ +/*==============================================================*/ +create table type +( + type_id int not null auto_increment, + type_name char(10) not null, + primary key (type_id) +); + +/*==============================================================*/ +/* Table: user */ +/*==============================================================*/ +create table user +( + user_id int not null auto_increment, + user_name char(20) not null, + primary key (user_id) +); + +alter table actor add constraint FK_Relationship_12 foreign key (mov_id) + references movie (mov_id) on delete restrict on update restrict; + +alter table actor add constraint FK_Relationship_8 foreign key (info_id) + references info (info_id) on delete restrict on update restrict; + +alter table director add constraint FK_Relationship_13 foreign key (mov_id) + references movie (mov_id) on delete restrict on update restrict; + +alter table director add constraint FK_Relationship_9 foreign key (info_id) + references info (info_id) on delete restrict on update restrict; + +alter table evaluate add constraint FK_Relationship_11 foreign key (mov_id) + references movie (mov_id) on delete restrict on update restrict; + +alter table evaluate add constraint FK_Relationship_7 foreign key (user_id) + references user (user_id) on delete restrict on update restrict; + +alter table movie add constraint FK_Relationship_4 foreign key (type_id) + references type (type_id) on delete restrict on update restrict; + +alter table movie add constraint FK_Relationship_5 foreign key (cou_id) + references country (cou_id) on delete restrict on update restrict; + +alter table movie add constraint FK_Relationship_6 foreign key (lang_id) + references language (lang_id) on delete restrict on update restrict; + +alter table scriptwriter add constraint FK_Relationship_10 foreign key (info_id) + references info (info_id) on delete restrict on update restrict; + +alter table scriptwriter add constraint FK_Relationship_14 foreign key (mov_id) + references movie (mov_id) on delete restrict on update restrict; + + +~~~ + -- Gitee