diff --git "a/04 \346\235\216\346\230\216\345\201\245/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/04 \346\235\216\346\230\216\345\201\245/20230910 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" similarity index 96% rename from "04 \346\235\216\346\230\216\345\201\245/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" rename to "04 \346\235\216\346\230\216\345\201\245/20230910 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" index 9de22b606133d8409229974b41e13a0cac2abab5..7c7e920d0c797eb075db847d9f18ff030723dd99 100644 --- "a/04 \346\235\216\346\230\216\345\201\245/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ "b/04 \346\235\216\346\230\216\345\201\245/20230910 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" @@ -8,7 +8,7 @@ #### 第四步:生成DDL(生成数据库代码) -![](E:\所有仓库\数据库高级\database-advanced\04 李明健\图书管理系统E-R图.png) +![](https://s2.loli.net/2023/09/13/LalRAohJB6PNysQ.png) ### 图书管理系统 diff --git "a/04 \346\235\216\346\230\216\345\201\245/20230912 \347\224\265\345\275\261\347\275\221\347\253\231\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" "b/04 \346\235\216\346\230\216\345\201\245/20230912 \347\224\265\345\275\261\347\275\221\347\253\231\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" new file mode 100644 index 0000000000000000000000000000000000000000..556680f253283ae882c642636f31b26fdc8ca81e --- /dev/null +++ "b/04 \346\235\216\346\230\216\345\201\245/20230912 \347\224\265\345\275\261\347\275\221\347\253\231\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" @@ -0,0 +1,171 @@ +### 电影网站数据库设计 + +![](https://s2.loli.net/2023/09/13/maG8pxAFCMfSowJ.png) + +~~~ mysql +create database movie_web charset utf8; +use movie_web; + +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2023/9/13 8:49:46 */ +/*==============================================================*/ + + +drop table if exists actor_info; + +drop table if exists film_review; + +drop table if exists movie_director; + +drop table if exists movie_info; + +drop table if exists movie_protagonist; + +drop table if exists movie_scriptwriter; + +drop table if exists type; + +drop table if exists user; + +drop table if exists website; + +/*==============================================================*/ +/* Table: 演员信息表 */ +/*==============================================================*/ +create table actor_info +( + actor_id int not null auto_increment, + actor_name varchar(10) not null, + sex char(1) not null, + birth_time date not null, + birthplace varchar(10) not null, + occupation varchar(10) not null, + primary key (actor_id) +); + +/*==============================================================*/ +/* Table: 影评 */ +/*==============================================================*/ +create table film_review +( + fr_id int not null auto_increment, + website_id int, + fr_score int, + fr_content varchar(100), + primary key (fr_id) +); + +/*==============================================================*/ +/* Table: 导演 */ +/*==============================================================*/ +create table movie_director +( + movie_id int not null, + actor_id int not null, + primary key (movie_id, actor_id) +); + +/*==============================================================*/ +/* Table: 电影信息表 */ +/*==============================================================*/ +create table movie_info +( + movie_id int not null auto_increment, + website_id int, + movie_name varchar(20) not null, + director_id int not null, + scriptwriter_id int not null, + protagonist_id int not null, + movie_time int not null, + region varchar(10) not null, + primary key (movie_id) +); + +/*==============================================================*/ +/* Table: 主演 */ +/*==============================================================*/ +create table movie_protagonist +( + movie_id int not null, + actor_id int not null, + primary key (movie_id, actor_id) +); + +/*==============================================================*/ +/* Table: 编剧 */ +/*==============================================================*/ +create table movie_scriptwriter +( + movie_id int not null, + actor_id int not null, + primary key (movie_id, actor_id) +); + +/*==============================================================*/ +/* Table: 类型 */ +/*==============================================================*/ +create table type +( + type_id int not null auto_increment, + movie_id int not null, + type_name varchar(5) not null, + primary key (type_id) +); + +/*==============================================================*/ +/* Table: 用户 */ +/*==============================================================*/ +create table user +( + user_id int not null auto_increment, + website_id int, + user_name varchar(10) not null, + primary key (user_id) +); + +/*==============================================================*/ +/* Table: 网站 */ +/*==============================================================*/ +create table website +( + website_id int not null auto_increment, + website_address varchar(50) not null, + movie_id int not null, + primary key (website_id) +); + +alter table film_review add constraint FK_review_website foreign key (website_id) + references website (website_id) on delete restrict on update restrict; + +alter table movie_director add constraint FK_movie_director foreign key (movie_id) + references movie_info (movie_id) on delete restrict on update restrict; + +alter table movie_director add constraint FK_movie_director2 foreign key (actor_id) + references actor_info (actor_id) on delete restrict on update restrict; + +alter table movie_info add constraint FK_movie_website foreign key (website_id) + references website (website_id) on delete restrict on update restrict; + +alter table movie_protagonist add constraint FK_movie_protagonist foreign key (movie_id) + references movie_info (movie_id) on delete restrict on update restrict; + +alter table movie_protagonist add constraint FK_movie_protagonist2 foreign key (actor_id) + references actor_info (actor_id) on delete restrict on update restrict; + +alter table movie_scriptwriter add constraint FK_movie_scriptwriter foreign key (movie_id) + references movie_info (movie_id) on delete restrict on update restrict; + +alter table movie_scriptwriter add constraint FK_movie_scriptwriter2 foreign key (actor_id) + references actor_info (actor_id) on delete restrict on update restrict; + +alter table type add constraint FK_Relationship_7 foreign key (movie_id) + references movie_info (movie_id) on delete restrict on update restrict; + +alter table user add constraint FK_user_website foreign key (website_id) + references website (website_id) on delete restrict on update restrict; + + + +~~~ + diff --git "a/04 \346\235\216\346\230\216\345\201\245/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237E-R\345\233\276.png" "b/04 \346\235\216\346\230\216\345\201\245/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237E-R\345\233\276.png" deleted file mode 100644 index 90e0455d974de71b4798b809e4331261ab55454a..0000000000000000000000000000000000000000 Binary files "a/04 \346\235\216\346\230\216\345\201\245/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237E-R\345\233\276.png" and /dev/null differ