diff --git "a/53 \345\276\220\345\205\210\351\221\253/2023.09.11 \345\244\215\344\271\240 .md" "b/53 \345\276\220\345\205\210\351\221\253/2023.09.11 \345\244\215\344\271\240 .md" new file mode 100644 index 0000000000000000000000000000000000000000..eb8e0aab3d6d78595e2376b65fa4fdaf5172cf05 --- /dev/null +++ "b/53 \345\276\220\345\205\210\351\221\253/2023.09.11 \345\244\215\344\271\240 .md" @@ -0,0 +1,87 @@ +2023年9月11日 + +星期一 + +今日学习 + +学会需求分析 学作ER图 + +```sql +CREATE DATABASE dianying CHARSET utf8; +use dianying; +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/12 10:41:02 */ +/*==============================================================*/ + + +drop table if exists Filmcritics; + +drop table if exists film; + +drop table if exists movietype; + +/*==============================================================*/ +/* Table: Filmcritics */ +/*==============================================================*/ +create table Filmcritics +( + ID int, + Username varchar(20) not null, + filmname varchar(20) not null, + Usercomments varchar(20) not null, + moviename varchar(20) not null, + primary key (Username) +); + +INSERT into Filmcritics (ID,Username,filmname,Usercomments,moviename) VALUES +(1,'小李','奥本海默','看之前以为奥本海默,看完才意识到他其','奥本海默'), +(2,'小王','小李飞刀','“有一天,当他们对你的惩罚足够多时','小李飞刀'), +(3,'小猪','奥本海默','又白又男又有点好看,。','奥本海默'), +(4,'朱碧池','过往人生','全片最喜欢的三段 ','过往人生'), +(5,'王总','牛栏山的故事','从没看过一部电影','牛栏山的故事'), +(6,'刘总','星际穿越','三小时听力考试','星际穿越'); + +/*==============================================================*/ +/* Table: film */ +/*==============================================================*/ +create table film +( + filmname varchar(20) not null, + type varchar(6) not null, + Showtime time not null, + Duratioofplayback time not null, + language varchar(2) not null, + directorname varchar(20) not null, + screenwriter varchar(20) not null, + actorname varchar(20) not null, + filmtype varchar(6) not null, + primary key (filmname) +); +INSERT into film (filmname,type,Showtime,Duratioofplayback,language,directorname,screenwriter,actorname,filmtype) VALUES +('奥本海默' ,'英语' ,'02:20:23' ,'02:01:29' ,'英语' ,'奥本海默' ,'奥本海默' ,'奥本海默', '戏剧'), +('牛栏山的故事' ,'汉语', '19:29:15' ,'01:29:30' ,'汉语' ,'大鹏' ,'大鹏' ,'大鹏' ,'喜剧'); + +/*==============================================================*/ +/* Table: movietype */ +/*==============================================================*/ +create table movietype +( + type varchar(6) not null, + primary key (type) +); +INSERT into movietype (type) VALUES +('汉语'), +('英语'), +('韩语'); + + +alter table Filmcritics add constraint FK_comments foreign key (filmname) + references film (filmname) on delete restrict on update restrict; + +alter table film add constraint FK_relationship foreign key (type) + references movietype (type) on delete restrict on update restrict; + + + +```