11drop database if exists hrs;
2- create database hrs default charset utf8mb4 collate utf8_bin ;
2+ create database hrs default charset utf8mb4;
33
44use hrs;
55
6- drop table if exists tb_emp;
7- drop table if exists tb_dept;
8-
96create table tb_dept
107(
118dno int not null comment ' 编号' ,
@@ -14,13 +11,11 @@ dloc varchar(20) not null comment '所在地',
1411primary key (dno)
1512);
1613
17- -- alter table tb_dept add constraint pk_dept_dno primary key(dno);
18-
1914insert into tb_dept values
20- (10 , ' 会计部' , ' 北京' ),
21- (20 , ' 研发部' , ' 成都' ),
22- (30 , ' 销售部' , ' 重庆' ),
23- (40 , ' 运维部' , ' 深圳' );
15+ (10 , ' 会计部' , ' 北京' ),
16+ (20 , ' 研发部' , ' 成都' ),
17+ (30 , ' 销售部' , ' 重庆' ),
18+ (40 , ' 运维部' , ' 深圳' );
2419
2520create 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
4237insert 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