diff --git "a/57 \345\210\230\346\263\260\346\261\237/.~20230912\350\261\206\347\223\243\346\225\260\346\215\256\345\272\223.md" "b/57 \345\210\230\346\263\260\346\261\237/.~20230912\350\261\206\347\223\243\346\225\260\346\215\256\345\272\223.md" new file mode 100644 index 0000000000000000000000000000000000000000..ac97cf553c4bef8761b7192618b5067c6fc75d68 --- /dev/null +++ "b/57 \345\210\230\346\263\260\346\261\237/.~20230912\350\261\206\347\223\243\346\225\260\346\215\256\345\272\223.md" @@ -0,0 +1,127 @@ +![](C:\Users\Administrator\Desktop\微信图片_20230912121827.png) + +```sql + +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/12 10:51:22 */ +/*==============================================================*/ +CREATE DATABASE movie charset utf8; +use movie; + + +drop table if exists area; + +drop table if exists comments; + +drop table if exists movie; + +drop table if exists type; + +drop table if exists user; + +/*==============================================================*/ +/* Table: area */ +/*==============================================================*/ +create table area +( + area_id int not null auto_increment, + area_name char(5), + primary key (area_id) +); + +INSERT into area VALUES +(1,'中国'), +(2,'英国'), +(3,'俄罗斯'), +(4,'美国'); + +/*==============================================================*/ +/* Table: comments */ +/*==============================================================*/ +create table comments +( + movie_id int, + user_id int, + movie_comments char(50) +); + +INSERT into comments VALUES +(1,2,'哈哈哈哈哈哈哈很好看'), +(1,3,'这真的是一部温柔电影,感谢这被善待的前半生,它存在过。连带着你没有来过的20年'); +INSERT into comments VALUES +(3,1,'类型片八股文,情感铺陈欠缺,人物动机匮乏,表演稍显生涩,药神式转折,故事线只开头不挽结,细节完成度低'); + +/*==============================================================*/ +/* Table: movie */ +/*==============================================================*/ +create table movie +( + movie_id int not null auto_increment, + type_id int, + area_id int, + movie_name char(10), + director char(5), + actor char(50), + language char(5), + begintime date, + movie_time char(5), + score decimal(2,1), + number int, + primary key (movie_id) +); + +INSERT into movie VALUES +(1,5,4,'过往人生','席琳·宋',' 格蕾塔·李 / 刘台午 / 约翰·马加罗 / 文胜雅 / 尹智慧 /','英语/韩语','2023-01-21','106分钟',7.7,15161); +INSERT into movie VALUES +(2,1,4,'巨齿鲨2','本·维特利',' 杰森·斯坦森 / 吴京 / 蔡书雅 / 克利夫·柯蒂斯 /','英语','2023-08-04','119分钟',5.2,57134), +(3,1,1,'八角笼中','王宝强',' 王宝强 / 陈永胜 / 史彭元 / 王迅 / 张祎曈 /','中文','2023-07-06','117分钟',7.4,118071); + +/*==============================================================*/ +/* Table: type */ +/*==============================================================*/ +create table type +( + type_id int not null auto_increment, + type_name char(5), + primary key (type_id) +); +INSERT into type VALUES +(1,'动作'), +(2,'悬疑'), +(3,'恐怖'), +(4,'喜剧'), +(5,'爱情'); + + +/*==============================================================*/ +/* Table: user */ +/*==============================================================*/ +create table user +( + user_id int not null auto_increment, + user_name char(10), + user_ip char(5), + primary key (user_id) +); +INSERT into user VALUES +(1,'哈哈哈哈施层层','福建'), +(2,'哈哈哈哈溜江江','贵州'), +(3,'哈哈哈哈洪洋洋','福建'); + +alter table comments add constraint FK_Relationship_3 foreign key (movie_id) + references movie (movie_id) on delete restrict on update restrict; + +alter table comments add constraint FK_Relationship_4 foreign key (user_id) + references user (user_id) on delete restrict on update restrict; + +alter table movie add constraint FK_Relationship_1 foreign key (type_id) + references type (type_id) on delete restrict on update restrict; + +alter table movie add constraint FK_Relationship_2 foreign key (area_id) + references area (area_id) on delete restrict on update restrict; + + + +``` + diff --git "a/57 \345\210\230\346\263\260\346\261\237/20230912\350\261\206\347\223\243.md" "b/57 \345\210\230\346\263\260\346\261\237/20230912\350\261\206\347\223\243.md" new file mode 100644 index 0000000000000000000000000000000000000000..f4efd0f808e10d7faa1878c8aa44d09ec52d9f57 --- /dev/null +++ "b/57 \345\210\230\346\263\260\346\261\237/20230912\350\261\206\347\223\243.md" @@ -0,0 +1,127 @@ +![](C:\Users\Administrator\Desktop\微信图片_20230912121827.png) + +```sql + +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/12 10:51:22 */ +/*==============================================================*/ +CREATE DATABASE movie charset utf8; +use movie; + + +drop table if exists area; + +drop table if exists comments; + +drop table if exists movie; + +drop table if exists type; + +drop table if exists user; + +/*==============================================================*/ +/* Table: area */ +/*==============================================================*/ +create table area +( + area_id int not null auto_increment, + area_name char(5), + primary key (area_id) +); + +INSERT into area VALUES +(1,'中国'), +(2,'英国'), +(3,'俄罗斯'), +(4,'美国'); + +/*==============================================================*/ +/* Table: comments */ +/*==============================================================*/ +create table comments +( + movie_id int, + user_id int, + movie_comments char(50) +); + +INSERT into comments VALUES +(1,2,'哈哈哈哈哈哈哈很好看'), +(1,3,'这真的是一部温柔电影,感谢这被善待的前半生,它存在过。连带着你没有来过的20年'); +INSERT into comments VALUES +(3,1,'类型片八股文,情感铺陈欠缺,人物动机匮乏,表演稍显生涩,药神式转折,故事线只开头不挽结,细节完成度低'); + +/*==============================================================*/ +/* Table: movie */ +/*==============================================================*/ +create table movie +( + movie_id int not null auto_increment, + type_id int, + area_id int, + movie_name char(10), + director char(5), + actor char(50), + language char(5), + begintime date, + movie_time char(5), + score decimal(2,1), + number int, + primary key (movie_id) +); + +INSERT into movie VALUES +(1,5,4,'过往人生','席琳·宋',' 格蕾塔·李 / 刘台午 / 约翰·马加罗 / 文胜雅 / 尹智慧 /','英语/韩语','2023-01-21','106分钟',7.7,15161); +INSERT into movie VALUES +(2,1,4,'巨齿鲨2','本·维特利',' 杰森·斯坦森 / 吴京 / 蔡书雅 / 克利夫·柯蒂斯 /','英语','2023-08-04','119分钟',5.2,57134), +(3,1,1,'八角笼中','王宝强',' 王宝强 / 陈永胜 / 史彭元 / 王迅 / 张祎曈 /','中文','2023-07-06','117分钟',7.4,118071); + +/*==============================================================*/ +/* Table: type */ +/*==============================================================*/ +create table type +( + type_id int not null auto_increment, + type_name char(5), + primary key (type_id) +); +INSERT into type VALUES +(1,'动作'), +(2,'悬疑'), +(3,'恐怖'), +(4,'喜剧'), +(5,'爱情'); + + +/*==============================================================*/ +/* Table: user */ +/*==============================================================*/ +create table user +( + user_id int not null auto_increment, + user_name char(10), + user_ip char(5), + primary key (user_id) +); +INSERT into user VALUES +(1,'哈哈哈哈施层层','福建'), +(2,'哈哈哈哈溜江江','贵州'), +(3,'哈哈哈哈洪洋洋','福建'); + +alter table comments add constraint FK_Relationship_3 foreign key (movie_id) + references movie (movie_id) on delete restrict on update restrict; + +alter table comments add constraint FK_Relationship_4 foreign key (user_id) + references user (user_id) on delete restrict on update restrict; + +alter table movie add constraint FK_Relationship_1 foreign key (type_id) + references type (type_id) on delete restrict on update restrict; + +alter table movie add constraint FK_Relationship_2 foreign key (area_id) + references area (area_id) on delete restrict on update restrict ; + + + +``` +