diff --git "a/06 \351\231\210\345\277\227\344\274\237/20230905.md" "b/06 \351\231\210\345\277\227\344\274\237/20230905.md" new file mode 100644 index 0000000000000000000000000000000000000000..5ca897e99098fd6a02b9cda175cb0f01c9fbe17f --- /dev/null +++ "b/06 \351\231\210\345\277\227\344\274\237/20230905.md" @@ -0,0 +1,31 @@ +## 大二任务 + +1、数据库高级 + +2、JavaScript + +3、MVC框架 + +4、node.js + +5、vue.js 简化开发有ui框架配合 + +6、springboot + +node.js和vue.js属于前端 + +### 技术栈 + +一个项目具体要求用什么技术实现,可以称之为技术选型也就是选方案 + +### 技能树 + +我们所拥有的技能,可以称为技能树 + +### 实训 + +1.Linux 服务器: Nginx,MongoDB + +2.项目中可能实现的技能:中间、鉴别权限 + +3.或小程序 \ No newline at end of file diff --git "a/06 \351\231\210\345\277\227\344\274\237/20230906.md" "b/06 \351\231\210\345\277\227\344\274\237/20230906.md" new file mode 100644 index 0000000000000000000000000000000000000000..96ed90af3c587792cd99ef325416330b260fe12b --- /dev/null +++ "b/06 \351\231\210\345\277\227\344\274\237/20230906.md" @@ -0,0 +1,19 @@ +### 一对一 + +将其中任意一个表中的主键放到另一个表中当外键 + +### 一对多 + +将一的主键放到多的表中当外键 + +### 多对多 + +必须引进第三张表,将前面两个表的主键当作该表的外键 + +## E-R图 有三大要素:实体、属性、关系 + +(1). 实体型:用矩形表示,矩形框内写明实体名 也可以通俗点理解MySQL当中的表 + +(2). 属性:用椭圆形表示,并用无向变将其与相应的实体型连接起来 可以理解成MySQL表当中的字段 + +(3). 联系用菱形表示,菱形框内写明联系名,用无向边分别与有关实体型连接起来,同时在无向边旁标上联系的类型(1:1、1:n 或 m:n)。 类似于外键约束 \ No newline at end of file diff --git "a/06 \351\231\210\345\277\227\344\274\237/20230907.md" "b/06 \351\231\210\345\277\227\344\274\237/20230907.md" new file mode 100644 index 0000000000000000000000000000000000000000..32e67c2027729236a3a46e191efaa2c3e75df3e8 --- /dev/null +++ "b/06 \351\231\210\345\277\227\344\274\237/20230907.md" @@ -0,0 +1,105 @@ + ## 数据库范式 + +### 第一范式 + +要求字段的内容,不可再分割,为的是保证数据的原子性 + +例如:淘宝的地址信息,一个地址可以拆分为很多,省、市、区、街道和详细地址。 + +### 第二范式 + +要求在满足第一范式的基础上,还要满足数据表里的每一条数据记录,都是可唯一标识的,要求非主键字段要完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 + +例如:你的诞生一定离不开你爸妈。 + +举例1:成绩表(学号,课程,成绩)学号和课程合在一起才能构成主键,才能知道成绩多少。 + +举例2:比赛表(球员编号、姓名、年龄、比赛编号、比赛时间、比赛场地、得分) + +姓名和年龄只依赖球员编号 + +比赛时间和比赛场地只依赖比赛编号 + +得分依赖于球员编号和比赛编号 + +所以按照第二范式要分成三个表 + +### 第三范式 + +满足第二范式的前提下,要求非主键属性要直接依赖于主键 + +举例:(学号、姓名、班级、班主任)这个表中,学号是主键,它可以确认姓名、班级、班主任,符合了第二范式,但是在非主键字段中,我们也可以通过班级推导出该班级的班主任,所以它是不符合第三范式的 + +拆分成两个表 + +学号、姓名、班级 + +班级、班主任 + +通过把班级与班主任的映射关系另外做成一张映射表,我们就成功地消除了表中的传递依赖了 + +```java +create database school charset utf8; +use school; +create table college( + co_id int PRIMARY key auto_increment, + co_name varchar(10) UNIQUE key not null +); +create table major( + ma_id int PRIMARY key auto_increment, + ma_name varchar(10) UNIQUE key not null, + co_id int, + foreign key (co_id) references college(co_id) +); +CREATE TABLE clase( + cl_id int PRIMARY key auto_increment, + cl_name varchar(10) UNIQUE key not null, + ma_id int, + foreign key (ma_id) references major(ma_id) +); +CREATE TABLE student( + stu_id int PRIMARY key auto_increment, + stu_name varchar(10) UNIQUE key not null, + stu_sex varchar(4), + cl_id int, + foreign key (cl_id) references clase(cl_id) +); +CREATE TABLE course( + co_id int PRIMARY key auto_increment, + co_name varchar(10) UNIQUE key not null +); +CREATE TABLE score( + sc_id int PRIMARY key auto_increment, + sc_grade double(3,1), + stu_id int, + foreign key (stu_id) references student(stu_id), + co_id int, + foreign key (co_id) references course(co_id) +); +CREATE TABLE room( + ro_id int PRIMARY key auto_increment, + ro_name varchar(10) UNIQUE key not null, + co_id int, + foreign key (co_id) references course(co_id) +); +CREATE TABLE teacher( + tea_id int PRIMARY key auto_increment, + tea_name varchar(10) UNIQUE key not null, + tea_sex varchar(4), + ro_id int, + foreign key (ro_id) references room(ro_id) +); +CREATE TABLE timeroom( + tim_id int PRIMARY key auto_increment, + tim_class VARCHAR(10), + cl_id int, + FOREIGN key (cl_id) REFERENCES clase(cl_id), + co_id int, + FOREIGN key (co_id) REFERENCES course(co_id), + ro_id int, + FOREIGN key (ro_id) REFERENCES room(ro_id), + tea_id int, + FOREIGN key (tea_id) REFERENCES teacher(tea_id) +); +``` + diff --git "a/06 \351\231\210\345\277\227\344\274\237/\346\215\225\350\216\267.PNG" "b/06 \351\231\210\345\277\227\344\274\237/\346\215\225\350\216\267.PNG" new file mode 100644 index 0000000000000000000000000000000000000000..97896ba2e3d6760269933247109daa97095216fa Binary files /dev/null and "b/06 \351\231\210\345\277\227\344\274\237/\346\215\225\350\216\267.PNG" differ