From bfe236d2253f9dc2c7e63ae99cd35bc3fa4f9641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=A3=E7=91=9E?= <3462909738@qq.com> Date: Tue, 12 Sep 2023 19:14:27 +0800 Subject: [PATCH] =?UTF-8?q?20230912=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20230912\344\275\234\344\270\232.md" | 188 ++++++++++++++++++ 1 file changed, 188 insertions(+) create mode 100644 "44\344\273\243\347\221\236/20230912\344\275\234\344\270\232.md" diff --git "a/44\344\273\243\347\221\236/20230912\344\275\234\344\270\232.md" "b/44\344\273\243\347\221\236/20230912\344\275\234\344\270\232.md" new file mode 100644 index 0000000..2b4c76d --- /dev/null +++ "b/44\344\273\243\347\221\236/20230912\344\275\234\344\270\232.md" @@ -0,0 +1,188 @@ +## 作业 + +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/12 17:16:23 */ +/*==============================================================*/ + + +drop table if exists Relationship_2; + +drop table if exists Relationship_3; + +drop table if exists Relationship_4; + +drop table if exists Relationship_5; + +drop table if exists Relationship_6; + +drop table if exists actor; + +drop table if exists comment; + +drop table if exists employee; + +drop table if exists movie; + +drop table if exists people; + +drop table if exists "short review"; + +/*==============================================================*/ +/* Table: Relationship_2 */ +/*==============================================================*/ +create table Relationship_2 +( + "p-name" char(4) not null, + "m-name" varchar(5) not null, + score decimal(3,1) not null, + primary key ("p-name", "m-name") +); + +/*==============================================================*/ +/* Table: Relationship_3 */ +/*==============================================================*/ +create table Relationship_3 +( + director char(4) not null, + "m-name" varchar(5) not null, + actorname varchar(4) not null, + primary key (director, "m-name") +); + +/*==============================================================*/ +/* Table: Relationship_4 */ +/*==============================================================*/ +create table Relationship_4 +( + "a-name" char(4) not null, + director char(4) not null, + scriptwritername varchar(4) not null, + primary key ("a-name", director) +); + +/*==============================================================*/ +/* Table: Relationship_5 */ +/*==============================================================*/ +create table Relationship_5 +( + "c-id" varchar(11) not null, + "p-name" char(4) not null, + "c-start" varchar(11) not null, + primary key ("c-id", "p-name") +); + +/*==============================================================*/ +/* Table: Relationship_6 */ +/*==============================================================*/ +create table Relationship_6 +( + "s-id" varchar(11) not null, + "p-name" char(4) not null, + "s-startµÈ¼¶" varchar(12) not null, + primary key ("s-id", "p-name") +); + +/*==============================================================*/ +/* Table: actor */ +/*==============================================================*/ +create table actor +( + "a-name" char(4) not null, + "a-sex" char(1) not null, + datetime datetime not null, + Constellation char(3) not null, + birthplace varchar(5) not null, + job char(2) not null, + "Foreign name" varchar(8) not null, + Chinesename char(4) not null, + family varchar(25) not null, + imdbID varchar(15) not null, + primary key ("a-name") +); + +/*==============================================================*/ +/* Table: comment */ +/*==============================================================*/ +create table comment +( + "c-id" varchar(11) not null, + "s-content" varchar(500) not null, + primary key ("c-id") +); + +/*==============================================================*/ +/* Table: employee */ +/*==============================================================*/ +create table employee +( + director char(4) not null, + star varchar(4) not null, + scriptwriter char(4) not null, + primary key (director) +); + +/*==============================================================*/ +/* Table: movie */ +/*==============================================================*/ +create table movie +( + "m-name" varchar(5) not null, + "m-type" varchar(5) not null, + "m-time" int not null, + "release-date" time not null, + "rename" varchar(20) not null, + primary key ("m-name") +); + +/*==============================================================*/ +/* Table: people */ +/*==============================================================*/ +create table people +( + "p-name" char(4) not null, + "p-sex" char(1) not null, + primary key ("p-name") +); + +/*==============================================================*/ +/* Table: "short review" */ +/*==============================================================*/ +create table "short review" +( + "s-id" varchar(11) not null, + "s-content" varchar(500) not null, + primary key ("s-id") +); + +alter table Relationship_2 add constraint FK_Relationship_2 foreign key ("p-name") + references people ("p-name") on delete restrict on update restrict; + +alter table Relationship_2 add constraint FK_Relationship_7 foreign key ("m-name") + references movie ("m-name") on delete restrict on update restrict; + +alter table Relationship_3 add constraint FK_Relationship_3 foreign key (director) + references employee (director) on delete restrict on update restrict; + +alter table Relationship_3 add constraint FK_Relationship_8 foreign key ("m-name") + references movie ("m-name") on delete restrict on update restrict; + +alter table Relationship_4 add constraint FK_Relationship_4 foreign key ("a-name") + references actor ("a-name") on delete restrict on update restrict; + +alter table Relationship_4 add constraint FK_Relationship_9 foreign key (director) + references employee (director) on delete restrict on update restrict; + +alter table Relationship_5 add constraint FK_Relationship_10 foreign key ("p-name") + references people ("p-name") on delete restrict on update restrict; + +alter table Relationship_5 add constraint FK_Relationship_5 foreign key ("c-id") + references comment ("c-id") on delete restrict on update restrict; + +alter table Relationship_6 add constraint FK_Relationship_11 foreign key ("p-name") + references people ("p-name") on delete restrict on update restrict; + +alter table Relationship_6 add constraint FK_Relationship_6 foreign key ("s-id") + references "short review" ("s-id") on delete restrict on update restrict; + + \ No newline at end of file -- Gitee