diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230909 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/50 \345\274\240\350\265\267\347\221\236/20230909 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" index 7060ed7f5034a089ba02e7ec0499f863717b1b2a..0aca77d31ae50ded89009de443ba74f87c29ace7 100644 --- "a/50 \345\274\240\350\265\267\347\221\236/20230909 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ "b/50 \345\274\240\350\265\267\347\221\236/20230909 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" @@ -22,6 +22,10 @@ 6.数据库维护 +通过本次作业我意识到逻辑思维真的很重要 + + + ```java CREATE DATABASE test22 charset utf8; use test22; diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230913 \345\275\261\350\247\206.md" "b/50 \345\274\240\350\265\267\347\221\236/20230913 \345\275\261\350\247\206.md" new file mode 100644 index 0000000000000000000000000000000000000000..7553a6594ef00e2dae9ea44861ed0dda779c3e0a --- /dev/null +++ "b/50 \345\274\240\350\265\267\347\221\236/20230913 \345\275\261\350\247\206.md" @@ -0,0 +1,132 @@ +```mysql +###这次作业让我知道了温故而知新的重要性,以后我要好好复习过去学过的知识,多钻研MySQL,增强自己的逻辑思维能力 +create database test0913 charset utf8; +use test0913; +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/13 9:03:16 */ +/*==============================================================*/ + + +drop table if exists actor; + +drop table if exists country; + +drop table if exists evaluate; + +drop table if exists language; + +drop table if exists movie; + +drop table if exists type; + +drop table if exists user; + +/*==============================================================*/ +/* Table: actor */ +/*==============================================================*/ +create table actor +( + act_id int not null auto_increment, + director varchar(10) not null, + act_name varchar(10) not null, + act_age numeric(8,0) not null, + act_sex varchar(10) not null, + primary key (act_id) +); +insert into actor value (1,'王宝强','王宝强',18,'男'); +/*==============================================================*/ +/* Table: country */ +/*==============================================================*/ +create table country +( + co_id numeric(8,0) not null, + co_name varchar(10) not null, + primary key (co_id) +); +insert into country value (1,'中国'); +/*==============================================================*/ +/* Table: evaluate */ +/*==============================================================*/ +create table evaluate +( + evaluate_id int not null auto_increment, + director varchar(10), + user_id numeric(8,0), + evaluate_title varchar(30) not null, + evaluate_time time not null, + state varchar(10) not null, + primary key (evaluate_id) +); +insert into evaluate value(2,'王宝强',54,'过往人生',2023=1=21,'已上映'); +/*==============================================================*/ +/* Table: language */ +/*==============================================================*/ +create table language +( + lan_id int not null, + lan_name varchar(18) not null, + primary key (���Ա�) +); +insert into `language` value (1,'汉语') ; +/*==============================================================*/ +/* Table: movie */ +/*==============================================================*/ +create table movie +( + director varchar(10) not null, + co_id numeric(8,0), + type numeric(10,0), + ���Ա�� int not null, + `write` varchar(10) not null, + act varchar(10) not null, + movie_time datetime not null, + movie_length date not null, + movie_nname varchar(10) not null, + imdb varchar(15) not null, + primary key (director) +); + +/*==============================================================*/ +/* Table: type */ +/*==============================================================*/ +create table type +( + type numeric(10,0) not null, + type_name varchar(18) not null, + primary key (type) +); + +/*==============================================================*/ +/* Table: user */ +/*==============================================================*/ +create table user +( + user_id numeric(8,0) not null, + user_name varchar(15) not null, + user_sex varchar(10) not null, + user_area varchar(10) not null, + primary key (user_id) +); + +alter table actor add constraint FK_Relationship_4 foreign key (director) + references movie (director) on delete restrict on update restrict; + +alter table evaluate add constraint FK_Relationship_5 foreign key (director) + references movie (director) on delete restrict on update restrict; + +alter table evaluate add constraint FK_Relationship_6 foreign key (user_id) + references user (user_id) on delete restrict on update restrict; + +alter table movie add constraint FK_Relationship_3 foreign key (co_id) + references country (co_id) on delete restrict on update restrict; + +alter table movie add constraint FK_Relationship_7 foreign key (type) + references type (type) on delete restrict on update restrict; + +alter table movie add constraint FK_Relationship_8 foreign key (���Ա��) + references language (���Ա��) on delete restrict on update restrict; + + +``` +