diff --git "a/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" "b/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/crebas.sql" "b/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/crebas.sql" new file mode 100644 index 0000000000000000000000000000000000000000..923826e7bfdf1484ae34973a0c12e13ceaa16e6b --- /dev/null +++ "b/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/crebas.sql" @@ -0,0 +1,80 @@ +/*==============================================================*/ +/* DBMS name: MySQL 5.0 */ +/* Created on: 2024/9/6 21:34:48 */ +/*==============================================================*/ + + +drop table if exists authentication; + +drop table if exists information; + +drop table if exists look; + +drop table if exists movie; + +drop table if exists peoper; + +/*==============================================================*/ +/* Table: authentication */ +/*==============================================================*/ +create table authentication +( + aid int not null, + mid int not null, + aname varchar(10), + primary key (aid) +); + +/*==============================================================*/ +/* Table: information */ +/*==============================================================*/ +create table information +( + iid int not null, + phone int, + primary key (iid) +); + +/*==============================================================*/ +/* Table: look */ +/*==============================================================*/ +create table look +( + mid int not null, + name varchar(10) not null, + primary key (mid, name) +); + +/*==============================================================*/ +/* Table: movie */ +/*==============================================================*/ +create table movie +( + mid int not null, + mname varchar(10), + primary key (mid) +); + +/*==============================================================*/ +/* Table: peoper */ +/*==============================================================*/ +create table peoper +( + name varchar(10) not null, + iid int not null, + sex char(1), + primary key (name) +); + +alter table authentication add constraint FK_has foreign key (mid) + references movie (mid) on delete restrict on update restrict; + +alter table look add constraint FK_look foreign key (mid) + references movie (mid) on delete restrict on update restrict; + +alter table look add constraint FK_look2 foreign key (name) + references peoper (name) on delete restrict on update restrict; + +alter table peoper add constraint FK_belong foreign key (iid) + references information (iid) on delete restrict on update restrict; + diff --git "a/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/\345\261\217\345\271\225\346\210\252\345\233\276 2024-09-06 214150.png" "b/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/\345\261\217\345\271\225\346\210\252\345\233\276 2024-09-06 214150.png" new file mode 100644 index 0000000000000000000000000000000000000000..00793814eae48efe2bb68766c0cd7a838613924b Binary files /dev/null and "b/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/\345\261\217\345\271\225\346\210\252\345\233\276 2024-09-06 214150.png" differ diff --git "a/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/\345\261\217\345\271\225\346\210\252\345\233\276 2024-09-06 214253.png" "b/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/\345\261\217\345\271\225\346\210\252\345\233\276 2024-09-06 214253.png" new file mode 100644 index 0000000000000000000000000000000000000000..557e1eddf8ecca8d426bb8410934a61e6992dc1f Binary files /dev/null and "b/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/\345\261\217\345\271\225\346\210\252\345\233\276 2024-09-06 214253.png" differ diff --git "a/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/\345\261\217\345\271\225\346\210\252\345\233\276 2024-09-06 214302.png" "b/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/\345\261\217\345\271\225\346\210\252\345\233\276 2024-09-06 214302.png" new file mode 100644 index 0000000000000000000000000000000000000000..cb0e75ad4643536772b4daa878769792dbf63d58 Binary files /dev/null and "b/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/\345\261\217\345\271\225\346\210\252\345\233\276 2024-09-06 214302.png" differ diff --git "a/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/\347\254\224\350\256\260.md" "b/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..b5e2ae3608e637b4fa92ccd9386870bb127def67 --- /dev/null +++ "b/\351\231\210\346\226\207\347\220\263/20240903 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241/\351\231\210\346\226\207\347\220\2632344310128/\347\254\224\350\256\260.md" @@ -0,0 +1,30 @@ +# 联系关系(Relationship) + +1. 一对一联系:一个实体的每个实例只关联另一个实体的一个实例 + + 例: + + ​ 一个人对应一张身份证,一张身份证对应一个人 + +2. 一对多联系:一个实体的每个实例可以关联另一个实体的多个实例 + + 例: + + ​ 一个班级拥有多个学生,一个学生只能够属于某个班级 + +3. 多对多联系:两个实体的多个实例之间可以相互关联 + + 例: + + ​ 一个学生可以选修多门课程,一个课程可以被多个学生选修 + + + + +# 三大范式(3NF) + +第一范式(1NF):属性不可分割,即每个属性都是不可分割的原子项。(实体的属性即表中的列) + +第二范式(2NF):满足第一范式;且不存在部分依赖,即非主属性必须完全依赖于主属性。(主属性即主键;完全依赖是针对于联合主键的情况,非主键列不能只依赖于主键的一部分) + +第三范式(3NF):满足第二范式;且不存在传递依赖,即非主属性不能与非主属性之间有依赖关系,非主属性必须直接依赖于主属性,不能间接依赖主属性。(A -> B, B ->C, A -> C) \ No newline at end of file