Skip to content

Commit 7efa67b

Browse files
committed
更新了数据库部分的文档和代码
1 parent 6a639f0 commit 7efa67b

File tree

7 files changed

+126
-226
lines changed

7 files changed

+126
-226
lines changed

Day36-40/36-38.关系型数据库MySQL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ drop procedure sp_score_by_cid;
10811081
10821082
- 检查约束(check)
10831083
1084-
> 说明:在MySQL数据库中,检查约束并不起作用。
1084+
> **说明**:在MySQL数据库中,检查约束并不起作用。
10851085
10861086
#### 数据一致性
10871087

Day36-40/code/HRS_create_and_init.sql

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
drop database if exists hrs;
2-
create database hrs default charset utf8mb4 collate utf8_bin;
2+
create database hrs default charset utf8mb4;
33

44
use hrs;
55

6-
drop table if exists tb_emp;
7-
drop table if exists tb_dept;
8-
96
create table tb_dept
107
(
118
dno int not null comment '编号',
@@ -14,13 +11,11 @@ dloc varchar(20) not null comment '所在地',
1411
primary key (dno)
1512
);
1613

17-
-- alter table tb_dept add constraint pk_dept_dno primary key(dno);
18-
1914
insert into tb_dept values
20-
(10, '会计部', '北京'),
21-
(20, '研发部', '成都'),
22-
(30, '销售部', '重庆'),
23-
(40, '运维部', '深圳');
15+
(10, '会计部', '北京'),
16+
(20, '研发部', '成都'),
17+
(30, '销售部', '重庆'),
18+
(40, '运维部', '深圳');
2419

2520
create table tb_emp
2621
(
@@ -40,20 +35,20 @@ foreign key (mgr) references tb_emp(eno)
4035
-- alter table tb_emp add constraint fk_emp_dno foreign key (dno) references tb_dept (dno);
4136

4237
insert into tb_emp values
43-
(7800, '张三丰', '总裁', null, 9000, 1200, 20),
44-
(2056, '乔峰', '分析师', 7800, 5000, 1500, 20),
45-
(3088, '李莫愁', '设计师', 2056, 3500, 800, 20),
46-
(3211, '张无忌', '程序员', 2056, 3200, null, 20),
47-
(3233, '丘处机', '程序员', 2056, 3400, null, 20),
48-
(3251, '张翠山', '程序员', 2056, 4000, null, 20),
49-
(5566, '宋远桥', '会计师', 7800, 4000, 1000, 10),
50-
(5234, '郭靖', '出纳', 5566, 2000, null, 10),
51-
(3344, '黄蓉', '销售主管', 7800, 3000, 800, 30),
52-
(1359, '胡一刀', '销售员', 3344, 1800, 200, 30),
53-
(4466, '苗人凤', '销售员', 3344, 2500, null, 30),
54-
(3244, '欧阳锋', '程序员', 3088, 3200, null, 20),
55-
(3577, '杨过', '会计', 5566, 2200, null, 10),
56-
(3588, '朱九真', '会计', 5566, 2500, null, 10);
38+
(7800, '张三丰', '总裁', null, 9000, 1200, 20),
39+
(2056, '乔峰', '分析师', 7800, 5000, 1500, 20),
40+
(3088, '李莫愁', '设计师', 2056, 3500, 800, 20),
41+
(3211, '张无忌', '程序员', 2056, 3200, null, 20),
42+
(3233, '丘处机', '程序员', 2056, 3400, null, 20),
43+
(3251, '张翠山', '程序员', 2056, 4000, null, 20),
44+
(5566, '宋远桥', '会计师', 7800, 4000, 1000, 10),
45+
(5234, '郭靖', '出纳', 5566, 2000, null, 10),
46+
(3344, '黄蓉', '销售主管', 7800, 3000, 800, 30),
47+
(1359, '胡一刀', '销售员', 3344, 1800, 200, 30),
48+
(4466, '苗人凤', '销售员', 3344, 2500, null, 30),
49+
(3244, '欧阳锋', '程序员', 3088, 3200, null, 20),
50+
(3577, '杨过', '会计', 5566, 2200, null, 10),
51+
(3588, '朱九真', '会计', 5566, 2500, null, 10);
5752

5853

5954
-- 查询月薪最高的员工姓名和月薪

0 commit comments

Comments
 (0)