From 4f37fe4a0ac2c0bb6cf72055ba21122f43f77761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=AC=A3=E5=A8=81?= <3434410096@qq.com> Date: Tue, 12 Sep 2023 12:40:58 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=88=E6=AC=A3=E5=A8=81=E7=9A=84=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...56\345\272\223\350\265\204\346\226\231.md" | 218 ++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 "23 \351\231\210\346\254\243\345\250\201/20230911 \347\224\265\345\275\261\346\225\260\346\215\256\345\272\223\350\265\204\346\226\231.md" diff --git "a/23 \351\231\210\346\254\243\345\250\201/20230911 \347\224\265\345\275\261\346\225\260\346\215\256\345\272\223\350\265\204\346\226\231.md" "b/23 \351\231\210\346\254\243\345\250\201/20230911 \347\224\265\345\275\261\346\225\260\346\215\256\345\272\223\350\265\204\346\226\231.md" new file mode 100644 index 0000000..b114b1e --- /dev/null +++ "b/23 \351\231\210\346\254\243\345\250\201/20230911 \347\224\265\345\275\261\346\225\260\346\215\256\345\272\223\350\265\204\346\226\231.md" @@ -0,0 +1,218 @@ +# 心得 + +本节课丘丘给我们布置了一个任务,让我们将电影网页所需要的数据库表做出来,我们小组对于这个任务进行了十分激烈的讨论,下面是我们小组所讨论出来的结果 + +# 作业 + + + +```mysql +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/12 8:08:24 */ +/*==============================================================*/ + +create database movie charset utf8; +use movie; + +drop table if exists cnxy; + +drop table if exists comment; + +drop table if exists film; + +drop table if exists people; + +drop table if exists post; + +drop table if exists type; + +drop table if exists user; + +/*==============================================================*/ +/* Table: cnxy */ +/*==============================================================*/ +create table cnxy +( + us_id int not null, + ty_id int not null, # 想看的电影类型 + cn_tj varchar(11), # 推荐电影 + primary key (us_id, ty_id) + +); + +-- + +-- insert into +/*==============================================================*/ +/* Table: comment */ +/*==============================================================*/ +create table comment +( + fi_id int not null, + us_id int not null, + com_score int not null, + com_content varchar(100) not null, + com_jx varchar(100), + com_hf varchar(11), + primary key (fi_id, us_id) +); + + +/*==============================================================*/ +/* Table: film */ +/*==============================================================*/ +create table film +( + fi_id int not null auto_increment, + ty_id int not null, + fi_name varchar(20) not null, + fi_language varchar(11) not null, + fi_county varchar(11) not null, + fi_date date not null, + fi_time time not null, + fi_con varchar(11) not null, + primary key (fi_id) +); + + +/*==============================================================*/ +/* Table: people */ +/*==============================================================*/ + create table people +( + pe_id int not null auto_increment, + pe_name varchar(11) not null, + pe_sex char(2) not null, + primary key (pe_id) +); + + +/*==============================================================*/ +/* Table: post */ +/*==============================================================*/ +create table post +( + fi_id int not null, + pe_id int not null, + po_career varchar(11) not null, + primary key (fi_id, pe_id) +); + + +/*==============================================================*/ +/* Table: type */ +/*==============================================================*/ +create table type +( + ty_id int not null auto_increment, + ty_name varchar(11) not null, + primary key (ty_id) +); + + + +/*==============================================================*/ +/* Table: user */ +/*==============================================================*/ +create table user +( + us_id int not null auto_increment, + us_name varchar(11) not null, + primary key (us_id) +); + + + + + +alter table cnxy add constraint FK_xz foreign key (us_id) + references user (us_id) on delete restrict on update restrict; + +alter table cnxy add constraint FK_xz2 foreign key (ty_id) + references type (ty_id) on delete restrict on update restrict; + +alter table comment add constraint FK_comment foreign key (fi_id) + references film (fi_id) on delete restrict on update restrict; + +alter table comment add constraint FK_comment2 foreign key (us_id) + references user (us_id) on delete restrict on update restrict; + +alter table film add constraint FK_sy foreign key (ty_id) + references type (ty_id) on delete restrict on update restrict; + +alter table post add constraint FK_post foreign key (fi_id) + references film (fi_id) on delete restrict on update restrict; + +alter table post add constraint FK_post2 foreign key (pe_id) + references people (pe_id) on delete restrict on update restrict; + +insert into user values + (1,'谋杀游戏机'), + (2,'小烨'), + (3,'玄长清'), + (4,'方青'), + (5,'申报记者何书桓'); + +insert into type values + (1,'末日'), + (2,'科幻'), + (3,'修仙'), + (4,'爱情'), + (5,'喜剧'), + (6,'剧情'), + (7,'动作'), + (8,'奇幻'), + (9,'冒险'), + (10,'玄幻'), + (11,'悬疑'), + (12,'同性'), + (13,'家庭'); + +insert into people values + (1,'周星驰','男'), + (2,'吴孟达','男'), + (3,'刘德华','男'), + (4,'张曼玉','女'), + (5,'张敏','女'), + (6,'许光汉','男'), + (7,' 林柏宏','男'), + (8,'王净','女'); + + +insert into film values + (1,5,'武状元苏乞儿','粤语','中国香港','1992-12-17','01:30:00','123'), + (2,5,'济公','粤语','中国香港','1993-07-29','01:29:00','123'), + (3,5,'关于我和鬼变成家人的那件事','汉语普通话 / 闽南语','中国台湾','2023-02-10','02:29:00','123'), + (4,5,'盲探','粤语 / 汉语普通话','中国大陆',' 2013-07-04','02:09:00','123'), + (5,5,'功夫','汉语普通话','中国大陆','2004-12-23','01:40:00','123'); + +insert into post values + (1,1,"演员"), + (1,2,"演员"), + (2,1,"演员"), + (2,5,"演员"), + (3,6,"演员"), + (3,7,"演员"), + (3,8,"演员"), + (4,3,"演员"), + (5,1,"导演and演员"); + +insert into comment VALUES +(1,1,95,"非常好看","",""), +(1,2,97,"喜剧中参杂了悲剧","星爷的电影非常不错","非常值得再看一遍"), +(2,3,90,"星爷的济公太经典了","",""), +(2,1,97,"非常喜欢星爷的济公","",""), +(3,5,96,"这电影最厉害的地方是,最后直男没弯,而是变成了更好的直男","",""), +(3,4,86,"时代在变化,能把gay的话题与神鬼、家庭、警匪、喜剧、传统习俗等元素结合起来看,没有走“为什么世人要瞧不起我们这个群体”这种该死的烂俗的路子,真的是相当大的出众,有在好好讲故事,讲了个非常精彩的故事。","",""), +(4,1,97,"刘德华的这部盲探也是十分经典的电影","",""), +(4,4,90,"剧情有那么些许的看不懂","",""), +(5,1,100,"功夫可以说是星爷排得上前面的特别好看的电影了","",""); + +insert into cnxy values (1,5,'芭比'), + (2,9,'宇宙探索编辑部'), + (3,7,'碟中谍7:致命清算'), + (4,6,'楚门的世界'), + (5,13,'摔跤吧!爸爸'); +``` + -- Gitee