diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230905.md" "b/01 \351\231\210\346\242\246\346\242\246/20230905.md" deleted file mode 100644 index 1c7ffd72b99e6b68342a61e74d9fea5e24dfcc28..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230905.md" +++ /dev/null @@ -1,9 +0,0 @@ -2023年09月1日 - -今天是开学的第一天,和往年一样进行了课前演讲。 - -课前演讲结束后,老师大概和我们讲解了这学期要学什么,给我了一点方向,至少不会像之前那样子迷茫。 - -自己给了自己一点小计划,想弄个csdn,因为之前也找学姐了解过这方面。然后计划学习一下阿里云服务器。 - -这大概就是今天的收获吧 \ No newline at end of file diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230906.md" "b/01 \351\231\210\346\242\246\346\242\246/20230906.md" deleted file mode 100644 index 44a07e9df8d69e62d1df27f8b27eea8064167f8d..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230906.md" +++ /dev/null @@ -1,103 +0,0 @@ -2023年09月06日 - - - -现在专业课好多,每天都有,已经开始感觉到以后的学习压力了 - -今天学了数据库的设计 - - - -#### 表与表的关系 - -##### 1.多对多 - -这种情况就要引入第三张表(关系表),将前面两个表的主键当作该表的外键 - -##### 2.一对多 - -将一的主键放到多的当外键 - -##### 3.一对一 - -其中任一表中的主键放到另外一个表当外键 - - - -### 数据库设计分析 - -**需求分析**,**概念结构设计**,**逻辑结构设计**,**物理结构设计**,**数据库实施**,**数据库运行和维护**。 - -## 作业 - -```mysql --- 删除数据库 -drop database if exists rj ; - --- 创建 软件工程学院 数据库 -create database if not exists rj charset utf8 ; --- 选中数据库 -use rj ; - --- 创建老师表 -create table teacher ( - - t_id int primary key auto_increment, -- 老师编号 - t_name varchar(10) , -- 老师名字 - t_post varchar(10) -- 岗位 - -); - --- 创建班级表 -create table class ( - - c_id int primary key auto_increment , -- 班级编号 - c_direction varchar(10) , -- 方向 - c_name varchar(10) , -- 班级名称 - t_id int , -- 外键 辅导员编号 - foreign key (t_id) references teacher(t_id) -- 连接老师表 - -); - --- 创建课程表 -create table syllabus ( - - s_count varchar(10) , -- 节次 - s_id int primary key auto_increment , -- 课程编号 - s_time time , -- 时间 - s_week varchar(10) , -- 星期 - s_name varchar(10) , -- 课程名称 - t_id int , -- 外键 课任老师编号 - c_id int , -- 外键 班级编号 - foreign key (t_id) references teacher(t_id) , -- 连接老师表 - foreign key (c_id) references class(c_id) -- 连接班级表 - -); - --- 创建学生表 -create table student ( - - s_id int primary key auto_increment , -- 学生编号 - s_name varchar(10) , -- 学生姓名 - c_id int , -- 外键 班级编号 - foreign key (c_id) references class(c_id) -- 连接班级表 - -); - --- 创建成绩表 -create table score ( - - s_num int , -- 分数 - st_id int , -- 外键 学生编号 - sy_id int , -- 外键 课程编号 - foreign key (sy_id) references syllabus(s_id) ,-- 连接课程表 - foreign key (st_id) references student(s_id) -- 连接学生表 - -); -``` - - - -# 感想 - -今天上课还是犯困了,每次听课都会想睡觉,不知道为什么,那个表格设计还是没有完全设计好,感觉哪里出问题,后来问老师才发现问题的出错地方,今天还是很有收获的!作业有点烦,因为那个软件要钱,我自己下载一个晚上弄不好 \ No newline at end of file diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230906\344\275\234\344\270\232.vsdx" "b/01 \351\231\210\346\242\246\346\242\246/20230906\344\275\234\344\270\232.vsdx" deleted file mode 100644 index 62c535a7a8d5ab9cac5a0e069b05290d2aebe70f..0000000000000000000000000000000000000000 Binary files "a/01 \351\231\210\346\242\246\346\242\246/20230906\344\275\234\344\270\232.vsdx" and /dev/null differ diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230907.md" "b/01 \351\231\210\346\242\246\346\242\246/20230907.md" deleted file mode 100644 index 21f61b61f7151741e3c93a148555ceffc7fc8c12..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230907.md" +++ /dev/null @@ -1,103 +0,0 @@ -2023年09月07日 - -#### 数据库的范式 - -##### 1.第一范式:要求字段的内容不可再分割,为的是保证数据的原子性 - -##### 2.第二范式:要求在满足第一范式的基础上,要求非主键字段完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 - -##### 3.第三范式:满足第二范式的前提上,要求非主键属性要直接依赖于主键 - -```mysql -drop database if exists mxdx; -create database mxdx charset utf8; -use mxdx; - -#院系表 -create table college ( -col_id int primary key auto_increment, -col_name char(10) -); - -#专业表 -create table major ( -m_id int primary key auto_increment, -m_name char(10), -col_id int, -foreign key (col_id) references college (col_id) -); - -#班级表 -create table clazz ( -cl_id int primary key auto_increment, -cl_name char(10), -m_id int, -foreign key (m_id) references major (m_id) -); - -#课程信息 -create table course ( -cou_id int primary key auto_increment, -cou_name char(10) -); - - - -#教室 -create table classroom ( -cr_id int primary key auto_increment, -cr_address char(10) -); - - - -#课程表 -create table timetable ( -tt_id int primary key auto_increment, -tt_time char(3), -tt_order char(3), -cou_id int, -foreign key (cou_id) references course (cou_id), -cr_id int, -foreign key (cr_id) references classroom (cr_id) -); - - -#教师表 -create table teacher ( -te_id int primary key auto_increment, -te_name char(3), -te_sex char(1), -cou_id int, -foreign key (cou_id) references course (cou_id) -); - - - -#学生表 -create table student ( -st_id int primary key auto_increment, -st_name char(10), -st_sex char(1), -cl_id int, -foreign key (cl_id) references clazz (cl_id), -tt_id int, -foreign key (tt_id) references timetable (tt_id) -); - - -#选修表 -create table choose( -ch_id int primary key auto_increment, -ch_socre char(3), -tt_id int, -foreign key (tt_id) references timetable (tt_id), -st_id int, -foreign key (st_id) references student (st_id) -); - - - - -``` - diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230908.md" "b/01 \351\231\210\346\242\246\346\242\246/20230908.md" deleted file mode 100644 index 4b47fa1d99950cb9763c380a5b97f5767a39e8c0..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230908.md" +++ /dev/null @@ -1,242 +0,0 @@ -2023 年09月08日 - - 今天上课进行了本周的专业课复习 - -主要复习了三个方面 - -### 1.表与表的关系 - -1.一对一 - -将任一表的主键放入另外一个表当外键 - -2.一对多 - -将一的主键当多的外键 - -3.多对多 - -引入第三张表(关系表)将前面两个表的主键当该表的外键 - -### 2.E_R图(实体关系图) - -实体、属性、关系 - -### 3.范式 - -1.第一范式 - -要求字段的内容,不可再分割,为的是保证数据的原子性 - -2.第二范式 - -要求在第一范式的基础上,要求非主键字段属性完全依赖主键(非主键要依赖整个联合主键)而不是只依赖部分(联合主键) - -完全函数依赖 -定义:设X,Y是关系R的两个属性集合,X’是X的真子集,存在X→Y,但对每一个X’都有X’!→Y,则称Y完全函数依赖于X。 - -比如通过学号->姓名 - -部分函数依赖 -定义:设X,Y是关系R的两个属性集合,存在X→Y,若X’是X的真子集,存在X’→Y,则称Y部分函数依赖于X。 - -需要借用知乎刘慰教师的例子用一下,自己也理解了很长时间。 - -![img](https://img-blog.csdnimg.cn/img_convert/0099ee963b99b2a08f78af70bbcab552.png) - -https://img-blog.csdnimg.cn/img_convert/0099ee963b99b2a08f78af70bbcab552.png - -码用(学号+课程),为什么要加课程呢?因为不同课程成绩是通过学号查不出来的。 - -不过用(学号+课程)当作码是不是有些问题? - -(学号+课程)->姓名,但是学号->姓名 - -(学号+课程)->系名,但是学号->系名 - -(学号+课程)->系主任,但是学号->系主任 - -这个就是部分依赖,说实话我看定义一脸懵逼。 - -要是上面那张表符合第二范式。需要将表拆分为两张表。 - -一张是 学号、课程、分数表 - -另外一张是 学号、姓名、系名、系主任表 - -![img](https://img-blog.csdnimg.cn/img_convert/94a4230520a842bf949eb83d490ec24e.png) - -https://img-blog.csdnimg.cn/img_convert/94a4230520a842bf949eb83d490ec24e.png - -3.第三范式 - -满足第二范式的前提下,要求非主键属性要直接依赖于主键(不能出现传递性依赖,被依赖可单独弄个表) - -传递函数依赖 -设X,Y,Z是关系R中互不相同的属性集合,存在X→Y(Y !→X),Y→Z,则称Z传递函数依赖于X。 - -https://blog.csdn.net/rl529014/article/details/48391465 - -采用这位大佬的例子 -在关系R(学号 ,宿舍, 费用)中,(学号)->(宿舍),宿舍!=学号,(宿舍)->(费用),费用!=宿舍,所以符合传递函数的要求 - -第三范式 -满足第二范式的条件下不存在传递函数依赖。 - -要满足第三范式,在分成两张表的时候第二张表还是有问题? - -学号->系名,系名->系主任 传递依赖。 - -需要将系名和系主任另外新建一张表。 - -![img](https://img-blog.csdnimg.cn/img_convert/dfe5d8f3dcb41d4e1c7eebd4ee8f3335.png) - -https://img-blog.csdnimg.cn/img_convert/dfe5d8f3dcb41d4e1c7eebd4ee8f3335.png - -总结: -第一范式:简单说 列不能再分 - -第二范式:简单说 建立在第一范式基础上,消除部分依赖 - -第三范式:简单说 建立在第二范式基础上,消除传递依赖。 -———————————————— -版权声明:本文为CSDN博主「萝卜头LJW」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 -原文链接:https://blog.csdn.net/u013164931/article/details/79692402 - - - -### 概念模型 - -常见单词意思: - -seral 自增 - -Charachers 字符串 - -cocle字段名英文 - -integer 数字 - -variable char 可变长度 - -decimal 小数 - -float 整数 - -number 数字 - -#### 概念模型 - -##### 1.创建概念模型(类似ER图) - -以用户为角度(CDM) - -记得弄关系,关系表可以不弄,会自动生成 - -##### 2.转换成逻辑模型 - -以计算机的角度(LDM) - -在CDM中点tools,下一步点GLDM - -##### 3.转换物理模型 - -以数据库角度(PDM) - -tools,下一步点GPDM - -##### 4.生成DDL - -database+generation(记得改成对应mysql的版本,否则报错) - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-11 20:34:27 */ -/*==============================================================*/ - - -drop table if exists Relationship_1; - -drop table if exists book; - -drop table if exists librarian; - -drop table if exists library; - -drop table if exists reader; - -/*==============================================================*/ -/* Table: Relationship_1 */ -/*==============================================================*/ -create table Relationship_1 -( - re_id int not null, - book_id int not null, - primary key (re_id, book_id) -); - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - book_id int not null, - li_id int not null, - book_name char(15) not null, - press char(10) not null, - time national varchar(15) not null, - primary key (book_id) -); - -/*==============================================================*/ -/* Table: librarian */ -/*==============================================================*/ -create table librarian -( - id int not null, - li_id int not null, - name char(5) not null, - primary key (id) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - li_id int not null, - id int not null, - li_name char(10) not null, - li_address char(10) not null, - primary key (li_id) -); - -/*==============================================================*/ -/* Table: reader */ -/*==============================================================*/ -create table reader -( - re_id int not null, - re_name char(4) not null, - primary key (re_id) -); - -alter table Relationship_1 add constraint FK_Relationship_1 foreign key (re_id) - references reader (re_id) on delete restrict on update restrict; - -alter table Relationship_1 add constraint FK_Relationship_2 foreign key (book_id) - references book (book_id) on delete restrict on update restrict; - -alter table book add constraint FK_Relationship_5 foreign key (li_id) - references library (li_id) on delete restrict on update restrict; - -alter table librarian add constraint FK_Relationship_3 foreign key (li_id) - references library (li_id) on delete restrict on update restrict; - -alter table library add constraint FK_Relationship_4 foreign key (id) - references librarian (id) on delete restrict on update restrict; - - -``` - diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230912.md" "b/01 \351\231\210\346\242\246\346\242\246/20230912.md" deleted file mode 100644 index b18b4f36515a1f491c95a2468d0696392fa834b9..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230912.md" +++ /dev/null @@ -1,239 +0,0 @@ -2023年09月12日 - -今天复习了一下图书管理系统,但是犯困还是没听见怎么写,然后老师布置了新作业,不知道是不是老师给了一点思路,感觉这个图很快就做出来了。至少不会像图书管理那个一样一塌糊涂,但是还有很多不会的。比如表格关联,数据如何插入,希望明天可以解决今天的问题,那个艺人的表格真的不会插!!!! - - - -后续: - -研究出来了,但是太多了 ,想睡觉,来不及写,这是思路 - -### ![6302eb986871b6640c8e7e7d62277a6](C:\Users\陈梦梦\AppData\Local\Temp\WeChat Files\6302eb986871b6640c8e7e7d62277a6.jpg) - -er图 - -![er](E:\高级数据库\04\er.png) - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 11:26:47 */ -/*==============================================================*/ -drop database if exists zy; -create database zy charset utf8; -use zy; - -drop table if exists artist; - -drop table if exists country; - -drop table if exists director; - -drop table if exists language; - -drop table if exists movie; - -drop table if exists protagonist; - -drop table if exists rating; - -drop table if exists review; - -drop table if exists scriptwriter; - -drop table if exists type; - -drop table if exists user; - -/*==============================================================*/ -/* Table: artist */ -/*==============================================================*/ -create table artist -( - art_id int not null, - movie_id int not null, - pro_id int not null, - dir_id int not null, - scr_id int not null, - art_name char(10) not null, - art_work char(10) not null, - primary key (art_id) -); - -/*==============================================================*/ -/* Table: country */ -/*==============================================================*/ -create table country -( - cou_id int not null, - movie_id int not null, - cou_name char(20) not null, - primary key (cou_id) -); - - -insert into country values -(1,1,"美国,韩国"); -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - dir_id int not null, - dir_name char(10) not null, - primary key (dir_id) -); - -insert into director values -(1,'席琳·宋'); -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table `language` -( - lang_id int not null, - movie_id int not null, - lang char(10) not null, - primary key (lang_id) -); -insert into `language` values -(1,1,'英语,韩语'); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_id int not null, - movie_name char(20) not null, - release_date date not null, - length int not null, - primary key (movie_id) -); -insert into movie values -(1,'过往人生','2023-01-21',160); - -/*==============================================================*/ -/* Table: protagonist */ -/*==============================================================*/ -create table protagonist -( - pro_id int not null, - pro_name char(10) not null, - primary key (pro_id) -); -insert into protagonist values -(1,' 格蕾塔·李'), -(2,' 刘台午'), -(3,' 约翰·马加罗'), -(4,'文胜雅'), -(5,'尹智慧 '); - -/*==============================================================*/ -/* Table: rating */ -/*==============================================================*/ -create table rating -( - movie_id int not null, - user_id int not null, - user_rating char(10) not null, - primary key (movie_id, user_id) -); - -insert into rating values -(1,1,'90分'); - -/*==============================================================*/ -/* Table: review */ -/*==============================================================*/ -create table review -( - re_id int not null, - user_id int not null, - movie_id int not null, - re_name char(20) not null, - re_text char(100) not null, - re_appraise int not null, - primary key (re_id) -); -insert into review values -(1,1,1,'男人总是留守过去,女人总是面向未来','在柏林的映后采访中,一个记者提了这样一个问题:为什么在这部电影里,男人总是承受、感性、饱含爱的那一方,而女人则冷静、选择活在当下、坚持走在自己的路上',5); - - -/*==============================================================*/ -/* Table: scriptwriter */ -/*==============================================================*/ -create table scriptwriter -( - scr_id int not null, - scr_name char(10) not null, - primary key (scr_id) -); -insert into scriptwriter values -(1,'席琳·宋'); - - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null, - movie_id int not null, - type_name char(10) not null, - primary key (type_id) -); -insert into type values -(1,1,'剧情 / 爱情'); - - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table `user` -( - user_id int not null, - user_name char(10) not null, - primary key (user_id) -); -insert into `user` values -(1,'陈梦梦'); - -alter table artist add constraint FK_Relationship_4 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table artist add constraint FK_Relationship_5 foreign key (pro_id) - references protagonist (pro_id) on delete restrict on update restrict; - -alter table artist add constraint FK_Relationship_6 foreign key (dir_id) - references director (dir_id) on delete restrict on update restrict; - -alter table artist add constraint FK_Relationship_7 foreign key (scr_id) - references scriptwriter (scr_id) on delete restrict on update restrict; - -alter table country add constraint FK_Relationship_3 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table language add constraint FK_Relationship_2 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table rating add constraint FK_Relationship_11 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table rating add constraint FK_Relationship_12 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table review add constraint FK_Relationship_10 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table review add constraint FK_Relationship_9 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table type add constraint FK_Relationship_1 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - - -~~~ - - - diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230913.md" "b/01 \351\231\210\346\242\246\346\242\246/20230913.md" deleted file mode 100644 index e7045755c13bc406661e73d2edfd660cf90a8dd9..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230913.md" +++ /dev/null @@ -1,129 +0,0 @@ -```mysql -drop table if exists docter; - -drop table if exists drug; - -drop table if exists nurse; - -drop table if exists patient; - -drop table if exists shoushushi_id; - -drop table if exists sickbed; - -drop table if exists sickperson; - -/*==============================================================*/ -/* Table: docter */ -/*==============================================================*/ -create table docter -( - docter_id int not null auto_increment, - docter_name varchar(10) not null, - docter_sex char(1) not null, - docter_degree varchar(15) not null, - docter_tel numeric(8,0) not null, - primary key (docter_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - drug_name varchar(20) not null, - drug_medication varchar(50) not null, - drug_price int not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: nurse */ -/*==============================================================*/ -create table nurse -( - nurse_id int not null auto_increment, - nurse_name varchar(10) not null, - primary key (nurse_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(10) not null, - patient_address varchar(20) not null, - patient_tel numeric(20,0) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: shoushushi_id */ -/*==============================================================*/ -create table shoushushi_id -( - shoushushi_id_id int not null auto_increment, - sickbed_id int not null, - sic_sickperson_id int not null, - patient_id int not null, - docter_id int not null, - shoushushi_idname varchar(10) not null, - sickperson_id int not null, - primary key (shoushushi_id_id) -); - -/*==============================================================*/ -/* Table: sickbed */ -/*==============================================================*/ -create table sickbed -( - sickbed_id int not null, - nurse_id int not null, - primary key (sickbed_id) -); - -/*==============================================================*/ -/* Table: sickperson */ -/*==============================================================*/ -create table sickperson -( - sickperson_id int not null, - patient_id int not null, - docter_id int not null, - drug_id int not null, - shoushushi_id_id int not null, - allergy char(1) not null, - sympton varchar(50) not null, - primary key (sickperson_id, patient_id, docter_id) -); - -alter table shoushushi_id add constraint FK_inhospital foreign key (sickbed_id) - references sickbed (sickbed_id) on delete restrict on update restrict; - -alter table shoushushi_id add constraint FK_operation foreign key (sic_sickperson_id, patient_id, docter_id) - references sickperson (sickperson_id, patient_id, docter_id) on delete restrict on update restrict; - -alter table sickbed add constraint FK_nursing foreign key (nurse_id) - references nurse (nurse_id) on delete restrict on update restrict; - -alter table sickperson add constraint FK_booking foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table sickperson add constraint FK_operation2 foreign key (shoushushi_id_id) - references shoushushi_id (shoushushi_id_id) on delete restrict on update restrict; - -alter table sickperson add constraint FK_see foreign key (docter_id) - references docter (docter_id) on delete restrict on update restrict; - -alter table sickperson add constraint FK_takedrug foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -``` - -``` -![2e14b2d498fac95d7a02c2cd3d014a9.png](https://s2.loli.net/2023/09/14/PoB1vy2ENardRG5.png) -``` - diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230914.md" "b/01 \351\231\210\346\242\246\346\242\246/20230914.md" deleted file mode 100644 index d1d1c0fa1c0b594908a7dc7fb454aaea5575de9e..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230914.md" +++ /dev/null @@ -1,132 +0,0 @@ -```mysql -drop table if exists docter; - -drop table if exists drug; - -drop table if exists nurse; - -drop table if exists patient; - -drop table if exists shoushushi_id; - -drop table if exists sickbed; - -drop table if exists sickperson; - -/*==============================================================*/ -/* Table: docter */ -/*==============================================================*/ -create table docter -( - docter_id int not null auto_increment, - docter_name varchar(10) not null, - docter_sex char(1) not null, - docter_degree varchar(15) not null, - docter_tel numeric(8,0) not null, - primary key (docter_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - drug_name varchar(20) not null, - drug_medication varchar(50) not null, - drug_price int not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: nurse */ -/*==============================================================*/ -create table nurse -( - nurse_id int not null auto_increment, - nurse_name varchar(10) not null, - primary key (nurse_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(10) not null, - patient_address varchar(20) not null, - patient_tel numeric(20,0) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: shoushushi_id */ -/*==============================================================*/ -create table shoushushi_id -( - shoushushi_id_id int not null auto_increment, - sickbed_id int not null, - sic_sickperson_id int not null, - patient_id int not null, - docter_id int not null, - shoushushi_idname varchar(10) not null, - sickperson_id int not null, - primary key (shoushushi_id_id) -); - -/*==============================================================*/ -/* Table: sickbed */ -/*==============================================================*/ -create table sickbed -( - sickbed_id int not null, - nurse_id int not null, - primary key (sickbed_id) -); - -/*==============================================================*/ -/* Table: sickperson */ -/*==============================================================*/ -create table sickperson -( - sickperson_id int not null, - patient_id int not null, - docter_id int not null, - drug_id int not null, - shoushushi_id_id int not null, - allergy char(1) not null, - sympton varchar(50) not null, - primary key (sickperson_id, patient_id, docter_id) -); - -alter table shoushushi_id add constraint FK_inhospital foreign key (sickbed_id) - references sickbed (sickbed_id) on delete restrict on update restrict; - -alter table shoushushi_id add constraint FK_operation foreign key (sic_sickperson_id, patient_id, docter_id) - references sickperson (sickperson_id, patient_id, docter_id) on delete restrict on update restrict; - -alter table sickbed add constraint FK_nursing foreign key (nurse_id) - references nurse (nurse_id) on delete restrict on update restrict; - -alter table sickperson add constraint FK_booking foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table sickperson add constraint FK_operation2 foreign key (shoushushi_id_id) - references shoushushi_id (shoushushi_id_id) on delete restrict on update restrict; - -alter table sickperson add constraint FK_see foreign key (docter_id) - references docter (docter_id) on delete restrict on update restrict; - -alter table sickperson add constraint FK_takedrug foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -``` - -``` - -``` - -``` -https://s2.loli.net/2023/09/14/PoB1vy2ENardRG5.png -``` diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230917.md" "b/01 \351\231\210\346\242\246\346\242\246/20230917.md" deleted file mode 100644 index ffdb558d3c93c5707e0a7538f7c5b578ebc9375f..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230917.md" +++ /dev/null @@ -1,147 +0,0 @@ -建表代码 - -```mysql - -DROP DATABASe if EXISTS store ; -CREATE DATABASE store charset utf8; -use store; - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for buymessage --- ---------------------------- -DROP TABLE IF EXISTS `buymessage`; -CREATE TABLE `buymessage` ( - `buymessage_id` int NOT NULL AUTO_INCREMENT, - `customer_id` int NOT NULL, - `salesman_id` int NOT NULL, - `car_id` int NULL DEFAULT NULL, - `buymessage_time` date NOT NULL, - PRIMARY KEY (`buymessage_id`) USING BTREE, - INDEX `FK_Relationship_1`(`customer_id` ASC) USING BTREE, - INDEX `FK_Relationship_2`(`salesman_id` ASC) USING BTREE, - INDEX `FK_Relationship_3`(`car_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`customer_id`) REFERENCES `customer` (`customer_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`salesman_id`) REFERENCES `salesman` (`salesman_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`car_id`) REFERENCES `car` (`car_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of buymessage --- ---------------------------- -INSERT INTO `buymessage` VALUES (1, 2, 3, 5, '2023-06-12'); -INSERT INTO `buymessage` VALUES (2, 2, 4, 4, '2023-09-12'); -INSERT INTO `buymessage` VALUES (3, 1, 3, 4, '2023-09-14'); -INSERT INTO `buymessage` VALUES (4, 4, 1, 3, '2023-09-14'); -INSERT INTO `buymessage` VALUES (5, 5, 3, 1, '2023-09-26'); - --- ---------------------------- --- Table structure for car --- ---------------------------- -DROP TABLE IF EXISTS `car`; -CREATE TABLE `car` ( - `car_id` int NOT NULL AUTO_INCREMENT, - `car_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `car_color` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `car_suv` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `car_oil` char(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `car_price` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`car_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of car --- ---------------------------- -INSERT INTO `car` VALUES (1, '奥迪Q7', '蓝色', '中大型SUV', '汽油', '52.61'); -INSERT INTO `car` VALUES (2, '埃尔法', '白色', '中大型MPV', '油电', '83.9'); -INSERT INTO `car` VALUES (3, '迈巴赫S级\r\n', '蓝色', '大型车', '轻混', '682.79'); -INSERT INTO `car` VALUES (4, '红旗H5', '银白色', '中型车', '油电', '19.58'); -INSERT INTO `car` VALUES (5, '宝马5系', '蓝色', '中大型车', '汽油', '45.55'); - --- ---------------------------- --- Table structure for customer --- ---------------------------- -DROP TABLE IF EXISTS `customer`; -CREATE TABLE `customer` ( - `customer_id` int NOT NULL AUTO_INCREMENT, - `customer_name` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `customer_sex` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `customer_tel` int NOT NULL, - `customer_address` varchar(30) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`customer_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of customer --- ---------------------------- -INSERT INTO `customer` VALUES (1, '陈梦梦', '女', 10086, '地球村'); -INSERT INTO `customer` VALUES (2, '郭悦迎', '女', 123456, '深圳湾'); -INSERT INTO `customer` VALUES (3, '马云', '男', 147852, '汤臣一品'); -INSERT INTO `customer` VALUES (4, '小敏', '女', 369852, '闽西职业技术学院'); -INSERT INTO `customer` VALUES (5, '张一鸣', '男', 987456, '龙岩'); - --- ---------------------------- --- Table structure for salesman --- ---------------------------- -DROP TABLE IF EXISTS `salesman`; -CREATE TABLE `salesman` ( - `salesman_id` int NOT NULL AUTO_INCREMENT, - `salesman_name` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `salesman_sex` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `salesman_tel` int NOT NULL, - PRIMARY KEY (`salesman_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of salesman --- ---------------------------- -INSERT INTO `salesman` VALUES (1, '陈销售', '男', 456285); -INSERT INTO `salesman` VALUES (2, '李销售', '女', 132644); -INSERT INTO `salesman` VALUES (3, '张销售', '男', 365415); -INSERT INTO `salesman` VALUES (4, '王销售', '男', 147258); - -SET FOREIGN_KEY_CHECKS = 1; - -``` - - - -查询代码 - -```mysql --- 1.查询特定陈销售的销售记录 -select * from salesman; -select * from buymessage; -select * from salesman s left join buymessage b on s.salesman_id=b.salesman_id where b.salesman_id=(select salesman_id from salesman where salesman_name='陈销售'); - - -- 2.查找销售记录中销售价格最高的汽车 - select * from car; - select * from buymessage; - select car_name 汽车名称,car_price 汽车价格 from buymessage b left join car c on b.car_id=c.car_id order by car_price desc limit 0,1; - - -- 3.统计张销售的销售总额 - select * from buymessage; - select salesman_id from salesman where salesman_name='张销售'; - select sum(car_price) from buymessage b left join car c on b.car_id=c.car_id where salesman_id=(select salesman_id from salesman where salesman_name='张销售'); - - - -- 4.根据客户信息查询其购买过的汽车 - select * from customer; - select customer_name 顾客姓名,car_name 购买过的车子 from customer c left join buymessage b on c.customer_id=b.buymessage_id left join car a on b.car_id=a.car_id; - - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - - select c.car_name 车辆名称,count(c.car_name) 销售数量,sum(car_price) 总销售额 from buymessage b left join car c on b.car_id=c.car_id group by c.car_name,car_price; - - -- 6.检索特定日期范围内的销售了哪些汽车 - select * from buymessage a left join car c on a.salesman_id = c.car_id where buymessage_time between 2023-09-10 and 2023-09-15; - -- 7.查找某车型的销售历史。 - select * from car c left join buymessage b on c.car_id=b.car_id where car_name='奥迪Q7'; - -- 8.统计每个销售员的销售数量 - select salesman_name 销售员,count(salesman_name)销售数量 from salesman s left join buymessage a on s.salesman_id = a.salesman_id group by salesman_name; - -``` - -https://sm.ms/image/b7pCQUkIO9N41zX \ No newline at end of file diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230920.md" "b/01 \351\231\210\346\242\246\346\242\246/20230920.md" deleted file mode 100644 index 824e6838ce4f050f18582eb38a0f840b14ce2d6f..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230920.md" +++ /dev/null @@ -1,715 +0,0 @@ -```mysql -#第03章_基本的select语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -select - sum( salary * 12 ) 工资总和 -from - employees; - -#select sum(salary*12) as 工资总和 from employees; - -#理解2:计算12月的基本工资和奖金 - -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - -select - ifnull( commission_pct, 0 )* salary * 12 奖金, - salary * 12 基本工资 -from - employees; - -# 2.查询employees表中去除重复的job_id以后的数据 - -#去除重复 distinct - -select distinct - job_id -from - employees; - -# 3.查询工资大于12000的员工姓名和工资 - -select - last_name 姓名, - salary 工资 -from - employees -where - salary > 12000; -# 4.查询员工号为176的员工的姓名和部门号 - -select - first_name 姓名, - department_id 部门号 -from - employees -where - employee_id = 176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - -desc departments; -select - * -from - departments; -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -select - last_name 姓名, - salary 工资 -from - employees -where - salary < 5000 or salary > 12000; - - #2.选择在20或50号部门工作的员工姓名和部门号 - -select - last_name, - department_id -from - employees -where - department_id in ( 20, 50 ); -select - last_name, - department_id -from - employees -where - department_id = 20 - or department_id = 50; - - # 3.选择公司中没有管理者的员工姓名及job_id - -select - last_name, - job_id -from - employees -where - manager_id is null; - - # 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select last_name, salary, commission_pct -from employees -where commission_pct is not null; - -;# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select - last_name -from - employees -where - last_name like '__尔%'; - - # 6.选择姓名中有 特 字和 尔 字的员工姓名 - -select - * -from - employees -where - last_name like '%特%' - or last_name like '%尔%'; - - # 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select - * -from - employees -where - first_name like '%尔'; - - # 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select - first_name, - job_id -from - employees -where - department_id between 80 - and 100; - - # 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select - last_name, - salary, - manager_id -from - employees -where - manager_id in ( 100, 101, 110 ); - - #第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - -select - first_name, - department_id, - salary * 12 nianxin -from - employees -order by - nianxin desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select - first_name, - salary -from - employees -where - salary < 8000 or salary > 17000 -order by - salary desc - limit 20,20; - - #3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -select - * -from - employees -where - email like '%e%' -order by - length( email ) desc, - department_id asc; - - # 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - -select - last_name, - e.department_id, - d.department_name -from - employees e - left join departments d on e.department_id = d.department_id; - - # 2.查询90号部门员工的job_id和90号部门的location_id - -select - * -from - locations; -select - * -from - employees; -select - * -from - departments; -select - job_id, - location_id -from - employees e - join locations l on e.department_id = department_id -where - department_id = 90; - - # 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select - last_name, - department_name, - d.location_id, - city -from - employees e, - departments d, - locations l -where - e.department_id = d.department_id - and d.location_id = l.location_id - and commission_pct is not null; -select - last_name, - d.department_name, - l.location_id, - city -from - employees e - left join departments d on e.department_id = d.department_id - left join locations l on d.location_id = l.location_id -where - commission_pct is not null; - - # 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select - last_name, - job_id, - e.department_id, - city -from - employees e, - departments d, - locations l -where - e.department_id = d.department_id - and city = '多伦多'; - - #sql92语法(自然连接): - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -select - department_name, - street_address, - last_name, - salary -from - employees e, - departments d, - locations l -where - e.department_id = d.department_id - and d.location_id = l.location_id; - - # 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select - e.first_name, - e.department_id, - e.last_name, - e.employee_id -from - employees e - inner join employees s on e.employee_id = s.employee_id; - - # 7.查询哪些部门没有员工 -select - department_name -from - departments d - left join employees e on e.department_id = e.department_id -where - d.manager_id is null; - - # 8. 查询哪个城市没有部门 -select - city -from - locations l - left join departments d on l.location_id = d.location_id -where - d.location_id is null; - - # 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -select - * -from - employees e - left join departments d on e.department_id = d.department_id -where - d.department_name = '销售部' - or d.department_name = '信息技术部'; - - # 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - -select - max( salary ), - min( salary ), - avg( salary ), - sum( salary ) -from - employees; - - #3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - -select - job_id, - max( salary ), - min( salary ), - avg( salary ), - sum( salary ) -from - employees -group by - job_id; - - #4.选择各个job_id的员工人数 -select - job_id, - count(*) -from - employees -group by - job_id; - - # 5.查询员工最高工资和最低工资的差距 -select - ( - max( salary )- min( salary )) 最高工资和最低工资的差距 -from - employees; - - # 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - -select - min( salary ) -from - employees -group by - manager_id -having - min( salary ) > 6000 - and manager_id is not null; -select - manager_id, - min( salary ) -from - employees -where - manager_id is not null -group by - manager_id -having - min( salary ) > 6000; - - # 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 -select - department_name, - location_id, - count( employee_id ), - avg( salary ) -from - employees e - right join departments d on e.department_id = d.department_id -group by - department_name, - location_id -order by - avg( salary ) desc; - - # 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - -# 第09章_子查询的课后练习 - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - -select - last_name, - salary -from - employees -where - department_id = ( select department_id from employees where last_name = '兹洛特基' ) - - - #2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - - -select - employee_id, - last_name, - salary -from - employees -where - salary > ( select avg( salary ) from employees ) - - - #3.选择工资大于所有job_id = 'sa_man'的员工的工资的员工的last_name, job_id, salary - -select - last_name, - salary -from - employees -where - salary > ( select max( salary ) from employees where job_id = 'sa_man' ) - - #4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 -select - employee_id, - last_name -from - employees -where - department_id = any ( select distinct department_id from employees where last_name like '%u%' ) - - #5.查询部门的location_id为1700的部门的工作的员工的员工号 -select - employee_id -from - employees -where - department_id in ( select department_id from departments where location_id = 1700 ) - - #6.查询管理者是 金 的员工姓名和工资 -select - last_name, - salary -from - employees -where - manager_id in ( select employee_id from employees where last_name = '金' ) #7.查询工资最低的员工信息: last_name, salary -select - last_name, - salary -from - employees -where - salary = ( select min( salary ) from employees );#8.查询平均工资最低的部门信息 -#方式1: -# 部门最低工资=全司最低 -select - * -from - departments -where - department_id = ( - select - department_id - from - employees - group by - department_id - having - avg( salary ) = ( select min( dept_avgsal ) from ( select avg( salary ) dept_avgsal from employees group by department_id ) avg_sal ) - ); - - #方式2: -# 部门平均<= 公司所有平均 -select - d.*,( - select - avg( salary ) - from - employees - where - department_id = d.department_id - ) -from - departments d -where - department_id = ( - select - department_id - from - employees - group by - department_id - having - avg( salary ) = ( select min( dept_avgsal ) from ( select avg( salary ) dept_avgsal from employees group by department_id ) avg_sal ) - ); - - #9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -select - d.*,( - select - avg( salary ) - from - employees - where - department_id = d.department_id - ) -from - departments d -where - department_id = ( - select - department_id - from - employees - group by - department_id - having - avg( salary ) = ( select min( dept_avgsal ) from ( select avg( salary ) dept_avgsal from employees group by department_id ) avg_sal ) - ); - - #10.查询平均工资最高的 job 信息 -#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 -select - * -from - jobs -where - job_id = ( - select - job_id - from - employees - group by - job_id - having - avg( salary ) = ( select max( avg_sal ) from ( select avg( salary ) avg_sal from employees group by job_id ) job_avgsal ) - ); - - #11.查询平均工资高于公司平均工资的部门有哪些? -select - department_id -from - employees -where - department_id is not null -group by - department_id -having - avg( salary ) > ( select avg( salary ) from employees ); - - #12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 -#方式2:子查询 -#员工编号=(管理员编号有哪些) -select - employee_id, - last_name, - salary -from - employees -where - employee_id in ( select distinct manager_id from employees ); - - #13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? -#方式: -select - min( salary ) -from - employees -where - department_id = ( - select - department_id - from - employees - group by - department_id - having - max( salary ) = ( select min( dept_maxsal ) from ( select max( salary ) dept_maxsal from employees group by department_id ) max_sal ) - ); - - #14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -select - employee_id, - last_name, - department_id, - email, - salary -from - employees -where - employee_id in ( - select distinct - manager_id - from - employees - where - department_id = ( - select - department_id - from - employees - group by - department_id - having - avg( salary ) = ( select max( avg_sal ) from ( select avg( salary ) avg_sal from employees group by department_id ) dept_sal ) - ) - ); - #方式二 -select - employee_id, - last_name, - department_id, - email, - salary -from - employees -where - employee_id in ( - select distinct - manager_id - from - employees - where - department_id = ( select department_id from employees e group by department_id having avg( salary )>= all ( select avg( salary ) from employees group by department_id ) ) - ); - #15. 查询部门的部门号,其中不包括job_id是"st_clerk"的部门号 -#方式1: - -#16. 选择所有没有管理者的员工的last_name - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'de haan' - -#方式1: -#方式2: - - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) -#方式1:使用相关子查询 -#方式2:在from中声明子查询 - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -select - department_name -from - employees e, - departments d -where - d.department_id = e.department_id -group by - department_name -having - count( 1 )> 5;#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) -select - country_id, - count( 1 ) -from - ( - select distinct - country_id, - d.department_id - from - departments d, - employees e, - locations l - where - d.manager_id = e.manager_id - and l.location_id = d.location_id - ) a -group by - country_id; -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` - diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230921.md" "b/01 \351\231\210\346\242\246\346\242\246/20230921.md" deleted file mode 100644 index e61c154aa5f5bbe03faf40193834f8afd90c98f4..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230921.md" +++ /dev/null @@ -1,201 +0,0 @@ -## RBAC(基于角色的权限访问控制)——主流设计模型(套路) - - - -#### 用于权限之间产生角色 - -1.数据库能存什么? - -业务数据表:用户商品 - -功能资源表:菜单信息表,页面代码表 - -2.权限的使用情景 - -网页不一样: - -1.菜单权限 - -2.按钮权限 - -3.数据权限 - -4.操作权限 - -RBAC角色是核心,设计权限表 - -sku预习 - -sku(属性) 可由多个属性组成 - -spu 一组属性的组合 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : 1 - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : zy - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 20/09/2023 17:41:43 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for power --- ---------------------------- -DROP TABLE IF EXISTS `power`; -CREATE TABLE `power` ( - `power_id` int NOT NULL AUTO_INCREMENT, - `power_name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`power_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of power --- ---------------------------- -INSERT INTO `power` VALUES (1, '医生信息'); -INSERT INTO `power` VALUES (2, '护士信息'); -INSERT INTO `power` VALUES (3, '病人信息'); -INSERT INTO `power` VALUES (4, '新增病人'); -INSERT INTO `power` VALUES (5, '保洁信息'); -INSERT INTO `power` VALUES (6, '新增医生'); -INSERT INTO `power` VALUES (7, '新增护士'); -INSERT INTO `power` VALUES (8, '新增保洁'); -INSERT INTO `power` VALUES (9, '医生工资'); -INSERT INTO `power` VALUES (10, '护士工资'); -INSERT INTO `power` VALUES (11, '保洁工资'); - --- ---------------------------- --- Table structure for role --- ---------------------------- -DROP TABLE IF EXISTS `role`; -CREATE TABLE `role` ( - `role_id` int NOT NULL AUTO_INCREMENT, - `role_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`role_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role --- ---------------------------- -INSERT INTO `role` VALUES (1, '院长'); -INSERT INTO `role` VALUES (2, '医生'); -INSERT INTO `role` VALUES (3, '护士'); -INSERT INTO `role` VALUES (4, '病人'); -INSERT INTO `role` VALUES (5, '保洁'); - --- ---------------------------- --- Table structure for role_power --- ---------------------------- -DROP TABLE IF EXISTS `role_power`; -CREATE TABLE `role_power` ( - `power_id` int NOT NULL, - `role_id` int NOT NULL, - PRIMARY KEY (`power_id`, `role_id`) USING BTREE, - INDEX `FK_role_power2`(`role_id` ASC) USING BTREE, - CONSTRAINT `FK_role_power` FOREIGN KEY (`power_id`) REFERENCES `power` (`power_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_role_power2` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role_power --- ---------------------------- -INSERT INTO `role_power` VALUES (1, 1); -INSERT INTO `role_power` VALUES (2, 1); -INSERT INTO `role_power` VALUES (3, 1); -INSERT INTO `role_power` VALUES (4, 1); -INSERT INTO `role_power` VALUES (5, 1); -INSERT INTO `role_power` VALUES (6, 1); -INSERT INTO `role_power` VALUES (7, 1); -INSERT INTO `role_power` VALUES (8, 1); -INSERT INTO `role_power` VALUES (9, 1); -INSERT INTO `role_power` VALUES (10, 1); -INSERT INTO `role_power` VALUES (11, 1); -INSERT INTO `role_power` VALUES (1, 2); -INSERT INTO `role_power` VALUES (2, 2); -INSERT INTO `role_power` VALUES (3, 2); -INSERT INTO `role_power` VALUES (4, 2); -INSERT INTO `role_power` VALUES (2, 3); -INSERT INTO `role_power` VALUES (3, 3); -INSERT INTO `role_power` VALUES (3, 4); -INSERT INTO `role_power` VALUES (5, 5); - --- ---------------------------- --- Table structure for user --- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `user_id` int NOT NULL AUTO_INCREMENT, - `user_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `user_pwd` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`user_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '张三', '123456'); -INSERT INTO `user` VALUES (2, '李四', '666666'); -INSERT INTO `user` VALUES (3, '王五', '888888'); -INSERT INTO `user` VALUES (4, '樊小郭', '147258'); -INSERT INTO `user` VALUES (5, '郭悦迎', '333333'); -INSERT INTO `user` VALUES (6, '陈梦梦', '111111'); -INSERT INTO `user` VALUES (7, '画大饼', '777777'); - --- ---------------------------- --- Table structure for user_role --- ---------------------------- -DROP TABLE IF EXISTS `user_role`; -CREATE TABLE `user_role` ( - `role_id` int NOT NULL, - `user_id` int NOT NULL, - PRIMARY KEY (`role_id`, `user_id`) USING BTREE, - INDEX `FK_user_role2`(`user_id` ASC) USING BTREE, - CONSTRAINT `FK_user_role` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_user_role2` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user_role --- ---------------------------- -INSERT INTO `user_role` VALUES (4, 1); -INSERT INTO `user_role` VALUES (4, 2); -INSERT INTO `user_role` VALUES (4, 3); -INSERT INTO `user_role` VALUES (2, 4); -INSERT INTO `user_role` VALUES (2, 5); -INSERT INTO `user_role` VALUES (1, 6); -INSERT INTO `user_role` VALUES (5, 7); - -SET FOREIGN_KEY_CHECKS = 1; - -``` - -```mysql -select -user_name,role_name,power_name -from - `user` u, - user_role ur, - role r, - role_power rp, - power p - where - u.user_id=ur.user_id - and - ur.role_id=r.role_id - and - r.role_id=rp.role_id - and - rp.power_id=p.power_id; -``` - diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230921sku.md" "b/01 \351\231\210\346\242\246\346\242\246/20230921sku.md" deleted file mode 100644 index 6185d5be372e973558a09aa15a50dfbfc7f74c92..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230921sku.md" +++ /dev/null @@ -1,105 +0,0 @@ -建表 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:41:07 */ -/*==============================================================*/ -create database zy charset utf8; -use zy; - -drop table if exists attributes; - -drop table if exists attributes_value; - -drop table if exists relation; - -drop table if exists sku; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_id int not null auto_increment, - attributes_name varchar(50) not null, - primary key (attributes_id) -); - -/*==============================================================*/ -/* Table: attributes_value */ -/*==============================================================*/ -create table attributes_value -( - value_id int not null auto_increment, - value_content varchar(50) not null, - primary key (value_id) -); - -/*==============================================================*/ -/* Table: relation */ -/*==============================================================*/ -create table relation -( - relation_id int not null auto_increment, - sku_id int, - attributes_id int, - value_id int, - primary key (relation_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price decimal(9,2) not null, - sku_kc int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_content varchar(50) not null, - primary key (spu_id) -); - -alter table relation add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table relation add constraint FK_Relationship_3 foreign key (attributes_id) - references attributes (attributes_id) on delete restrict on update restrict; - -alter table relation add constraint FK_Relationship_4 foreign key (value_id) - references attributes_value (value_id) on delete restrict on update restrict; - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - - -``` - - - -查询 - -```mysql -select * from spu,sku,relation re,attributes_value av,attributes ab where spu.spu_id=sku.spu_id and sku.sku_id=re.sku_id and re.value_id=av.value_id and re.attributes_id=ab.attributes_id; - - -select a.sku_id,a.sku_name,a.sku_price,a.value_content,b.value_content from -(select sku.sku_id,sku_name,sku_price,value_content from spu,sku,relation re,attributes_value av,attributes ab where spu.spu_id=sku.spu_id and sku.sku_id=re.sku_id and re.value_id=av.value_id and re.attributes_id=ab.attributes_id and value_content='白色') as a, - -(select sku.sku_id,sku_name,sku_price,value_content from spu,sku,relation re,attributes_value av,attributes ab where spu.spu_id=sku.spu_id and sku.sku_id=re.sku_id and re.value_id=av.value_id and re.attributes_id=ab.attributes_id and value_content='512g') as b where a.sku_id=b.sku_id; -``` - diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230924.md" "b/01 \351\231\210\346\242\246\346\242\246/20230924.md" deleted file mode 100644 index 474021e2b7e8b510dd05f9cc656a148d819d0067..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230924.md" +++ /dev/null @@ -1,256 +0,0 @@ -## 数据库高级部分预习 - -## 一、函数 - -### 1.创建自定义函数 - - (1)DELIMITER $$ 定义结束符。MySQL默认的结束符是分号,但是函数体中可能用到分号。为了避免冲突,需要另外定义结束符。 - - (2)DROP FUNCTION IF EXISTS genPerson$$ 如果函数genPerson已经存在了,就删除掉。 - - (3)CREATE FUNCTION 创建函数genPerson,函数的参数是name,返回值是varchar(50)。 - - (4)函数体放在BEGIN 与 END之间。 - - (5)DECLARE 声明变量,str类型是varchar(50),默认值是空。 - - (6)CONCAT连接多个字符串。 - - (7)RETURN 返回拼接后的字符串str。 - - - - -### 2.执行 - -select 函数名('字段名') - - - -## 二、视图 - -## 视图是虚拟表,本身不存储数据,而是按照指定的方式进行查询 - -创建视图 - -```mysql -CREATE VIEW 视图名(列1,列2...) AS SELECT (列1,列2...) FROM ...; -``` - -使用视图 - -```mysql -当成表使用就好 -``` - - - -修改视图 - -```mysql -CREATE OR REPLACE VIEW 视图名 AS SELECT [...] FROM [...]; -``` - - - -查看数据库已有视图 - -```mysql ->SHOW TABLES [like...];(可以使用模糊查找) -``` - - - -查看视图详情 - -```mysql -DESC 视图名或者SHOW FIELDS FROM 视图名 -``` - - - -视图条件限制 - -```mysql -[WITH CHECK OPTION] -``` - -#### 插入数据 -1. 视图不是表,不直接存储数据,是一张虚拟的表; -2. 一般情况下,在创建有条件限制的视图时,加上“WITH CHECK OPTION”命令*) - -1.通过视图插入数据 - -```mysql ->INSERT INTO v_order(pid,pname,price) VALUES('p010','柴油','34'); -``` - -2.不可以跨表插入数据 - -```mysql -可以通过视图插入数据,但是只能基于一个基础表进行插入,不能跨表更新数据。 -``` - -3.WITH CHECK OPTION -如果在创建视图的时候制定了“WITH CHECK OPTION”,那么更新数据时不能插入或更新不符合视图限制条件的记录。 - -通过视图修改,可能导致数据无故消失,因此: - -> 没有特殊的理由,建议加上“WITH CHECK OPTION”命令。 - -# 百度标准理解 - -#### 1.事务 - -- 原子性:事务包含的这一系列操作,要么全部成功,要么全部失败。(由DBMS的事务管理子系统来实现); -- 一致性:事务完成之后,不会将非法的数据写入数据库。(由DBMS的完整性子系统执行测试任务); -- 隔离性:多个事务可以在一定程度上并发执行。(由DBMS的[并发](https://so.csdn.net/so/search?q=并发&spm=1001.2101.3001.7020)控制子系统实现); - -隔离级别 - -读未提交:一个事务可以读取到另外一个事务尚未提交的数据。该隔离级别可能会产生“脏读”、“不可重复读取”和“幻影读取”问题。 - -读已提交:一个事务只能读取到另外一个事务已经提交的数据。该隔离级别解决了“脏读”问题,但是仍然可能会发生“不可重复读取”和“幻影读取”问题。 - - -可重复读取:在同一个事务当中,多次读取同一份数据,结果一样。该隔离级别解决了“脏读”和“不可重复读取”问题,但是仍然有可能会产生“幻影读取问题”(虚读)。 - -序列化:多个同务只能排队执行,即只有一个事务结束之后,另外一个事务才能开始执行。该隔离级别解决了“脏读”,“不可重复读取”和“幻影读取”问题,但是程序性能会下降。所以只有必要的时候(比如在银行系统里面)才会使用。 - -总结: - - 隔离级别从低到高依次是"读未提交"、“读已提交”、“可重复读取”和“序列化”,隔离级别越高,性能越低。mysql数据库默认隔离级别是“可重复读取”,oracle是“读已提交”。数据库底层使用的“加锁”的机制来实现不同的隔离级别,包括对整个表加锁,对表中的行加锁。 - - mysql数据库开始事务、提交事务、回滚事务 - -```MYSQL -begin; -commit; -rollback; -``` - - mysql数据库必须将数据库引擎设置为"innodb"才能支持事务。 - - - -- 持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上)(由DBMS的恢复管理子系统实现的); - - - -#### 2.视图 - -创建视图 - - create view 视图名 as select(注:可以对单表或者多表进行查询,数据库会将视图的定义保存下来。) - -删除视图 - - drop view 视图名 - -例子 - -```mysql -create table t_emp( - id int primary key auto_increment, - name varchar(50), - salary int, - age int -); - -create view v_emp as select * from t_emp; -create view v_emp2(name,salary) as select name,salary from t_emp; - -insert into v_emp2 values('Jhon',3000); - -create table t_dept( - id int primary key, - name varchar(50), - addr varchar(100) -); -insert into t_dept values(100,'财务部','北京'); -insert into t_dept values(200,'开发部','上海'); - -create table t_staff( - id int primary key auto_increment, - name varchar(30), - age int, - dept_id int -); -insert into t_staff values(null,'张三',33,100); -insert into t_staff values(null,'李四',23,100); -insert into t_staff values(null,'王五',43,200); - -create view v_staff_dept(sname,dname,addr) -as -select s.name sname,d.name dname,d.addr from t_staff s -join t_dept d on s.dept_id = d.id; - -drop view v_emp; - - -``` - -#### 3.索引 - -创建索引 - - create index 索引名 on 表名(字段列表) - -—— 为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - - 注:索引类似于一本书的目录 - -应该将经常作为查询条件的字段加索引,除此以外,还要在分组、过滤、排序及联合查询的字段上加索引 - -删除索引 - - drop index 索引名 on 表名 - -联合索引 - - 所谓联合索引(复合索引),指的是索引字段是多个 - -#### 4.存储过程 - - 存储在数据库端的一组为了完成特定功能的sql语句 - - create procedure 存储过程名([参数]) - - 参数格式 (参数类型 参数名 数据类型) - - 参数类型有三种: - - IN: 输入参数,该参数的值必须在调用该存储过程时指定,在存储过程内部使用, 不能返回。 - - 缺省值是IN。 - - OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - - INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回。 - -#### 5.约束 - -是一种限制,通过对表的行或者列的数据做出限制来确保数据的完整性和一致性。 - - - -主键:相当于唯一性约束 + 非空约束的组合。 - - 注:一张表只能一个主键,数据库会为主键添加主键索引 - - 外键:用于确保两个表之间的参照完整性。 - -插入记录时,要先插入主表中的记录。 -删除记录时,要先删除从表中的记录。 - - 非空: not null - - 唯一性:unique - - 检查(了解): - - 注:检查约束跟数据库版本有关系,mysql8.0.16之后才支持。 - - - -#### 6.Case表达式 \ No newline at end of file diff --git "a/01 \351\231\210\346\242\246\346\242\246/20230925.md" "b/01 \351\231\210\346\242\246\346\242\246/20230925.md" deleted file mode 100644 index a7bde0d6936157045d90d2525942c1e5b835f65d..0000000000000000000000000000000000000000 --- "a/01 \351\231\210\346\242\246\346\242\246/20230925.md" +++ /dev/null @@ -1,384 +0,0 @@ - - -## 笔记: - -2023年9月27日 - -#### 1.check约束 - -检查某个字段的值是否符合要求,一般指的是值的范围 - -```mysql -age int age>0; -``` - -##### 语法 - -check (表达式); - -```mysql -gender char(1), -check (gender in('男','女')) -``` - -#### 2.视图 - -##### 创建视图 - -```mysql -create view 视图的名称 as select语句; -create view 视图的字段 as select语句(字段数要与select语句结果的字段一致); -``` - -##### 查询视图 - -```mysql -select * from 视图名称; -select 字段名 from 视图名称; -``` - -##### 修改视图 - -```mysql -alter view 视图名称 as select语句;//前提是被修改的视图要存在 - -create or replace view 视图名称 as select语句;//视图存在就修改,无则自动创建 -``` - - - -##### 删除视图 - -```mysql -drop view if exists 视图名称; -``` - - - -### 答案 - -```mysql - -#第14章_视图的课后练习 - -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -drop view if exists employee_vu; -create view employee_vu -as -select last_name 姓名,employee_id 员工号,department_id 部门号 from employees; - - - -#2. 显示视图的结构 -desc employee_vu; - - -#3. 查询视图中的全部内容 -select * from employee_vu; - - -#4. 将视图中的数据限定在部门号是80的范围内 - -create or replace view employee_vu - -as - -select last_name 姓名,employee_id 员工号,department_id 部门号 from -employees where department_id=80; - -select * from employee_vu; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -drop view if exists emp_v1; -create view emp_v1 -as -select last_name 姓名,salary 工资,email 邮箱 from employees where phone_number like '011%'; - - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - -alter view emp_v1 -as -select last_name 姓名,salary 工资,email 邮箱,phone_number 电话号码 from employees where phone_number like '011%' and email like '%e%'; -select * from emp_v1; - -#3. 向 emp_v1 插入一条记录,是否可以? - -insert into emp_v1 values('cmm',10000.00,'ggggggg','147258369');#插入失败,不可以插入数据,视图不是一个表 - - - - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 - -update emp_v1 -set 工资=工资+1000; - -#5. 删除emp_v1中姓名为Olsen的员工 - - -delete from emp_v1 -where 姓名='Olsen'; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -select * from employees; - -drop view if exists emp_v2; -create view emp_v2 -as -select max(salary), department_id from employees group by department_id having max(salary)>12000 ; - -select * from emp_v2 ; - - -#7. 向 emp_v2 中插入一条记录,是否可以? - - -#不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view if exists emp_v2 ; -drop view if exists emp_v1 ; -``` - -### 题目 - -```mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -``` - diff --git "a/02 \351\231\210\346\230\216\345\207\275/.keep" "b/02 \351\231\210\346\230\216\345\207\275/.keep" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/02 \351\231\210\346\230\216\345\207\275/9.5\347\254\224\350\256\260.md" "b/02 \351\231\210\346\230\216\345\207\275/9.5\347\254\224\350\256\260.md" deleted file mode 100644 index 56418591986de9293f2dec1b73e6cb8bfe3d5e50..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/9.5\347\254\224\350\256\260.md" +++ /dev/null @@ -1,9 +0,0 @@ -``` -1.一对一关系:将其中一个表的主键放到另一个表当外键。 -2.一对多关系(or 多对一关系):将一个所在表的主键放在另一个表当外键。 -3.多对多关系:引入第三张表,前两张表的主键当第三张表的外键。 -E-R1的三要素:实体(表),字段(属性),关系。 -``` - - - diff --git "a/02 \351\231\210\346\230\216\345\207\275/9.5\347\254\224\350\256\2602.md" "b/02 \351\231\210\346\230\216\345\207\275/9.5\347\254\224\350\256\2602.md" deleted file mode 100644 index 5e700fa7521ab29bf2cb297d0c7c118454c4ffd7..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/9.5\347\254\224\350\256\2602.md" +++ /dev/null @@ -1,10 +0,0 @@ - - -1. 学业规划:大二是大学生活的关键一年,要注重学习。制定一个合理的课程表,合理安排每天的学习和复习时间。积极参与课堂讨论和实践活动,提高自己的学习成绩。 -2. 提升技能:除了学业,可以考虑培养一些实用的技能。例如,参加一些与专业相关的实习或工作,参加一些职业培训课程,提升自己的就业竞争力。 -3. 社会实践:参加社团或学生组织,积极参与校园活动。这有助于培养团队合作能力和领导才能。也可以考虑参加志愿者活动,为社区服务,锻炼社会责任感。 -4. 健康管理:保持良好的健康习惯,定期锻炼身体,保证充足的睡眠和良好的饮食。这有助于提高身体和精神的健康状况,提高学习和生活质量。 -5. 拓展人际关系:大二是广交朋友的好时机。多参加校园活动,结识不同背景的人,扩大自己的人际圈子。与同学和老师建立良好的关系,这对未来的学习和职业发展都有好处。 -6. 实习或实践机会:大二可以找一些与专业相关的实习或实践机会,锻炼实际操作能力,增加实践经验。这对提升职业竞争力和将来找工作非常有帮助。 -7. 目标设定:大二开学是一个可以反思和设定目标的时刻。回顾过去一年的学习和生活,思考自己的优势和不足,并设定明确的目标。制定长期和短期目标,并制定计划和行动步骤,以实现这些目标。 - diff --git "a/02 \351\231\210\346\230\216\345\207\275/9.6.md" "b/02 \351\231\210\346\230\216\345\207\275/9.6.md" deleted file mode 100644 index 9ea9aec3e8ed2b99d4cdcf591f1d268f0d19672e..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/9.6.md" +++ /dev/null @@ -1,110 +0,0 @@ -```mysql -create database school charset utf8; - -use school; - --- 院系表 -create table department( - d_id int primary key, - d_name varchar(10), - d_address varchar(10) -); -insert into department values -(123,'软件工程学院','望云楼'), -(456,'信息工程学院','辛耕楼'), -(789,'建筑工程学院','万源楼'); - --- 专业表 -create table speciality( - s_id int primary key, - s_name varchar(10), - d_id int, - foreign key (d_id) references department(d_id) -); -insert into speciality values -(11,'软件技术与开发',123), -(22,'信息技术',456), -(33,'建筑设计',789); - --- 教室表 -create table classroom( -r_id int PRIMARY KEY, -r_name varchar(10) -); -insert into classroom values -(1,'实训一'), -(2,'实训二'), -(3,'实训三'); - --- 班级表 -create table class( - c_id int primary key, - c_name varchar(10), - s_id int, - foreign key (s_id) references speciality(s_id) -); -insert into class values -(1,'软件技术1班',11), -(2,'软件技术2班',11), -(3,'软件技术3班',11); - --- 课程表 -CREATE TABLE course( - couseId int PRIMARY key, - courseName varchar(10), - c_id int, - r_id int, - foreign key (c_id) references class(c_id), - foreign key (r_id) references classroom(r_id) -); -insert into course VALUES -(1,'java',1,2), -(2,'html',2,3), -(3,'mysql',3,1); - --- 教师表 -create table teacher( - t_id int primary key, - t_name varchar(10), - couseId int, - foreign key (couseId) references course(couseId) -); -insert into teacher values -(1,'张三',1), -(2,'张四',2), -(3,'张五',3); - --- 选修表 -create table `select` ( - selectId int primary key, - couseId int, - time varchar(20), - t_id int, - r_id int, - foreign key (couseId) references course(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references classroom(r_id) -); -insert into `select` values -(1,1,'周一上午',2,3), -(2,2,'周二下午',1,2), -(3,3,'周三上午',3,1); - --- 学生表 -create table student ( - id int primary key, - name varchar(10), - sex varchar(5), - age int, - address varchar(20), - c_id int, - selectId int, - foreign key (c_id) references class(c_id), - foreign key (selectId) references `select`(selectId) -); -insert into student values -(11111,'小明','男',18,'团结里1',1,1), -(22222,'小花','女',118,'团结里2',2,2), -(33333,'小王','男',1118,'团结里3',3,3); -``` - diff --git "a/02 \351\231\210\346\230\216\345\207\275/9.7\347\254\224\350\256\260.md" "b/02 \351\231\210\346\230\216\345\207\275/9.7\347\254\224\350\256\260.md" deleted file mode 100644 index 47fb3e0a3959717862b5214cd75ed50ea752f848..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/9.7\347\254\224\350\256\260.md" +++ /dev/null @@ -1,7 +0,0 @@ -数据库的范式 - -1第一范式:要求字段范围的内容不可再分隔,为的是数据的原子性 - -2第二范式:要求在满足第一范式的基础上,非主键字段要完全主键 - -3第三范式:满足第二范式的前提下,非主键属性要依赖主键 \ No newline at end of file diff --git "a/02 \351\231\210\346\230\216\345\207\275/9.8\347\254\224\350\256\260.md" "b/02 \351\231\210\346\230\216\345\207\275/9.8\347\254\224\350\256\260.md" deleted file mode 100644 index aeca3e619f2112747d947b4769be52bdd52179b4..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/9.8\347\254\224\350\256\260.md" +++ /dev/null @@ -1,9 +0,0 @@ -power designer - -第一步:创建概念模型(类似E-R图)CDM - -第二步:转换成逻辑模型 LDM - -第三步:转换成物理模型 PDM - -第四步:生成DDL \ No newline at end of file diff --git "a/02 \351\231\210\346\230\216\345\207\275/912.md" "b/02 \351\231\210\346\230\216\345\207\275/912.md" deleted file mode 100644 index 148eb45af487ad11b88a2f7479b83859dd7e6356..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/912.md" +++ /dev/null @@ -1,169 +0,0 @@ -![](https://i.niupic.com/images/2023/09/12/bEaF.png) - - ```mysql - /* - Navicat Premium Data Transfer - - Source Server : qiqi - Source Server Type : MySQL - Source Server Version : 50741 - Source Host : localhost:3306 - Source Schema : tushu - - Target Server Type : MySQL - Target Server Version : 50741 - File Encoding : 65001 - - Date: 12/09/2023 13:20:37 - */ - drop DATABASE tushu; - CREATE DATABASE tushu charset utf8; - use tushu; - - - SET NAMES utf8mb4; - SET FOREIGN_KEY_CHECKS = 0; - - -- ---------------------------- - -- Table structure for actors - -- ---------------------------- - DROP TABLE IF EXISTS `actors`; - CREATE TABLE `actors` ( - `fm_id` int(11) NOT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `zhiwu` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`fm_id`, `m_id`) USING BTREE, - INDEX `FK_actors2`(`m_id`) USING BTREE, - CONSTRAINT `FK_actors` FOREIGN KEY (`fm_id`) REFERENCES `filmmaker` (`fm_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_actors2` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT - ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - - -- ---------------------------- - -- Records of actors - -- ---------------------------- - - -- ---------------------------- - -- Table structure for comment - -- ---------------------------- - DROP TABLE IF EXISTS `comment`; - CREATE TABLE `comment` ( - `cm_id` int(11) NOT NULL AUTO_INCREMENT, - `u_idd` int(11) NULL DEFAULT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `c_disagree` int(11) NULL DEFAULT NULL, - `c_date` datetime NULL DEFAULT NULL, - `c_agree` int(11) NULL DEFAULT NULL, - PRIMARY KEY (`cm_id`) USING BTREE, - INDEX `FK_Relationship_1`(`u_idd`) USING BTREE, - INDEX `FK_Relationship_4`(`m_id`) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`u_idd`) REFERENCES `user` (`u_idd`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT - ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - - -- ---------------------------- - -- Records of comment - -- ---------------------------- - INSERT INTO `comment` VALUES (1, 1, '1', 0, '2023-09-20 13:19:35', 1); - INSERT INTO `comment` VALUES (2, 3, '1', 0, '2023-09-15 13:20:06', 1); - - -- ---------------------------- - -- Table structure for country - -- ---------------------------- - DROP TABLE IF EXISTS `country`; - CREATE TABLE `country` ( - `country_id` int(10) NOT NULL AUTO_INCREMENT, - `country_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `language` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`country_id`) USING BTREE - ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - - -- ---------------------------- - -- Records of country - -- ---------------------------- - INSERT INTO `country` VALUES (1, '美国', '英语'); - INSERT INTO `country` VALUES (2, '韩国', '韩语'); - - -- ---------------------------- - -- Table structure for filmmaker - -- ---------------------------- - DROP TABLE IF EXISTS `filmmaker`; - CREATE TABLE `filmmaker` ( - `fm_id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `sex` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `age` int(11) NULL DEFAULT NULL, - `master_work` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `contact` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`fm_id`) USING BTREE - ) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - - -- ---------------------------- - -- Records of filmmaker - -- ---------------------------- - INSERT INTO `filmmaker` VALUES (1, '席琳·宋', '女', 11, '导演,编剧', '1222'); - INSERT INTO `filmmaker` VALUES (2, ' 格蕾塔·李', '男', 22, '主演', '100'); - INSERT INTO `filmmaker` VALUES (3, '刘台午', '男', 33, '主演', '2222'); - INSERT INTO `filmmaker` VALUES (4, ' 约翰·马加罗', '女', 44, '主演', '4444'); - INSERT INTO `filmmaker` VALUES (5, ' 文胜雅', '男', 55, '主演', '5555'); - INSERT INTO `filmmaker` VALUES (6, '尹智慧', '女', 66, '主演', '6666'); - - -- ---------------------------- - -- Table structure for movie - -- ---------------------------- - DROP TABLE IF EXISTS `movie`; - CREATE TABLE `movie` ( - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `type_id` int(11) NULL DEFAULT NULL, - `country_id` int(11) NULL DEFAULT NULL, - `m_name` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_award` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_length` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_intro` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`m_id`) USING BTREE, - INDEX `FK_Relationship_3`(`type_id`) USING BTREE, - INDEX `FK_Relationship_6`(`country_id`) USING BTREE, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`type_id`) REFERENCES `movietype` (`type_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_6` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON DELETE RESTRICT ON UPDATE RESTRICT - ) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - - -- ---------------------------- - -- Records of movie - -- ---------------------------- - INSERT INTO `movie` VALUES ('1', 1, 1, '过往人生', '第73届柏林国际电影节', '106', 'Nora(Greta Lee 饰)自小便因家庭因素搬离首尔移居加拿大。她与青梅竹马 Hae Sung(刘台午 饰)的关系最终停留在稚幼的凝视不语。而在二十年后,命运令两人于纽约重逢。可此时 Nora已拥有新的身份,甚至已和Arthur(John Magaro 饰)建立家庭。和Hae Sung 分开二十年后的重逢,也令她重新思索生活中的真正渴望。'); - - -- ---------------------------- - -- Table structure for movietype - -- ---------------------------- - DROP TABLE IF EXISTS `movietype`; - CREATE TABLE `movietype` ( - `type_id` int(10) NOT NULL AUTO_INCREMENT, - `type_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`type_id`) USING BTREE - ) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - - -- ---------------------------- - -- Records of movietype - -- ---------------------------- - INSERT INTO `movietype` VALUES (1, '爱情'); - - -- ---------------------------- - -- Table structure for user - -- ---------------------------- - DROP TABLE IF EXISTS `user`; - CREATE TABLE `user` ( - `u_idd` int(11) NOT NULL AUTO_INCREMENT, - `u_id` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `u_IP` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `u_name` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`u_idd`) USING BTREE - ) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - - -- ---------------------------- - -- Records of user - -- ---------------------------- - INSERT INTO `user` VALUES (1, '2', '美国', 'Seb’s '); - INSERT INTO `user` VALUES (3, '4', '法国', 'DeadVolcano '); - - SET FOREIGN_KEY_CHECKS = 1; - ``` - diff --git "a/02 \351\231\210\346\230\216\345\207\275/912\347\254\224\350\256\260.md" "b/02 \351\231\210\346\230\216\345\207\275/912\347\254\224\350\256\260.md" deleted file mode 100644 index 7854fcf611880f068f20d88c0b3492eefc08d88b..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/912\347\254\224\350\256\260.md" +++ /dev/null @@ -1 +0,0 @@ -笔记就是图传 \ No newline at end of file diff --git "a/02 \351\231\210\346\230\216\345\207\275/915\344\275\234\344\270\232.md" "b/02 \351\231\210\346\230\216\345\207\275/915\344\275\234\344\270\232.md" deleted file mode 100644 index cd8c25939e4c07820f7c884206e7fe17db170244..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/915\344\275\234\344\270\232.md" +++ /dev/null @@ -1,110 +0,0 @@ -````mysql -作业 - -以汽车,用户,销售为题制表 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : kjin - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : car - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 15/09/2023 17:26:52 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for car --- ---------------------------- -DROP TABLE IF EXISTS `car`; -CREATE TABLE `car` ( - `c_id` int NOT NULL AUTO_INCREMENT, - `c_brand` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `c_model` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`c_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of car --- ---------------------------- -INSERT INTO `car` VALUES (1, '火力赛车f1', '奥迪双钻'); -INSERT INTO `car` VALUES (2, '火力赛车f1二代', '奥迪双钻'); -INSERT INTO `car` VALUES (3, '摇摇车', '山寨贴牌'); - --- ---------------------------- --- Table structure for client --- ---------------------------- -DROP TABLE IF EXISTS `client`; -CREATE TABLE `client` ( - `k_id` int NOT NULL AUTO_INCREMENT, - `k_name` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `k_sex` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `k_call` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`k_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of client --- ---------------------------- -INSERT INTO `client` VALUES (1, '小黎', '男', '114514'); -INSERT INTO `client` VALUES (2, '小韩', '男', '119110'); - --- ---------------------------- --- Table structure for record --- ---------------------------- -DROP TABLE IF EXISTS `record`; -CREATE TABLE `record` ( - `rec_id` int NOT NULL AUTO_INCREMENT, - `k_id` int NOT NULL, - `s_id` int NOT NULL, - `c_id` int NULL DEFAULT NULL, - `r_price` int NULL DEFAULT NULL, - `date` date NULL DEFAULT NULL, - PRIMARY KEY (`rec_id`) USING BTREE, - INDEX `AK_Identifier_1`(`rec_id` ASC, `k_id` ASC, `s_id` ASC) USING BTREE, - INDEX `FK_Relationship_4`(`c_id` ASC) USING BTREE, - INDEX `FK_record`(`k_id` ASC) USING BTREE, - INDEX `FK_record2`(`s_id` ASC) USING BTREE, - CONSTRAINT `FK_record` FOREIGN KEY (`k_id`) REFERENCES `client` (`k_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_record2` FOREIGN KEY (`s_id`) REFERENCES `salesman` (`s_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`c_id`) REFERENCES `car` (`c_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of record --- ---------------------------- -INSERT INTO `record` VALUES (1, 1, 1, 1, 20, '2023-09-15'); -INSERT INTO `record` VALUES (2, 2, 1, 2, 80, '2023-09-15'); -INSERT INTO `record` VALUES (3, 2, 2, 3, 100, '2023-09-15'); - --- ---------------------------- --- Table structure for salesman --- ---------------------------- -DROP TABLE IF EXISTS `salesman`; -CREATE TABLE `salesman` ( - `s_id` int NOT NULL AUTO_INCREMENT, - `s_name` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `s_sex` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`s_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of salesman --- ---------------------------- -INSERT INTO `salesman` VALUES (1, '小王', '男'); -INSERT INTO `salesman` VALUES (2, '小八', '男'); - -SET FOREIGN_KEY_CHECKS = 1; -``` -```` - diff --git "a/02 \351\231\210\346\230\216\345\207\275/919\344\275\234\344\270\232.md" "b/02 \351\231\210\346\230\216\345\207\275/919\344\275\234\344\270\232.md" deleted file mode 100644 index e78121cfeabc3f0cae19beb4e88b4e49561c05e5..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/919\344\275\234\344\270\232.md" +++ /dev/null @@ -1,265 +0,0 @@ -```mysql -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -SELECT SUM(salary+(salary*IFNULL(commission_pct,1)))*12 工资总和 FROM employees; -#理解1:计算12月的基本工资 -#SELECT sum(salary*12) as 工资总和 FROM employees; -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的 job_id 以后的数据 -#去除重复 distinct -SELECT DISTINCT job_id FROM employees; - - -# 3.查询工资大于12000的员工姓名和工资 -SELECT first_name,last_name,salary FROM employees WHERE salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 -SELECT first_name,last_name,job_id FROM employees WHERE employee_id=176; - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -DESC departments; -SELECT * FROM departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -SELECT * FROM employees WHERE salary NOT in (5000,12000); - - -# 2.选择在20或50号部门工作的员工姓名和部门号 -SELECT * FROM employees WHERE department_id=20 OR department_id=50; - -# 3.选择公司中没有管理者的员工姓名及job_id -SELECT first_name,last_name,job_id FROM employees WHERE manager_id IS NULL; - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -SELECT first_name,last_name,salary,commission_pct FROM employees WHERE commission_pct IS NOT NULL; - - - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 -SELECT * FROM employees WHERE last_name like '__尔%'; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -SELECT * FROM employees WHERE last_name like '%尔%' or '%特%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -SELECT * FROM employees WHERE last_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -SELECT * FROM employees WHERE department_id BETWEEN 80 AND 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -SELECT * FROM employees WHERE department_id in(100,101,110); - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -SELECT * FROM employees ORDER BY salary DESC; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -SELECT * FROM employees WHERE salary not BETWEEN 8000 AND 17000 ORDER BY salary DESC LIMIT 20,20; - - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -SELECT * FROM employees WHERE email LIKE '%e%' ORDER BY LENGTH(email) DESC , department_id; - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -SELECT e.first_name,e.last_name,e.department_id,d.department_name FROM employees e INNER JOIN departments d ON e.department_id=d.department_id; - -# 2.查询90号部门员工的 job_id 和90号部门的location_id -SELECT e.job_id,e.department_id,d.location_id FROM employees e INNER JOIN departments d ON e.department_id=d.department_id WHERE e.department_id=90; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city -SELECT e.last_name,d.department_name,d.location_id,l.city -FROM - employees e - INNER JOIN departments d -on - e.department_id = d.department_id - INNER JOIN locations l ON d.location_id = l.location_id -WHERE - e.commission_pct IS NOT NULL; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -SELECT e.last_name,e.job_id,e.department_id,d.department_name from employees e INNER JOIN departments d on e.department_id=d.department_id where d.location_id= -(SELECT location_id FROM locations WHERE city='多伦多'); - - -#sql92语法(自然连接) - -# 5.查询 行政部 门员工的部门名称、部门地址、姓名、工作、工资 -SELECT d.department_name,l.city,e.last_name,j.job_title,e.salary from departments d INNER JOIN locations l on d.location_id=l.location_id INNER JOIN employees e on d.department_id=e.department_id INNER JOIN jobs j on e.job_id=j.job_id WHERE d.department_name='行政部'; - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 -SELECT e1.last_name,e1.employee_id,e2.last_name,e2.employee_id from employees e1 INNER JOIN employees e2 on e1.manager_id=e2.employee_id; - -# 7.查询哪些部门没有员工 -SELECT d.department_name from employees e RIGHT JOIN departments d on e.department_id=d.department_id WHERE e.employee_id IS null; -# 8. 查询哪个城市没有部门 -SELECT city from departments d RIGHT JOIN locations l on d.location_id=l.location_id where department_id IS NULL; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -SELECT e.* FROM employees e INNER JOIN departments d on e.department_id=d.department_id where d.department_name='销售部'or '信息技术部'; -# 第08章_聚合函数的课后练习 - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -SELECT MAX(salary),MIN(salary),AVG(salary),SUM(salary) FROM employees; - -#3.查询各 job_id 的员工工资的最大值,最小值,平均值,总和 -SELECT job_id,MAX(salary),MIN(salary),AVG(salary),SUM(salary) FROM employees GROUP BY job_id; - -#4.选择各个job_id的员工人数 -SELECT job_id,COUNT(job_id) from employees GROUP BY job_id; - -# 5.查询员工最高工资和最低工资的差距 -SELECT MAX(salary)-MIN(salary) FROM employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 -SELECT manager_id,MIN(salary) FROM employees WHERE manager_id IS NOT NULL GROUP BY manager_id HAVING MIN(salary)>6000; - -# 7.查询所有部门的名字,location_id,员工数量 和 平均工资,并按平均工资降序 -SELECT d.department_name,location_id,e1.`员工数量`,e1.`平均工资` FROM departments d INNER JOIN ( -SELECT e.department_id,COUNT(e.salary) 员工数量,AVG(e.salary) 平均工资 FROM employees e GROUP BY e.department_id) e1 on d.department_id=e1.department_id ORDER BY e1.`平均工资` DESC; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 -SELECT e.job_id,d.department_name,MIN(e.salary) FROM jobs j INNER JOIN employees e ON j.job_id=e.job_id INNER JOIN departments d on d.department_id=e.department_id GROUP BY e.job_id,d.department_name; - - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -SELECT last_name,salary from employees WHERE department_id= -(SELECT department_id FROM employees WHERE last_name='兹洛特基') AND last_name != '兹洛特基'; - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -SELECT employee_id,last_name,salary FROM employees WHERE salary>( -SELECT AVG(salary) FROM employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary -SELECT last_name,job_id,salary FROM employees WHERE salary>( -SELECT MAX(salary) from employees WHERE job_id='SA_MAN'); - -#4.查询和姓名中包含 尔 的员工在相同部门的员工的员工号和姓名 -SELECT employee_id,last_name from employees WHERE department_id IN( -SELECT DISTINCT department_id FROM employees WHERE last_name LIKE '%尔%') AND last_name NOT LIKE '%尔%'; - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -SELECT e.employee_id FROM employees e INNER JOIN departments d ON e.department_id=d.department_id where d.location_id=1700; - -#6.查询管理者是 金 的员工姓名和工资 -SELECT e1.last_name,e1.salary FROM employees e1 INNER JOIN employees e2 on e1.manager_id=e2.employee_id where e2.last_name='金'; - -#7.查询工资最低的员工信息: last_name, salary -SELECT last_name,salary FROM employees WHERE salary=( -SELECT MIN(salary) FROM employees); -#8.查询平均工资最低的部门信息 -SELECT * FROM departments d INNER JOIN -(SELECT department_id,AVG(salary) as a FROM employees WHERE department_id IS NOT NULL GROUP BY department_id) e ON d.department_id=e.department_id where e.a=( -SELECT MIN(e.a) FROM departments d INNER JOIN -(SELECT department_id,AVG(salary) as a FROM employees WHERE department_id IS NOT NULL GROUP BY department_id) e ON d.department_id=e.department_id); -#方式1 -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -SELECT * FROM departments d INNER JOIN -(SELECT department_id,AVG(salary) as a FROM employees WHERE department_id IS NOT NULL GROUP BY department_id) e ON d.department_id=e.department_id where e.a=( -SELECT MIN(e.a) FROM departments d INNER JOIN -(SELECT department_id,AVG(salary) as a FROM employees WHERE department_id IS NOT NULL GROUP BY department_id) e ON d.department_id=e.department_id); - -#10.查询平均工资最高的 job 信息 -SELECT job_id,AVG(salary) a1 FROM employees GROUP BY job_id HAVING a1= -(SELECT max(e.a) FROM( -SELECT job_id,AVG(salary) a FROM employees GROUP BY job_id) as e); - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - - -#11.查询平均工资高于公司平均工资的部门有哪些? -SELECT department_id,AVG(salary) a FROM employees GROUP BY department_id HAVING a>( -(SELECT AVG(salary) FROM employees)); - -#12.查询出公司中所有 manager 的详细信息 -SELECT * FROM employees WHERE employee_id in ( -SELECT manager_id FROM employees); -#方式1:自连接 自己连自己 - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? -#方式: -SELECT MIN(salary) FROM employees WHERE department_id=( -SELECT department_id FROM employees GROUP BY department_id HAVING MAX(salary)=( -SELECT MIN(a.m) FROM (SELECT department_id,MAX(salary) m FROM employees GROUP BY department_id ) a)); - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -SELECT last_name,department_id,email,salary FROM employees WHERE department_id=( -SELECT department_id from employees GROUP BY department_id ORDER BY AVG(salary) LIMIT 1); - -#15. 查询部门的部门号,其中不包括job_id是" ST_CLERK "的部门号 -#方式1: - -SELECT DISTINCT department_id FROM employees WHERE job_id != 'ST_CLERK' - -#16. 选择所有没有管理者的员工的last_name -SELECT last_name FROM employees WHERE manager_id IS NULL; -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 金 -SELECT employee_id,last_name,hire_date,salary FROM employees WHERE manager_id in( -SELECT employee_id FROM employees WHERE last_name='金'); - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) -SELECT - e1.employee_id,e1.last_name,e1.salary,e2.a -FROM - employees e1 - INNER JOIN ( SELECT department_id, AVG( salary ) a FROM employees GROUP BY department_id ) e2 - ON e1.department_id=e2.department_id HAVING e1.salary>e2.a; - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -SELECT d.department_name FROM departments d INNER JOIN ( -SELECT department_id,COUNT(department_id) FROM employees GROUP BY department_id HAVING COUNT(department_id)>5) d2 on d.department_id=d2.department_id; -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -SELECT country_id FROM locations l INNER JOIN departments d on l.location_id=d.location_id GROUP BY country_id HAVING COUNT(department_id)>2; -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` - diff --git "a/02 \351\231\210\346\230\216\345\207\275/920\344\275\234\344\270\232.md" "b/02 \351\231\210\346\230\216\345\207\275/920\344\275\234\344\270\232.md" deleted file mode 100644 index 9453103cc46442085d5ebdbea952ae996291464e..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/920\344\275\234\344\270\232.md" +++ /dev/null @@ -1,146 +0,0 @@ -````mysql -## 作业 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : dsa - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : ren - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 19/09/2023 17:27:01 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for menu --- ---------------------------- -DROP TABLE IF EXISTS `menu`; -CREATE TABLE `menu` ( - `menu_id` int NOT NULL AUTO_INCREMENT, - `menu_name1` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`menu_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 104 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of menu --- ---------------------------- -INSERT INTO `menu` VALUES (100, '出场臭鸡蛋特效'); -INSERT INTO `menu` VALUES (101, '出场五个舍友抬轿子特效'); -INSERT INTO `menu` VALUES (102, '出场御龙传说特效'); -INSERT INTO `menu` VALUES (103, '出场三星瑞兹召唤10个窈窕淑女特效'); - --- ---------------------------- --- Table structure for role --- ---------------------------- -DROP TABLE IF EXISTS `role`; -CREATE TABLE `role` ( - `role_id` int NOT NULL AUTO_INCREMENT, - `role_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `role_tel` char(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`role_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 41 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role --- ---------------------------- -INSERT INTO `role` VALUES (10, '渣渣辉', '12345679811'); -INSERT INTO `role` VALUES (20, '贫民玩家', '12345679812'); -INSERT INTO `role` VALUES (30, '氪金大大佬', '12345679813'); -INSERT INTO `role` VALUES (40, '科技不要脸玩家', '12345679814'); - --- ---------------------------- --- Table structure for role_menu --- ---------------------------- -DROP TABLE IF EXISTS `role_menu`; -CREATE TABLE `role_menu` ( - `rm_id` int NOT NULL AUTO_INCREMENT, - `role_id` int NULL DEFAULT NULL, - `menu_id` int NULL DEFAULT NULL, - PRIMARY KEY (`rm_id`) USING BTREE, - INDEX `role_id`(`role_id` ASC) USING BTREE, - INDEX `menu_id`(`menu_id` ASC) USING BTREE, - CONSTRAINT `role_menu_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `role_menu_ibfk_2` FOREIGN KEY (`menu_id`) REFERENCES `menu` (`menu_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 51 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role_menu --- ---------------------------- -INSERT INTO `role_menu` VALUES (1, 10, 100); -INSERT INTO `role_menu` VALUES (2, 20, 100); -INSERT INTO `role_menu` VALUES (3, 20, 101); -INSERT INTO `role_menu` VALUES (4, 30, 100); -INSERT INTO `role_menu` VALUES (5, 30, 101); -INSERT INTO `role_menu` VALUES (6, 30, 102); -INSERT INTO `role_menu` VALUES (7, 40, 100); -INSERT INTO `role_menu` VALUES (8, 40, 101); -INSERT INTO `role_menu` VALUES (9, 40, 102); -INSERT INTO `role_menu` VALUES (10, 40, 103); - --- ---------------------------- --- Table structure for user --- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `user_id` int NOT NULL AUTO_INCREMENT, - `user_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `user_tel` char(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`user_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '凯撒大帝', '12346578911'); -INSERT INTO `user` VALUES (2, '凯尔大帝', '12346578912'); -INSERT INTO `user` VALUES (3, '凯皇大帝', '12346578913'); -INSERT INTO `user` VALUES (4, '普洱大帝', '12346578914'); -INSERT INTO `user` VALUES (5, '盖伦大帝', '12346578915'); -INSERT INTO `user` VALUES (6, '刀妹大帝', '12346578916'); -INSERT INTO `user` VALUES (7, '旭旭大帝', '12346578917'); -INSERT INTO `user` VALUES (8, '丘丘大帝', '12346578918'); -INSERT INTO `user` VALUES (9, '宝宝大帝', '12346578919'); - --- ---------------------------- --- Table structure for user_role --- ---------------------------- -DROP TABLE IF EXISTS `user_role`; -CREATE TABLE `user_role` ( - `ur_id` int NOT NULL AUTO_INCREMENT, - `user_id` int NULL DEFAULT NULL, - `role_id` int NULL DEFAULT NULL, - PRIMARY KEY (`ur_id`) USING BTREE, - INDEX `user_id`(`user_id` ASC) USING BTREE, - INDEX `role_id`(`role_id` ASC) USING BTREE, - CONSTRAINT `user_role_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `user_role_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user_role --- ---------------------------- -INSERT INTO `user_role` VALUES (1, 1, 10); -INSERT INTO `user_role` VALUES (2, 2, 20); -INSERT INTO `user_role` VALUES (3, 3, 30); -INSERT INTO `user_role` VALUES (4, 4, 40); -INSERT INTO `user_role` VALUES (5, 5, 10); -INSERT INTO `user_role` VALUES (6, 6, 20); -INSERT INTO `user_role` VALUES (7, 7, 30); -INSERT INTO `user_role` VALUES (8, 8, 40); -INSERT INTO `user_role` VALUES (9, 9, 10); - -SET FOREIGN_KEY_CHECKS = 1; -``` -\ No newline at end of file -```` - diff --git "a/02 \351\231\210\346\230\216\345\207\275/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/02 \351\231\210\346\230\216\345\207\275/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index f622b752ea75125d456d4740d1a11f5123117b67..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,262 +0,0 @@ -```mysql -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW2_BORROW_LIBRARY') then - alter table Borrow2 - delete foreign key FK_BORROW2_BORROW_LIBRARY -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW2_BORROW2_BORROW') then - alter table Borrow2 - delete foreign key FK_BORROW2_BORROW2_BORROW -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_MANAGE_MANAGE_LIBRARY') then - alter table manage - delete foreign key FK_MANAGE_MANAGE_LIBRARY -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_MANAGE_MANAGE2_WORKING') then - alter table manage - delete foreign key FK_MANAGE_MANAGE2_WORKING -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_SERVE_SERVE_WORKING') then - alter table serve - delete foreign key FK_SERVE_SERVE_WORKING -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_SERVE_SERVE2_BORROW') then - alter table serve - delete foreign key FK_SERVE_SERVE2_BORROW -end if; - -drop index if exists Borrow.Borrow_PK; - -drop table if exists Borrow; - -drop index if exists Borrow2.Borrow2_FK; - -drop index if exists Borrow2.Borrow_FK; - -drop index if exists Borrow2.Borrow2_PK; - -drop table if exists Borrow2; - -drop index if exists library.library_PK; - -drop table if exists library; - -drop index if exists manage.manage2_FK; - -drop index if exists manage.manage_FK; - -drop index if exists manage.manage_PK; - -drop table if exists manage; - -drop index if exists serve.serve_FK; - -drop index if exists serve.serve2_FK; - -drop index if exists serve.serve_PK; - -drop table if exists serve; - -drop index if exists "working personnel"."working personnel_PK"; - -drop table if exists "working personnel"; - -/*==============================================================*/ -/* Table: Borrow */ -/*==============================================================*/ -create table Borrow -( - Bor_id integer not null, - Bor_name varchar(10) not null, - Bor_level integer not null, - Bor_blacklist varchar(10) not null, - constraint PK_BORROW primary key (Bor_id) -); - -/*==============================================================*/ -/* Index: Borrow_PK */ -/*==============================================================*/ -create unique index Borrow_PK on Borrow ( -Bor_id ASC -); - -/*==============================================================*/ -/* Table: Borrow2 */ -/*==============================================================*/ -create table Borrow2 -( - lib_id integer not null, - Bor_id integer not null, - situation char(4) not null, - constraint PK_BORROW2 primary key (lib_id, Bor_id) -); - -/*==============================================================*/ -/* Index: Borrow2_PK */ -/*==============================================================*/ -create unique index Borrow2_PK on Borrow2 ( -lib_id ASC, -Bor_id ASC -); - -/*==============================================================*/ -/* Index: Borrow_FK */ -/*==============================================================*/ -create index Borrow_FK on Borrow2 ( -lib_id ASC -); - -/*==============================================================*/ -/* Index: Borrow2_FK */ -/*==============================================================*/ -create index Borrow2_FK on Borrow2 ( -Bor_id ASC -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - lib_id integer not null, - lib_name varchar(20) not null, - lib_state varchar(3) not null, - lib_author varchar(10) not null, - lib_publish varchar(20) not null, - lib_classes integer not null, - constraint PK_LIBRARY primary key (lib_id) -); - -/*==============================================================*/ -/* Index: library_PK */ -/*==============================================================*/ -create unique index library_PK on library ( -lib_id ASC -); - -/*==============================================================*/ -/* Table: manage */ -/*==============================================================*/ -create table manage -( - lib_id integer not null, - wor_id integer not null, - lib_state varchar(2) not null, - constraint PK_MANAGE primary key (lib_id, wor_id) -); - -/*==============================================================*/ -/* Index: manage_PK */ -/*==============================================================*/ -create unique index manage_PK on manage ( -lib_id ASC, -wor_id ASC -); - -/*==============================================================*/ -/* Index: manage_FK */ -/*==============================================================*/ -create index manage_FK on manage ( -lib_id ASC -); - -/*==============================================================*/ -/* Index: manage2_FK */ -/*==============================================================*/ -create index manage2_FK on manage ( -wor_id ASC -); - -/*==============================================================*/ -/* Table: serve */ -/*==============================================================*/ -create table serve -( - wor_id integer not null, - Bor_id integer not null, - constraint PK_SERVE primary key (wor_id, Bor_id) -); - -/*==============================================================*/ -/* Index: serve_PK */ -/*==============================================================*/ -create unique index serve_PK on serve ( -wor_id ASC, -Bor_id ASC -); - -/*==============================================================*/ -/* Index: serve2_FK */ -/*==============================================================*/ -create index serve2_FK on serve ( -Bor_id ASC -); - -/*==============================================================*/ -/* Index: serve_FK */ -/*==============================================================*/ -create index serve_FK on serve ( -wor_id ASC -); - -/*==============================================================*/ -/* Table: "working personnel" */ -/*==============================================================*/ -create table "working personnel" -( - wor_id integer not null, - wor_name varchar(4) not null, - wor_position varchar(10) not null, - wor_range varchar(20) not null, - wor_state varchar(4) not null, - constraint "PK_WORKING PERSONNEL" primary key (wor_id) -); - -/*==============================================================*/ -/* Index: "working personnel_PK" */ -/*==============================================================*/ -create unique index "working personnel_PK" on "working personnel" ( -wor_id ASC -); - -alter table Borrow2 - add constraint FK_BORROW2_BORROW_LIBRARY foreign key (lib_id) - references library (lib_id) - on update restrict - on delete restrict; - -alter table Borrow2 - add constraint FK_BORROW2_BORROW2_BORROW foreign key (Bor_id) - references Borrow (Bor_id) - on update restrict - on delete restrict; - -alter table manage - add constraint FK_MANAGE_MANAGE_LIBRARY foreign key (lib_id) - references library (lib_id) - on update restrict - on delete restrict; - -alter table manage - add constraint FK_MANAGE_MANAGE2_WORKING foreign key (wor_id) - references "working personnel" (wor_id) - on update restrict - on delete restrict; - -alter table serve - add constraint FK_SERVE_SERVE_WORKING foreign key (wor_id) - references "working personnel" (wor_id) - on update restrict - on delete restrict; - -alter table serve - add constraint FK_SERVE_SERVE2_BORROW foreign key (Bor_id) - references Borrow (Bor_id) - on update restrict - on delete restrict; -``` - diff --git "a/02 \351\231\210\346\230\216\345\207\275/\347\254\224\350\256\260.md" "b/02 \351\231\210\346\230\216\345\207\275/\347\254\224\350\256\260.md" deleted file mode 100644 index a07fefad26a55f49e3f5c51bf1d21e1ced602026..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/\347\254\224\350\256\260.md" +++ /dev/null @@ -1,259 +0,0 @@ -````mysql -## 数据库高级部分预习 - -## 一、函数 - -### 1.创建自定义函数 - - (1)DELIMITER $$ 定义结束符。MySQL默认的结束符是分号,但是函数体中可能用到分号。为了避免冲突,需要另外定义结束符。 - - (2)DROP FUNCTION IF EXISTS genPerson$$ 如果函数genPerson已经存在了,就删除掉。 - - (3)CREATE FUNCTION 创建函数genPerson,函数的参数是name,返回值是varchar(50)。 - - (4)函数体放在BEGIN 与 END之间。 - - (5)DECLARE 声明变量,str类型是varchar(50),默认值是空。 - - (6)CONCAT连接多个字符串。 - - (7)RETURN 返回拼接后的字符串str。 - - - - -### 2.执行 - -select 函数名('字段名') - - - -## 二、视图 - -## 视图是虚拟表,本身不存储数据,而是按照指定的方式进行查询 - -创建视图 - -```mysql -CREATE VIEW 视图名(列1,列2...) AS SELECT (列1,列2...) FROM ...; -``` - -使用视图 - -```mysql -当成表使用就好 -``` - - - -修改视图 - -```mysql -CREATE OR REPLACE VIEW 视图名 AS SELECT [...] FROM [...]; -``` - - - -查看数据库已有视图 - -```mysql ->SHOW TABLES [like...];(可以使用模糊查找) -``` - - - -查看视图详情 - -```mysql -DESC 视图名或者SHOW FIELDS FROM 视图名 -``` - - - -视图条件限制 - -```mysql -[WITH CHECK OPTION] -``` - -#### 插入数据 -1. 视图不是表,不直接存储数据,是一张虚拟的表; -2. 一般情况下,在创建有条件限制的视图时,加上“WITH CHECK OPTION”命令*) - -1.通过视图插入数据 - -```mysql ->INSERT INTO v_order(pid,pname,price) VALUES('p010','柴油','34'); -``` - -2.不可以跨表插入数据 - -```mysql -可以通过视图插入数据,但是只能基于一个基础表进行插入,不能跨表更新数据。 -``` - -3.WITH CHECK OPTION -如果在创建视图的时候制定了“WITH CHECK OPTION”,那么更新数据时不能插入或更新不符合视图限制条件的记录。 - -通过视图修改,可能导致数据无故消失,因此: - -> 没有特殊的理由,建议加上“WITH CHECK OPTION”命令。 - -# 百度标准理解 - -#### 1.事务 - -- 原子性:事务包含的这一系列操作,要么全部成功,要么全部失败。(由DBMS的事务管理子系统来实现); -- 一致性:事务完成之后,不会将非法的数据写入数据库。(由DBMS的完整性子系统执行测试任务); -- 隔离性:多个事务可以在一定程度上并发执行。(由DBMS的[并发](https://so.csdn.net/so/search?q=并发&spm=1001.2101.3001.7020)控制子系统实现); - -隔离级别 - -读未提交:一个事务可以读取到另外一个事务尚未提交的数据。该隔离级别可能会产生“脏读”、“不可重复读取”和“幻影读取”问题。 - -读已提交:一个事务只能读取到另外一个事务已经提交的数据。该隔离级别解决了“脏读”问题,但是仍然可能会发生“不可重复读取”和“幻影读取”问题。 - - -可重复读取:在同一个事务当中,多次读取同一份数据,结果一样。该隔离级别解决了“脏读”和“不可重复读取”问题,但是仍然有可能会产生“幻影读取问题”(虚读)。 - -序列化:多个同务只能排队执行,即只有一个事务结束之后,另外一个事务才能开始执行。该隔离级别解决了“脏读”,“不可重复读取”和“幻影读取”问题,但是程序性能会下降。所以只有必要的时候(比如在银行系统里面)才会使用。 - -总结: - - 隔离级别从低到高依次是"读未提交"、“读已提交”、“可重复读取”和“序列化”,隔离级别越高,性能越低。mysql数据库默认隔离级别是“可重复读取”,oracle是“读已提交”。数据库底层使用的“加锁”的机制来实现不同的隔离级别,包括对整个表加锁,对表中的行加锁。 - - mysql数据库开始事务、提交事务、回滚事务 - -```MYSQL -begin; -commit; -rollback; -``` - - mysql数据库必须将数据库引擎设置为"innodb"才能支持事务。 - - - -- 持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上)(由DBMS的恢复管理子系统实现的); - - - -#### 2.视图 - -创建视图 - - create view 视图名 as select(注:可以对单表或者多表进行查询,数据库会将视图的定义保存下来。) - -删除视图 - - drop view 视图名 - -例子 - -```mysql -create table t_emp( - id int primary key auto_increment, - name varchar(50), - salary int, - age int -); - -create view v_emp as select * from t_emp; -create view v_emp2(name,salary) as select name,salary from t_emp; - -insert into v_emp2 values('Jhon',3000); - -create table t_dept( - id int primary key, - name varchar(50), - addr varchar(100) -); -insert into t_dept values(100,'财务部','北京'); -insert into t_dept values(200,'开发部','上海'); - -create table t_staff( - id int primary key auto_increment, - name varchar(30), - age int, - dept_id int -); -insert into t_staff values(null,'张三',33,100); -insert into t_staff values(null,'李四',23,100); -insert into t_staff values(null,'王五',43,200); - -create view v_staff_dept(sname,dname,addr) -as -select s.name sname,d.name dname,d.addr from t_staff s -join t_dept d on s.dept_id = d.id; - -drop view v_emp; - - -``` - -#### 3.索引 - -创建索引 - - create index 索引名 on 表名(字段列表) - -—— 为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - - 注:索引类似于一本书的目录 - -应该将经常作为查询条件的字段加索引,除此以外,还要在分组、过滤、排序及联合查询的字段上加索引 - -删除索引 - - drop index 索引名 on 表名 - -联合索引 - - 所谓联合索引(复合索引),指的是索引字段是多个 - -#### 4.存储过程 - - 存储在数据库端的一组为了完成特定功能的sql语句 - - create procedure 存储过程名([参数]) - - 参数格式 (参数类型 参数名 数据类型) - - 参数类型有三种: - - IN: 输入参数,该参数的值必须在调用该存储过程时指定,在存储过程内部使用, 不能返回。 - - 缺省值是IN。 - - OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - - INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回。 - -#### 5.约束 - -是一种限制,通过对表的行或者列的数据做出限制来确保数据的完整性和一致性。 - - - -主键:相当于唯一性约束 + 非空约束的组合。 - - 注:一张表只能一个主键,数据库会为主键添加主键索引 - - 外键:用于确保两个表之间的参照完整性。 - -插入记录时,要先插入主表中的记录。 -删除记录时,要先删除从表中的记录。 - - 非空: not null - - 唯一性:unique - - 检查(了解): - - 注:检查约束跟数据库版本有关系,mysql8.0.16之后才支持。 - - - -#### 6.Case表达式 -```` - diff --git "a/02 \351\231\210\346\230\216\345\207\275/\350\247\206\345\233\276.md" "b/02 \351\231\210\346\230\216\345\207\275/\350\247\206\345\233\276.md" deleted file mode 100644 index c8d2b494e0e2f9b14cbbdf72cbf2b9bcdfffbeab..0000000000000000000000000000000000000000 --- "a/02 \351\231\210\346\230\216\345\207\275/\350\247\206\345\233\276.md" +++ /dev/null @@ -1,68 +0,0 @@ -````mysql -#第14章_视图的课后练习 - -USE view_db; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -CREATE VIEW employee_vu as -SELECT * from employees; - -#2. 显示视图的结构 -desc employee_vu; - -#3. 查询视图中的全部内容 -SELECT * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -CREATE or replace VIEW employee_vu as -SELECT * from employees WHERE department_id=80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -CREATE view emp_v1(姓名,工资,邮箱) as -SELECT CONCAT(first_name,last_name),salary,email from employees WHERE phone_number like '011%'; - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码 -CREATE or replace view emp_v1(姓名,邮箱,电话号码) as -SELECT CONCAT(first_name,last_name),email,phone_number from employees WHERE phone_number like '011%' and email like '%e%'; - - -#3. 向 emp_v1 插入一条记录,是否可以? -insert into emp_v1 VALUES -('jojo','maia','110110'); -不可以; - - - - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE employees set salary=salary+1000 WHERE email in (SELECT * from (SELECT 邮箱 from emp_v1) as a); - -#5. 删除emp_v1中姓名为Olsen的员工 -DELETE from emp_v1 WHERE 姓名 like '%Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -CREATE view emp_v2 as -SELECT department_id,max(salary) msa from employees GROUP BY department_id HAVING msa>12000; - - - - - -#7. 向 emp_v2 中插入一条记录,是否可以? -不可以; - - - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v2,emp_v1; -```` - diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230905 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" "b/03 \350\265\226\345\277\203\345\246\215/20230905 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" deleted file mode 100644 index 408ef39357e7478e9d342eef7ecf57b3e493e62c..0000000000000000000000000000000000000000 --- "a/03 \350\265\226\345\277\203\345\246\215/20230905 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" +++ /dev/null @@ -1,43 +0,0 @@ -## 大二会学习到的课程: - -### 数据库高级应用 - -数据控制语言DCL - -### JavaScript 编程基础(JavaScript 和 jQuery) - -### WEB 程序设计高级应用(MVC技术) - -MVC指MVC模式的某种框架,它强制性地使应用程序的输入、处理和输出分开 - -使用MVC应用程序被分成三个核心部件:模型、视图、控制器。它们各自处理自己的任务。最典型的MVC就是JSP + servlet + javabean的模式 - -### JavaScript 高级编程(Nodejs) - -Node.js 主要是用 C/C++ 编写的。作为一个运行 Web 服务器的程序,Node.js 需要不断地与设备的操作系统进行交互 - -使用像 C 这样的低级语言构建 Node.js 使软件可以轻松访问操作系统的资源并使用它们来执行指令 - -但是 Node.js 的工作方式涉及更多的复杂问题。Node.js 运行快速高效的 Web 服务器,但它究竟是如何做到的呢?本节介绍 Node.js 用于实现其效率的过程 - -### 网页设计高级应用(Vue技术和应用) - -Vue (发音为 /vjuː/,类似 **view**) 是一款用于构建用户界面的 JavaScript 框架。它基于标准 HTML、CSS 和 JavaScript 构建,并提供了一套声明式的、组件化的编程模型,帮助你高效地开发用户界面 - -### 企业级架构技术应用(WebApi 技术) - -WebAPI是一个简单的构建HTTP服务的新框架,用于对接各种客户端(浏览器,移动设备),在.Net平台上,WebAPI是一个开源的、理想的、构建REST-ful服务的技术 - -### Linux 操作系统基础应用 - - - -## 学习专业知识的网站: - -gitee - -github - -csdn - -bilibili \ No newline at end of file diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230907 \346\225\260\346\215\256\345\272\223\344\270\211\345\244\247\350\214\203\345\274\217.md" "b/03 \350\265\226\345\277\203\345\246\215/20230907 \346\225\260\346\215\256\345\272\223\344\270\211\345\244\247\350\214\203\345\274\217.md" deleted file mode 100644 index b8c84c62a76b331cee3f0732b848bc3fa8d42f94..0000000000000000000000000000000000000000 --- "a/03 \350\265\226\345\277\203\345\246\215/20230907 \346\225\260\346\215\256\345\272\223\344\270\211\345\244\247\350\214\203\345\274\217.md" +++ /dev/null @@ -1,138 +0,0 @@ -## 数据库三大范式(规则) - -### 第一范式 - -要求字段内容不可再分割,为保证数据原子性 - -例如地址信息表,一个地址可以拆分为省、市、区、街道和详细地址 - -### 第二范式 - -要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 - -例如成绩表,学生学号和课程编号在成绩表中缺一不可 - -| 学号 | 姓名 | 年龄 | 课程名称 | 成绩 | 学分 | -| ---- | ---- | ---- | -------- | ---- | ---- | -| | | | | | | - -1. 假设学号是表中的唯一主键,那由学号就可以确定姓名和年龄了,但是却不能确定课程名称和成绩 - -2. 假设课程名称是表中的唯一主键,那由课程名称就可以确定学分了,但是却不能确定姓名、年龄和成绩 - -3. 虽然通过学号和课程名称的联合主键,可以确定除联合主键外的所有的非主键值,但是基于上述两个假设,也不符合第二范式的要求 - -所以把表拆分开才会符合第二范式的要求 - -学生表 - 学号做主键 - -课程表 - 课程名称做主键 - -成绩表 - 学号和课程名称做联合主键 - -### 第三范式 - -满足第二范式的前提,要求非主键属性要直接依赖于主键 - -| 学号 | 姓名 | 班级 | 班主任 | -| ---- | ---- | ---- | ------ | -| | | | | - -这个表中,学号是主键,它可以唯一确定姓名、班级、班主任,符合了第二范式,但是在非主键字段中,我们也可以通过班级推导出该班级的班主任,所以它是不符合第三范式的 - -学生表 - -| 学号 | 姓名 | 班级 | -| ---- | ---- | ---- | -| | | | - -班级表 - -| 班级 | 班主任 | -| ---- | ------ | -| | | - -通过把班级与班主任的映射关系另外做成一张映射表,我们就成功地消除了表中的传递依赖了 - -```mysql -create database school charset utf8; - -use school; - -# 院系 -create table department( - de_id int primary key auto_increment, - de_name varchar(10) -); - -# 专业 -create table major( - ma_id int primary key auto_increment, - ma_name varchar(10), - de_id int, - foreign key (de_id) references department(de_id) -); - -# 班级 -create table clazz( - cla_id int primary key auto_increment, - cla_name varchar(10), - ma_id int, - foreign key (ma_id) references major(ma_id) -); - -# 学生 -create table student( - st_id int primary key auto_increment, - st_name varchar(10), - st_sex char(1), - cla_id int, - foreign key (cla_id) references clazz(cla_id) -); - -# 课程 -create table course( - cou_id int primary key auto_increment, - cou_name varchar(10), - t_id int, - foreign key (t_id) references teacher (t_id) -); - -# 学生+课程 -create table performance( - id int primary key auto_increment, - st_id int, - foreign key (st_id) references student(st_id), - cou_id int, - foreign key (cou_id) references course(cou_id), - score int -); - -# 教师 -create table teacher( - t_id int primary key auto_increment, - t_name varchar(10) -); - -# 教室 -create table classroom( - r_id int primary key auto_increment, - r_nsme varchar(10) -); - -# 班级+课程+教室+教室 -create table timetable( - time_id int primary key auto_increment, - time varchar(255), - cla_id int, - foreign key (cla_id) references clazz(cla_id), - cou_id int, - foreign key (cou_id) references course(cou_id), - t_id int, - foreign key (t_id) references teacher (t_id), - r_id int , - foreign key (r_id) references classroom (r_id) -); - -``` - diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230908 powerdesigner.md" "b/03 \350\265\226\345\277\203\345\246\215/20230908 powerdesigner.md" deleted file mode 100644 index 5efb452859cebf9469bbb072a757274d8d1f76dd..0000000000000000000000000000000000000000 --- "a/03 \350\265\226\345\277\203\345\246\215/20230908 powerdesigner.md" +++ /dev/null @@ -1,130 +0,0 @@ -## powerdesigner - -第一步:创建概念模型图(CDM)以用户角度 - -第二步:转换逻辑模型图(LDM)以计算机角度 - -第三步:转换物理模型图(PDM)以数据角度 - -第四步:生成DDL - -表与表的关系:一个表里的几条记录对应另一个表的几条记录 - -数据库范式在实际中不会完全按照范式,根据需求实际操作 - -## 题目:图书管理系统 - -```mysql -create database lib charset utf8; - -use lib; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/10 18:25:47 */ -/*==============================================================*/ - - -drop table if exists administrator; - -drop table if exists book; - -drop table if exists reader; - -drop table if exists stacks; - -drop table if exists system; - -drop table if exists type; - -/*==============================================================*/ -/* Table: administrator */ -/*==============================================================*/ -create table administrator -( - a_id char(10) not null, - a_name char(5) not null, - primary key (a_id) -); - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - b_id int not null auto_increment, - b_name varchar(10) not null, - author varchar(5) not null, - publication varchar(10) not null, - b_num int not null, - primary key (b_id) -); - -/*==============================================================*/ -/* Table: reader */ -/*==============================================================*/ -create table reader -( - r_id int not null auto_increment, - r_name char(5) not null, - r_sex char(1) not null, - r_age int not null, - primary key (r_id) -); - -/*==============================================================*/ -/* Table: stacks */ -/*==============================================================*/ -create table stacks -( - s_id int not null auto_increment, - b_id int not null, - s_name varchar(5) not null, - s_address varchar(5) not null, - primary key (s_id) -); - -/*==============================================================*/ -/* Table: system */ -/*==============================================================*/ -create table system -( - date_id int not null auto_increment, - b_id int not null, - r_id int not null, - a_id char(10) not null, - borrow date not null, - `return` date not null, - actual date, - primary key (date_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - b_id int not null, - type_name varchar(3) not null, - primary key (type_id) -); - -alter table stacks add constraint FK_deposit foreign key (b_id) - references book (b_id) on delete restrict on update restrict; - -alter table system add constraint FK_Relationship_3 foreign key (b_id) - references book (b_id) on delete restrict on update restrict; - -alter table system add constraint FK_Relationship_4 foreign key (r_id) - references reader (r_id) on delete restrict on update restrict; - -alter table system add constraint FK_manage foreign key (a_id) - references administrator (a_id) on delete restrict on update restrict; - -alter table type add constraint FK_categorize foreign key (b_id) - references book (b_id) on delete restrict on update restrict; - - -``` - diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230912 \350\261\206\347\223\243\347\224\265\345\275\261.jpg" "b/03 \350\265\226\345\277\203\345\246\215/20230912 \350\261\206\347\223\243\347\224\265\345\275\261.jpg" deleted file mode 100644 index 2e8e540d7b6145888c74421a4fdcae69456ba584..0000000000000000000000000000000000000000 Binary files "a/03 \350\265\226\345\277\203\345\246\215/20230912 \350\261\206\347\223\243\347\224\265\345\275\261.jpg" and /dev/null differ diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230912 \350\261\206\347\223\243\347\224\265\345\275\261.md" "b/03 \350\265\226\345\277\203\345\246\215/20230912 \350\261\206\347\223\243\347\224\265\345\275\261.md" deleted file mode 100644 index 0506836078e065ae1626e4efbbc5535b8a260cd5..0000000000000000000000000000000000000000 --- "a/03 \350\265\226\345\277\203\345\246\215/20230912 \350\261\206\347\223\243\347\224\265\345\275\261.md" +++ /dev/null @@ -1,240 +0,0 @@ -## 豆瓣电影 - -```mysql -create database movie charset utf8; - -use movie; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 18:59:50 */ -/*==============================================================*/ - -drop table if exists account; - -drop table if exists actor; - -drop table if exists `comment`; - -drop table if exists country; - -drop table if exists director; - -drop table if exists `language`; - -drop table if exists member; - -drop table if exists movie; - -drop table if exists screenwriter; - -drop table if exists `show`; - -drop table if exists type; - -/*==============================================================*/ -/* Table: account */ -/*==============================================================*/ - -# 账户 -create table account -( - accoout_id int not null auto_increment, - account_name varchar(5) not null, - account_sex char(1), - account_distrct varchar(5), # 账户地区 - account_label varchar(10), # 个性签名 - primary key (accoout_id) -); - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - member_id int not null, - movie_id int not null, - primary key (member_id, movie_id) -); - -/*==============================================================*/ -/* Table: comment */ -/*==============================================================*/ - -#评论 -create table `comment` -( - comment_id int not null auto_increment, - accoout_id int not null, - comment_state char(2), # 想看/看过 - comment_label varchar(3), # 标签 - comment_name varchar(50), # 内容 - comment_radio char(1) not null, # 是否放入广播 - comment_starts int not null, # 评星 - primary key (comment_id) -); - -/*==============================================================*/ -/* Table: country */ -/*==============================================================*/ -create table country -( - country_id int not null auto_increment, - country_name varchar(5) not null, - primary key (country_id) -); - -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - member_id int not null, - movie_id int not null, - primary key (member_id, movie_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table `language` -( - language_id int not null auto_increment, - language_name varchar(3) not null, - primary key (language_id) -); - -/*==============================================================*/ -/* Table: member */ -/*==============================================================*/ - -# 主要人员 -create table member -( - member_id int not null auto_increment, - member_name varchar(10) not null, - member_sex char(1) not null, - member_constellation char(3) not null, # 星座 - member_born date not null, # 出生日期 - member_job varchar(2) not null, - member_foreign varchar(50), # 更多外国名 - member_chinese varchar(10), # 更多中国名 - family varchar(20), #家庭情况 - imdb_id char(9) not null, - primary key (member_id) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_id int not null auto_increment, - type_id int not null, - country_id int not null, - language_id int not null, - movie_name varchar(10) not null, - movie_date date not null, - movie_time int not null, - movie_name_2 varchar(10) not null, # 别名 - IMDb char(10) not null, - primary key (movie_id) -); - -/*==============================================================*/ -/* Table: screenwriter */ -/*==============================================================*/ -create table screenwriter -( - member_id int not null, - movie_id int not null, - primary key (member_id, movie_id) -); - -/*==============================================================*/ -/* Table: show */ -/*==============================================================*/ -create table `show` -( - id int not null, - movie_id int not null, - comment_id int not null, - movie_score numeric(2,1) not null, - comment_num int not null, - primary key (id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name char(2) not null, - primary key (type_id) -); - -alter table actor add constraint FK_movie_member3 foreign key (member_id) - references member (member_id) on delete restrict on update restrict; - -alter table actor add constraint FK_movie_member6 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table `comment` add constraint FK_comment foreign key (accoout_id) - references account (accoout_id) on delete restrict on update restrict; - -alter table director add constraint FK_movie_member1 foreign key (member_id) - references member (member_id) on delete restrict on update restrict; - -alter table director add constraint FK_movie_member4 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table movie add constraint FK_country_movie foreign key (country_id) - references country (country_id) on delete restrict on update restrict; - -alter table movie add constraint FK_language_movie foreign key (language_id) - references language (language_id) on delete restrict on update restrict; - -alter table movie add constraint FK_type_movie foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table screenwriter add constraint FK_movie_member2 foreign key (member_id) - references member (member_id) on delete restrict on update restrict; - -alter table screenwriter add constraint FK_movie_member5 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table `show` add constraint FK_Relationship_12 foreign key (comment_id) - references comment (comment_id) on delete restrict on update restrict; - -alter table `show` add constraint FK_movie_comment foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -INSERT INTO `account` VALUES (1, '伊恩', NULL, NULL, NULL); -INSERT INTO `account` VALUES (2, '艾小柯', NULL, '澳大利亚', NULL); -INSERT INTO `account` VALUES (3, '麻辣小龙虾', NULL, '广东', NULL); - -INSERT INTO `member` VALUES (1, '乌尔善', '男', '双子座', '1972-06-10', '导演', 'Uragshaa', ' U23(昵称)', '蒙柯卓兰(妻)', 'nm4069612'); -INSERT INTO `member` VALUES (2, '冉平', '男', '双子座', '1953-06-10', '编剧', NULL, NULL, '冉甲男(女)', 'nm3220563'); -INSERT INTO `member` VALUES (3, '费翔', '男', '摩羯座', '1960-12-24', '演员', NULL, NULL, NULL, 'nm1191525'); - -INSERT INTO `country` VALUES (1, '中国大陆'); - -INSERT INTO `language` VALUES (1, '汉语'); - -INSERT INTO `type` VALUES (1, '动作'); - -INSERT INTO `movie` VALUES (1, 1, 1, 1, '封神第一部:朝歌风云', '2023-07-20', 148, '封神第一部', 'tt6979756'); - -INSERT INTO `comment` VALUES (1, 3, '看过', NULL, '太好看了', '否', 5); - -INSERT INTO `director` VALUES (1, 1); - -INSERT INTO `screenwriter` VALUES (2, 1); - -INSERT INTO `actor` VALUES (3, 1); - -INSERT INTO `show` VALUES (1, 1, 1, 7.9, 860010); - -``` - diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230913 \345\214\273\351\231\242.jpg" "b/03 \350\265\226\345\277\203\345\246\215/20230913 \345\214\273\351\231\242.jpg" deleted file mode 100644 index 0106173c243bf52f78550abc819a5d7d81aa036b..0000000000000000000000000000000000000000 Binary files "a/03 \350\265\226\345\277\203\345\246\215/20230913 \345\214\273\351\231\242.jpg" and /dev/null differ diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230914 \345\244\215\344\271\240.md" "b/03 \350\265\226\345\277\203\345\246\215/20230914 \345\244\215\344\271\240.md" deleted file mode 100644 index 0a557bb54d569247bcbbdd061540dc5880fd986e..0000000000000000000000000000000000000000 --- "a/03 \350\265\226\345\277\203\345\246\215/20230914 \345\244\215\344\271\240.md" +++ /dev/null @@ -1,9 +0,0 @@ -今日的课程是复习ER图(医院案例) - -可以使用这个网址复习: - -[数据库 E-R图实例_数据库er图例题详解-CSDN博客](https://blog.csdn.net/diviner_s/article/details/106179701) - -[【数据库E-R图知识点和相关习题(复试真题)】_e—r模型的题及答案_Penroseblog的博客-CSDN博客](https://blog.csdn.net/qq_44875230/article/details/123584355?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-1-123584355-blog-106179701.235^v38^pc_relevant_anti_t3&spm=1001.2101.3001.4242.2&utm_relevant_index=4) - -网上多找找案例动手试试看 \ No newline at end of file diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230915 \346\261\275\350\275\246\351\224\200\345\224\256.jpg" "b/03 \350\265\226\345\277\203\345\246\215/20230915 \346\261\275\350\275\246\351\224\200\345\224\256.jpg" deleted file mode 100644 index f198dd1b74a2f6b1debd011eb50568f0d6c077ea..0000000000000000000000000000000000000000 Binary files "a/03 \350\265\226\345\277\203\345\246\215/20230915 \346\261\275\350\275\246\351\224\200\345\224\256.jpg" and /dev/null differ diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230919 mysql\345\244\215\344\271\240.md" "b/03 \350\265\226\345\277\203\345\246\215/20230919 mysql\345\244\215\344\271\240.md" deleted file mode 100644 index a67717484de50bbada6132484398c0de3ed1a6a5..0000000000000000000000000000000000000000 --- "a/03 \350\265\226\345\277\203\345\246\215/20230919 mysql\345\244\215\344\271\240.md" +++ /dev/null @@ -1,765 +0,0 @@ -## mysql复习 - -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不null,就保持原值 - -limit 起始数,显示数 - -desc 库名:显示表结构 - -length(email):email的字节长度 - -#### 自然连接 - -表,表 where 字段=字段 and 字段=字段 - -#### 联表区间 - -表 left join 表 on 表.字段 between 表.字段 and 表.字段(不支持别名) - -#### 自连接 - -inner join - -not in(条件,条件) - -!(between 20 and 50) - -### 建库建表 - -```mysql -create database db1 charset utf8; - -use db1; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; -``` - -### 查询语句 - -```mysql -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -select sum(12*salary) from employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - -select sum(salary*12+ifnull(salary*commission_pct*12,0)) from employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - -select distinct job_id from employees; - -# 3.查询工资大于12000的员工姓名和工资 - -select first_name,salary from employees where salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 - -select first_name,department_id from employees where employee_id=176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -select first_name,salary from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select first_name,department_id from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -select first_name,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select employee_id,salary,grade_level from employees e left join job_grades j on e.salary between j.lowest_sal and j.highest_sal where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select * from employees where first_name like '__尔'; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -select * from employees where last_name like '%特%' and last_name like '%尔%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select * from employees where first_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select e.first_name,j.job_title from employees e left join jobs j on e.job_id=j.job_id where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select first_name,salary,manager_id from employees where manager_id in (100,101,110); - -#第05章_排序与分页的课后练习 - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - -select first_name,department_id,salary*12 from employees order by salary*12 desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select first_name,salary from employees where salary not between 8000 and 17000 order by salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -select * from employees where email like '%e%' order by length(email) desc,department_id asc; - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - -select first_name,e.department_id,department_name from employees e left join departments d on e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -select e.job_id,d.location_id from employees e left join departments d on e.department_id=d.department_id where e.department_id=90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select e.last_name,d.department_name,d.location_id,l.city from employees e left join departments d on e.department_id=d.department_id left join locations l on d.location_id=l.location_id where commission_pct is not null; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select e.last_name,e.job_id,d.department_id,d.department_name from employees e left join departments d on e.department_id=d.department_id left join locations l on d.location_id=l.location_id where l.city='多伦多'; - -#sql92语法(自然连接): - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -select department_name,street_address,first_name,job_title,salary from jobs j,employees e,departments d,locations l where j.job_id=e.job_id and e.department_id=d.department_id and d.location_id=l.location_id and department_name='行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select e.first_name,e.employee_id,s.last_name,s.employee_id from employees e inner join employees s on e.employee_id=s.employee_id; - -# 7.查询哪些部门没有员工 - -select department_name from departments d left join employees e on d.department_id=e.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - -select city from departments d right join locations l on d.location_id=l.location_id where department_id is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select e.* from departments d,employees e where d.department_id=e.department_id and d.department_name='销售部' or d.department_name='信息技术部'; - -# 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - -select max(salary),min(salary),avg(salary),sum(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - -select job_id,max(salary),min(salary),avg(salary),sum(salary) from employees group by job_id; - -#4.选择各个job_id的员工人数 - -select job_id,count(employee_id) from employees group by job_id; - -# 5.查询员工最高工资和最低工资的差距 - -select max(salary)-min(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - -select manager_id,min(salary) from employees where manager_id is not null group by manager_id having min(salary)>6000; - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name,d.location_id,count(employee_id),avg(salary) from departments d left join employees e on d.department_id=e.department_id group by d.department_id order by avg(salary) desc; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select j.job_title,min(salary),department_name from jobs j left join employees e on j.job_id=e.job_id left join departments d on e.department_id=d.department_id group by j.job_id,d.department_id; - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - -select * from employees where department_id =(select department_id from employees where last_name='兹洛特基') and salary=(select salary from employees where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - -select employee_id,first_name,salary from employees where salary>(select avg(salary) from employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name,job_id,salary from employees where salary>(select max(salary) from employees where JOB_ID = 'SA_MAN'); - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -select employee_id,last_name from employees where department_id=(select department_id from employees where last_name like '%u%'); - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -select first_name,employee_id from employees where department_id in (select department_id from departments where location_id=1700); - -#6.查询管理者是 金 的员工姓名和工资 - -select first_name,salary from employees where manager_id in (select manager_id from employees where last_name='金'); - -#7.查询工资最低的员工信息: last_name, salary - -select last_name,salary from employees where salary=(select min(salary) from employees); - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 - -select * from departments where department_id =(select department_id from employees group by department_id having avg(salary)=(select min(s) from (select avg(salary) s from employees group by department_id) a)); - -#方式2: -# 部门平均<= 公司所有平均 - -select * from departments where department_id=(select department_id from employees group by department_id having avg(salary)<=all(select avg(salary) from employees group by department_id)); - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - -select d.*,(select avg(salary) from employees where department_id=d.department_id) from departments d where department_id =(select department_id from employees group by department_id having avg(salary)=(select min(s) from (select avg(salary) s from employees group by department_id) a)); - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -select * from jobs where job_id=(select job_id from employees group by job_id having avg(salary)=(select max(s) from (select avg(salary) s from employees group by job_id) a)); - -#方式2:平均工资>=所有平均工资 - -select * from jobs where job_id=(select job_id from employees group by job_id having avg(salary)>=all(select avg(salary) from employees group by job_id)); - -#11.查询平均工资高于公司平均工资的部门有哪些? - -select department_id from employees where department_id is not null group by department_id having avg(salary)>(select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - -select e.* from employees e inner join employees s on e.employee_id=s.manager_id; - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - -select * from employees where employee_id=any(select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - -select min(salary) from employees group by department_id having max(salary)<=all(select max(salary) from employees group by department_id); - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary - -select last_name,department_id,email,salary from employees where department_id = (select department_id from employees group by department_id having avg(salary)>=all(select avg(salary) from employees group by department_id)); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 - -select department_id from departments where department_id !=all(select department_id from employees where job_id='ST_CLERK'); - -#16. 选择所有没有管理者的员工的last_name - -select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - -select employee_id,first_name,hire_date,salary from employees e where e.manager_id=(select employee_id from employees where first_name = 'De Haan'); - -#方式2: - -select employee_id, last_name, hire_date, salary from employees e where exists(select * from employees s where e.employee_id=s.manager_id and s.first_name='De Haan'); - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - -select employee_id,last_name,salary from employees e1 where salary > (select avg(salary) from employees e2 where e2.department_id = e1.department_id); - -#方式2:在FROM中声明子查询 - -select employee_id,last_name,salary from employees e1,(select department_id,AVG(salary) s from employees e2 group by department_id) a where e1.department_id = a.department_id and e1.salary > a.s; - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - -select department_name,department_id from departments d where 5 < (select count(*) from employees e where d.department_id = e.department_id); - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -select country_id from locations l where 2 < (select count(*) from departments d where l.location_id=d.location_id); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - -``` - diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230920 RBAC.jpg" "b/03 \350\265\226\345\277\203\345\246\215/20230920 RBAC.jpg" deleted file mode 100644 index 9c6f26de7fa38642c729a1cf3a50365abcd3da61..0000000000000000000000000000000000000000 Binary files "a/03 \350\265\226\345\277\203\345\246\215/20230920 RBAC.jpg" and /dev/null differ diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230920 RBAC.md" "b/03 \350\265\226\345\277\203\345\246\215/20230920 RBAC.md" deleted file mode 100644 index 2da60fe7bb19427e785416fcb3aadc8aaa552adc..0000000000000000000000000000000000000000 --- "a/03 \350\265\226\345\277\203\345\246\215/20230920 RBAC.md" +++ /dev/null @@ -1,157 +0,0 @@ -## RBAC(Role-Based Access Control) - -一种数据库设计思想,基于角色的访问权限管制模型,目前权限的主流方案,核心为角色 - -在 RBAC 模型里面,有3个基础组成部分,分别是:用户、角色和权限 - -- User(用户):每个用户都有唯一的UID识别,并被授予不同的角色 -- Role(角色):不同角色具有不同的权限 -- Permission(权限):访问权限 -- 用户-角色映射:用户和角色之间的映射关系 -- 角色-权限映射:角色和权限之间的映射 - -管理员和普通用户被授予不同的权限,普通用户只能去修改和查看个人信息,而不能创建用户和冻结用户,而管理员由于被授予所有权限,所以可以做所有操作 - -## 预习 SKU - -SKU 英文全称为Stock Keeping Unit,简称 SKU ,是产品入库后一种编码归类方法,也是库存控制的最小单位。一款商品,每个颜色,每个尺码,每一型号等都有出现一个 sku ,便于电商品牌识别商品。 - -既然 sku 被定义为最小存货单元,商家就可以选择自己设定 sku,一般来说是以件、盒、个、托盘等为单位。 - -- 大厂的 sku 就可以是一箱, -- 超市的 sku 就可以是一盒, -- 零售商的 sku 可以是一个。 - -## RBAC练习 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:30:32 */ -/*==============================================================*/ -create database school charset utf8; - -use school; - -drop table if exists management; - -drop table if exists role; - -drop table if exists role_management; - -drop table if exists user; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: management */ -/*==============================================================*/ -create table management -( - management_id int not null auto_increment, - management_name varchar(10) not null, - managemen_comment varchar(50) not null, - management_type char(10) not null, - primary key (management_id) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name varchar(3) not null, - role_comment char(10) not null, - primary key (role_id) -); - -/*==============================================================*/ -/* Table: role_management */ -/*==============================================================*/ -create table role_management -( - management_id int not null, - role_id int not null, - primary key (management_id, role_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_name varchar(5) not null, - user_pwd char(6) not null, - primary key (user_id) -); - -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - role_id int not null, - user_id int not null, - primary key (role_id, user_id) -); - -alter table role_management add constraint FK_role_management foreign key (management_id) - references management (management_id) on delete restrict on update restrict; - -alter table role_management add constraint FK_role_management2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - - - --- ---------------------------- --- Records of management --- ---------------------------- -INSERT INTO `management` VALUES (1, '学生信息'); -INSERT INTO `management` VALUES (2, '教师信息'); -INSERT INTO `management` VALUES (3, '工资信息'); -INSERT INTO `management` VALUES (4, '首页'); - --- ---------------------------- --- Records of role --- ---------------------------- -INSERT INTO `role` VALUES (1, '校长'); -INSERT INTO `role` VALUES (2, '教师'); -INSERT INTO `role` VALUES (3, '学生'); - --- ---------------------------- --- Records of role_management --- ---------------------------- -INSERT INTO `role_management` VALUES (1, 1); -INSERT INTO `role_management` VALUES (2, 1); -INSERT INTO `role_management` VALUES (3, 1); -INSERT INTO `role_management` VALUES (4, 1); -INSERT INTO `role_management` VALUES (1, 2); -INSERT INTO `role_management` VALUES (2, 2); -INSERT INTO `role_management` VALUES (4, 2); -INSERT INTO `role_management` VALUES (1, 3); -INSERT INTO `role_management` VALUES (4, 3); --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '一一', '123456'); -INSERT INTO `user` VALUES (2, '二二', '123456'); -INSERT INTO `user` VALUES (3, '三三', '123456'); -INSERT INTO `user` VALUES (4, '四四', '123456'); - --- ---------------------------- --- Records of user_role --- ---------------------------- -INSERT INTO `user_role` VALUES (1, 1); -INSERT INTO `user_role` VALUES (2, 2); -INSERT INTO `user_role` VALUES (2, 3); -INSERT INTO `user_role` VALUES (3, 4); -``` - diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230921 SKU \344\270\216 SPU.md" "b/03 \350\265\226\345\277\203\345\246\215/20230921 SKU \344\270\216 SPU.md" deleted file mode 100644 index f002f0d628edca9c0ef6d91de2fb16f4882ef0d0..0000000000000000000000000000000000000000 --- "a/03 \350\265\226\345\277\203\345\246\215/20230921 SKU \344\270\216 SPU.md" +++ /dev/null @@ -1,144 +0,0 @@ -## SKU - -SKU是指一款商品,每款都有出现一个SKU。一款商品多色,则是有多个SKU, - -例:一件衣服,有红色、白色、蓝色。 - -对一种商品而言,当其品牌、型号、配置、等级、花色、包装容量、单位、生产日期、保质期、用途、价格、产地等属性与其他商品存在不同时,可称为一个单品。 - -## SPU与SKU的区别 - -一般SPU 与SKU 是一对一,或者一对多的关系;如果一对多的话就是不同的规格 - -例子:SPU就是商品的“款”;SKU就是商品的“件” - -SPU指一个商品集合,一般来说就是一个集合链。一个服装的集合链会包括相似款式和不同的尺码,SKU则是最小品类单元,同一个款式的衣服不同的尺码也算不同的SKU。SKU多见于前台的商品编号,SPU多见于后台的商品管理 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:31:44 */ -/*==============================================================*/ -create database goods charset utf8; - -use goods; - -drop table if exists type; - -drop table if exists sku; - -drop table if exists sku_type_value; - -drop table if exists spu; - -drop table if exists `value`; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name varchar(10) not null, - primary key (type_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int not null, - sku_caption varchar(40) not null, - sku_price numeric(4,0) not null, - sku_num int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: sku_attribute_value */ -/*==============================================================*/ -create table sku_type_value -( - relevance_id int not null auto_increment, - sku_id int not null, - value_id int not null, - type_id int not null, - primary key (relevance_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_comment varchar(50) not null, - primary key (spu_id) -); - -/*==============================================================*/ -/* Table: value */ -/*==============================================================*/ -create table `value` -( - value_id int not null auto_increment, - value_name varchar(10) not null, - primary key (value_id) -); - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -alter table sku_type_value add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table sku_type_value add constraint FK_Relationship_3 foreign key (value_id) - references value (value_id) on delete restrict on update restrict; - -alter table sku_type_value add constraint FK_Relationship_4 foreign key (type_id) - references attribute (type_id) on delete restrict on update restrict; - - - -INSERT INTO `spu` VALUES (1, '华为 Mate 60 Pro', '同心聚力 美学新生'); - -INSERT INTO `type` VALUES (1, '颜色'); -INSERT INTO `type` VALUES (2, '容量'); - -INSERT INTO `value` VALUES (1, '雅川青'); -INSERT INTO `value` VALUES (2, '雅丹黑'); -INSERT INTO `value` VALUES (3, '南糯紫'); -INSERT INTO `value` VALUES (4, '白沙银'); -INSERT INTO `value` VALUES (5, '12GB+512GB'); -INSERT INTO `value` VALUES (6, '12GB+1TB'); - -INSERT INTO `sku` VALUES (1, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+1TB 雅丹黑', 7999, 10); -INSERT INTO `sku` VALUES (2, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+1TB 雅川青', 7999, 10); -INSERT INTO `sku` VALUES (3, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+1TB 南糯紫', 7999, 10); -INSERT INTO `sku` VALUES (4, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+1TB 白沙银', 7999, 10); -INSERT INTO `sku` VALUES (5, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+512TB 雅丹黑', 6999, 10); -INSERT INTO `sku` VALUES (6, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+512TB 雅川青', 6999, 10); -INSERT INTO `sku` VALUES (7, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+512TB 南糯紫', 6999, 10); -INSERT INTO `sku` VALUES (8, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+512TB 白沙银', 6999, 10); - -INSERT INTO `sku_type_value` VALUES (1, 2, 1, 2); -INSERT INTO `sku_type_value` VALUES (2, 2, 2, 6); -INSERT INTO `sku_type_value` VALUES (3, 1, 1, 1); -INSERT INTO `sku_type_value` VALUES (4, 1, 2, 6); -INSERT INTO `sku_type_value` VALUES (5, 3, 1, 3); -INSERT INTO `sku_type_value` VALUES (6, 3, 2, 6); -INSERT INTO `sku_type_value` VALUES (7, 4, 1, 4); -INSERT INTO `sku_type_value` VALUES (8, 4, 2, 6); -INSERT INTO `sku_type_value` VALUES (9, 5, 1, 2); -INSERT INTO `sku_type_value` VALUES (10, 5, 2, 5); -INSERT INTO `sku_type_value` VALUES (11, 6, 1, 1); -INSERT INTO `sku_type_value` VALUES (12, 6, 2, 5); -INSERT INTO `sku_type_value` VALUES (13, 7, 1, 3); -INSERT INTO `sku_type_value` VALUES (14, 7, 2, 5); -INSERT INTO `sku_type_value` VALUES (15, 8, 1, 4); -INSERT INTO `sku_type_value` VALUES (16, 8, 2, 5); -``` - diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230921 SKU \344\270\216 SPU.png" "b/03 \350\265\226\345\277\203\345\246\215/20230921 SKU \344\270\216 SPU.png" deleted file mode 100644 index c64680f7fa21cf7029f75e743197ff4905075595..0000000000000000000000000000000000000000 Binary files "a/03 \350\265\226\345\277\203\345\246\215/20230921 SKU \344\270\216 SPU.png" and /dev/null differ diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230922 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" "b/03 \350\265\226\345\277\203\345\246\215/20230922 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" deleted file mode 100644 index 7bd61c3e63181202552732adbcd3d63425f63e32..0000000000000000000000000000000000000000 --- "a/03 \350\265\226\345\277\203\345\246\215/20230922 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" +++ /dev/null @@ -1,130 +0,0 @@ -## 数据库高级预习 - -当数据库复杂需要多条 SQL 语句查询时,可以使用存储过程去完成这个需求。 - -### 创建存储过程语法 - -使用 create procedure 语句创建存储过程 - -#### 声明语句结束符 - -```mysql -delimiter $$ - -delimiter // -``` - -#### 创建 mysql 存储过程、存储函数 - -```mysql -create procedure 存储过程名(参数) -``` - -#### 存储过程体 - -```mysql -create function 存储函数名(参数) -``` - -#### 参数类型有三种: - -```mysql -IN: 输入参数,该参数的值必须在调用该存储过程时指定,在存储过程内部使用, 不能返回。 - -缺省值是IN。 - -OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - -INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回。 -``` - -### 事务 - - 为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - -#### 事务的四个特性 - -原子性:事务包含的这一系列操作,要么全部成功,要么全部失败(由DBMS的事务管理子系统来实现)。 - -一致性:事务完成之后,不会将非法的数据写入数据库(由DBMS的完整性子系统执行测试任务)。 - -隔离性:多个事务可以在一定程度上并发执行(由DBMS的并发控制子系统实现)。 - -持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上)(由DBMS的恢复管理子系统实现的)。 - -#### 隔离级别 - - 隔离级别从低到高依次是"读未提交"、“读已提交”、“可重复读取”和“序列化”,隔离级别越高,性能越低。mysql 数据库默认隔离级别是“可重复读取”,oracle是“读已提交”。数据库底层使用的“加锁”的机制来实现不同的隔离级别,包括对整个表加锁,对表中的行加锁。 - -### 视图 - -在已有的表或者视图上创建的虚拟表。 - -#### 创建视图 - -```mysql -create view 视图名 as select -``` - -注:可以对单表或者多表进行查询,数据库会将视图的定义保存下来。 - -可以对(单表)视图进行一些增删改查操作,这些操作会影响到原始的表。 - -#### 删除视图 - -```mysql -drop view 视图名 -``` - -### 索引 - - 为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - - 注:索引类似于一本书的目录 - -#### 创建索引 - -```mysql -create index 索引名 on 表名(字段列表) -``` - -在经常作为查询条件的字段加索引,除此以外,还要在分组、过滤、排序及联合查询的字段上加索引。 - -#### 删除索引 - -```mysql -drop index 索引名 on 表名 -``` - -### 锁 - -共享锁(S锁,读锁)和排他锁(X锁,写锁)——行锁 - -``` -共享锁:若事务A 对某行数据加S锁,此时允许其他事务对该行数据加S锁,即可以有多个事务共同读取改行数 据,但是不允许其他事务对该数据加X锁 - -排他锁(X锁,写锁,独占锁):若事务A对某行数据加X锁,此时不允许其他事务对该行数据加任何锁 -``` - -数据库中 - -1. 数据库中进行增,删,改操作时,会自动给行添加排他锁,行数据添加上了排他锁,不允许其他事务对该行数据加任何锁 -2. 数据库中进行查(select)操作时,对数据不加任何锁 - -1. 给行数据手动添加共享锁: - - ```mysql - select ..from..lock in share mode - select..from .. for share - ``` - -2. 添加排他锁: - - ```mysql - select...from...for update - ``` - - - - - diff --git "a/04 \346\235\216\346\230\216\345\201\245/20230905 \345\244\247\344\272\214java\345\255\246\344\271\240\350\267\257\347\272\277.md" "b/04 \346\235\216\346\230\216\345\201\245/20230905 \345\244\247\344\272\214java\345\255\246\344\271\240\350\267\257\347\272\277.md" deleted file mode 100644 index b3f9a24598a1e0d91ac007dc1178b84badd37884..0000000000000000000000000000000000000000 --- "a/04 \346\235\216\346\230\216\345\201\245/20230905 \345\244\247\344\272\214java\345\255\246\344\271\240\350\267\257\347\272\277.md" +++ /dev/null @@ -1,33 +0,0 @@ -## 大二学习路线 - -### 大二上学期 - -#### 1. MySQL进阶(存储引擎、索引、SQL优化、存储过程、锁) - -#### 2. JavaScript (Ajax) - -#### 3. MVC框架(Maven,Spring,SpringMVC,MyBatis) - -### 大二下学期 - -#### 4. Node.js - -#### 5. Vue.js - -#### 6. SpringBoot (Redis,WebAPI) - -### 实训 - -#### 1.Linux 服务器 - -#### 2.中间件(项目中可能实现的技术) - -#### 3.小程序 ,uniapp移动端开发 - -### 技术栈: - -​ **一个项目需要用什么技术实现,可以称为技术栈。** - -### 技能数: - -​ **一个人具备的技能,称为技能树。** \ No newline at end of file diff --git "a/04 \346\235\216\346\230\216\345\201\245/20230907 \346\225\260\346\215\256\345\272\223\345\205\263\347\263\273.md" "b/04 \346\235\216\346\230\216\345\201\245/20230907 \346\225\260\346\215\256\345\272\223\345\205\263\347\263\273.md" deleted file mode 100644 index 7bb78fd25acb51d9174187b99ffe2b746e373d7f..0000000000000000000000000000000000000000 --- "a/04 \346\235\216\346\230\216\345\201\245/20230907 \346\225\260\346\215\256\345\272\223\345\205\263\347\263\273.md" +++ /dev/null @@ -1,150 +0,0 @@ -### 数据库关系 - -#### 1.关系是相互的 - -​ 比如,一个学生,可以选多个课程;一个课程可以被多个学生选,必须引用第三张表 - -#### 2.表之间的关系 - -1. 一对一:将其中任一表中的主键,放到另一张表当外键 -2. 一对多:将一所在的表的主键,放在多的表当外键 -3. 多对多:必须有第三张表,将前面两个表的主键放进来当外键 - -#### 3.ER图 - -​ ER图:实体关系图,简称E-R,用于显示实体集之间的关系。它提供了一种表示实体类型、属性、联系的方法。 - -​ ER图三要素:实体、属性、联系 - -#### 作业 - -~~~ mysql -# 创建学生数据库 -create database student charset utf8; -use student; - -# 创建院系表 -create table college( - co_id int primary key, - co_name varchar(50) not null -); -# 插入数据 -insert into college values -(1,"软件工程学院"), -(2,"财经商贸学院"), -(3,"信息工程学院"), -(4,"智能制造学院"); - -# 创建专业表 -create table major( - m_id int primary key, - m_name varchar(20) not null, - co_id int, - foreign key(co_id) references college(co_id) -); -# 插入数据 -insert into major values -(1,"前端开发",1), -(2,"后端开发",1), -(3,"人力财务管理",2), -(4,"大数据技术",3), -(5,"电气自动化技术",4); - -# 创建班级表 -create table class( - c_id int primary key, - c_name varchar(20) not null, - m_id int, - foreign key(m_id) references major(m_id) -); -# 插入数据 -insert into class values -(1,"软件技术2班",2), -(2,"软件技术7班",1), -(3,"人力财务管理1班",3), -(4,"大数据技术4班",4), -(5,"电气自动化技术3班",5); - -# 创建学生表 -create table student( - s_id int primary key, - s_name varchar(10) not null, - sex varchar(2) not null, - c_id int, - foreign key(c_id) references class(c_id) -); -# 插入数据 -insert into student values -(1,"卢亨耀","男",1), -(2,"李堔义","男",2), -(3,"王小丽","女",3), -(4,"孙泽傲","男",4), -(5,"方蔼雅","男",5); - -# 创建课程信息表 -create table course_inf( - c_id int primary key, - c_name varchar(10) not null -); -# 插入数据 -insert into course_inf values -(1,"MySQL高级"), -(2,"javaScript"), -(3,"财务管理"), -(4,"大数据"), -(5,"电气自动化"); - -# 创建教室表 -create table classroom( - cr_id int primary key, - address varchar(20) not null -); -# 插入数据 -insert into classroom values -(1,"望云楼实训室8"), -(2,"望云楼实训室6"), -(3,"岩声楼305"), -(4,"辛耕楼204"), -(5,"辛耕楼105"); - - -# 创建教师表 -create table teacher( - t_id int primary key, - t_name varchar(5) not null, - sex varchar(2) not null, - co_id int, - foreign key(co_id) references college(co_id) -); -# 插入数据 -insert into teacher values -(001,"丘老师","男",1), -(002,"王老师","男",1), -(003,"黄老师","女",2), -(004,"徐老师","男",3), -(005,"李老师","女",4); - -# 创建课程表(中间表) -create table course( - c_id int, - cr_id int, - t_id int, - s_id int, - foreign key(c_id) references course_inf(c_id), - foreign key(cr_id) references classroom(cr_id), - foreign key(t_id) references teacher(t_id), - foreign key(s_id) references student(s_id) -); -# 插入数据 -insert into course values -(1,1,1,1), -(2,2,2,2), -(3,3,3,3), -(4,4,4,4), -(5,5,5,5); - -# 查询 -select * from college co,major m,class cl,student s ,course c,course_inf ci,classroom cr,teacher t where co.co_id=m.co_id and m.m_id=cl.m_id and cl.c_id=s.c_id and s.s_id=c.s_id and ci.c_id=c.c_id and cr.cr_id=c.cr_id and t.t_id=c.t_id; - -~~~ - diff --git "a/04 \346\235\216\346\230\216\345\201\245/20230907 \346\225\260\346\215\256\345\272\223\347\232\204\350\214\203\345\274\217.md" "b/04 \346\235\216\346\230\216\345\201\245/20230907 \346\225\260\346\215\256\345\272\223\347\232\204\350\214\203\345\274\217.md" deleted file mode 100644 index 08a2b0a987eee843f5e4787c7d30f3800c2979b2..0000000000000000000000000000000000000000 --- "a/04 \346\235\216\346\230\216\345\201\245/20230907 \346\225\260\346\215\256\345\272\223\347\232\204\350\214\203\345\274\217.md" +++ /dev/null @@ -1,19 +0,0 @@ -### 数据库的范式 - -#### 1.第一范式: - -​ 要求字段的内容,不可再分割,为的是保证数据的原子性 - -​ 例:姓名,省份、城市、区具、地址址 - -#### 2.第二范式: - -​ 要求在满足第一范式的基础上,要求非主键字投要完全依赖主健(非主键雪完全依赖整个联合主键,而不只很赖部分) - -​ 例:小明的存在,必须要依靠父亲和母亲的存在 - -#### 3.第三范式: - -​ 满足第二范式的前提下,要求非主键属性要有接依赖于主键 - -​ 例:儿子依赖爸爸,爸爸依赖爷爷。其中儿子与爷爷属于间接依赖,则不属于第三范式,学生表中建议不要写专业,院级系,将他们分开写,否则将很难修改,还占内存 \ No newline at end of file diff --git "a/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" "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" deleted file mode 100644 index 7c7e920d0c797eb075db847d9f18ff030723dd99..0000000000000000000000000000000000000000 --- "a/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" +++ /dev/null @@ -1,111 +0,0 @@ -### 软件:PowerDesigner使用 - -#### 第一步:创建概念模型(类似ER图),以用户的角度。简称 CDM - -#### 第二步:将转概念模型换成逻辑模型,以计算机的角度。简称 LDM - -#### 第三步:将逻辑模型转换成物理模型,以数据库的角度。简称 PDM - -#### 第四步:生成DDL(生成数据库代码) - -![](https://s2.loli.net/2023/09/13/LalRAohJB6PNysQ.png) - -### 图书管理系统 - -~~~ mysql -#创建数据库并选择 -create database lib charset utf8; -use lib; - -#创建书架表 -create table bookshelf( - bs_id int primary key, - bs_type varchar(5) -); -#插入数据 -insert into bookshelf values -(1,"文学类"), -(2,"数理类"), -(3,"人文科学类"); - -#创建图书信息表 -create table book_info( - book_id varchar(3) primary key, - book_name varchar(15) not null, - bs_id int, - foreign key (bs_id) references bookshelf(bs_id) -); -#插入数据 -insert into book_info values -(101,"朝花夕拾",1), -(102,"高等数学",2), -(103,"MySQL从入门到起飞",2), -(104,"红楼梦",1), -(105,"物种起源",3); - -#创建图书管理员表 -create table librarian( - lr_id varchar(3) primary key, - lr_name varchar(5) not null, - bs_id int, - foreign key (bs_id) references bookshelf(bs_id) -); -#插入数据 -insert into librarian values -(001,"张三",1), -(002,"李四",2), -(003,"王五",3); - -#创建学生信息表 -create table student( - stu_id varchar(10) primary key, - stu_name varchar(5) not null, - sex varchar(1) not null, - college varchar(10) not null -); -#插入数据 -insert into student values -("2244310201","田霜笑","女","软件工程学院"), -("2244310202","丰博嘉","男","软件工程学院"), -("2244310203","阳文康","男","软件工程学院"), -("2244310204","孙曼蓉","女","软件工程学院"); - -#创建借阅表 -create table borrow( - bo_time varchar(10) not null, #借阅时间 - re_time varchar(10) not null, #需归还时间 - book_id varchar(3), #图书编号 - foreign key (book_id) references book_info(book_id), - stu_id varchar(10) not null, #学号 - foreign key (stu_id) references student(stu_id) -); -#插入数据 -insert into borrow values -("2023-09-08","2023-10-08",101,"2244310201"), -("2023-08-15","2023-09-15",103,"2244310201"), -("2023-09-20","2023-10-20",102,"2244310202"), -("2023-09-11","2023-10-11",105,"2244310203"), -("2023-09-11","2023-10-11",104,"2244310204"); - -#创建借阅表 -create table `return`( - bo_time varchar(10) not null, #借阅时间 - re_time varchar(10) not null, #归还时间 - book_id varchar(3), #图书编号 - foreign key (book_id) references book_info(book_id), - stu_id varchar(10) not null, #学号 - foreign key (stu_id) references student(stu_id) -); -#插入数据 -insert into `return` values -("2023-09-08","2023-10-02",101,"2244310201"), -("2023-08-15","2023-09-16",103,"2244310201"), -("2023-09-20","2023-10-10",102,"2244310202"), -("2023-09-11","2023-10-15",105,"2244310203"), -("2023-09-11","2023-10-01",104,"2244310204"); - -#查询 -select * from student s,borrow br,bookshelf bs,book_info bi where s.stu_id=br.stu_id and bi.book_id=br.book_id and bs.bs_id=bi.bs_id; - -~~~ - 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" deleted file mode 100644 index 556680f253283ae882c642636f31b26fdc8ca81e..0000000000000000000000000000000000000000 --- "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" +++ /dev/null @@ -1,171 +0,0 @@ -### 电影网站数据库设计 - -![](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/20230914 \345\214\273\351\231\242\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/04 \346\235\216\346\230\216\345\201\245/20230914 \345\214\273\351\231\242\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index e43d3a6ab7271eb9af1757941d2da8149bbbbcde..0000000000000000000000000000000000000000 --- "a/04 \346\235\216\346\230\216\345\201\245/20230914 \345\214\273\351\231\242\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,247 +0,0 @@ -### 笔记 - -1.如果一个主体的属性有多个值,那么这个属性就可以拆成一个新的主体。 - -2.当三张表都是多对多关系时,新建一个中间表,将三张表以一对多的形式连接到中间表,并产生关系。 - -### 医院管理系统 - -医院:科室,患者,门诊药房,病房 - -科室:医生,护士 - -患者:挂号,住院 - -门诊药房:药品,处方单,缴费方式 - -#### LDM - -![LDM](https://s2.loli.net/2023/09/14/1tHg2PB3skdrF7A.png) - -~~~ mysql -create database hospital charset utf8; -use hospital; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 12:08:12 */ -/*==============================================================*/ - -drop table if exists administrative_office; - -drop table if exists bill_of_payment; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists hospital; - -drop table if exists huli; - -drop table if exists inpatient_ward; - -drop table if exists nurse; - -drop table if exists patient; - -drop table if exists payment_method; - -drop table if exists pharmacy; - -drop table if exists prescription; - -/*==============================================================*/ -/* Table:科室 */ -/*==============================================================*/ -create table administrative_office -( - ao_id int not null auto_increment, - hospital_id int, - nurse_id int, - ao_name varchar(10) not null, - ao_address varchar(10) not null, - primary key (ao_id) -); - -/*==============================================================*/ -/* Table: 缴费单 */ -/*==============================================================*/ -create table bill_of_payment -( - bop_id int not null auto_increment, - patient_id int, - pharmacy_id int, - pm_id int, - bop_money int not null, - bop_time time not null, - primary key (bop_id) -); - -/*==============================================================*/ -/* Table: 医生 */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - ao_id int, - doctor_name varchar(5) not null, - doctor_sex char(1) not null, - doctor_age int not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: 药品 */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - pharmacy_id int, - drug_name varchar(10) not null, - drug_type varchar(5) not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: 医院 */ -/*==============================================================*/ -create table hospital -( - hospital_id int not null auto_increment, - hospital_name varchar(15) not null, - hospital_address varchar(20) not null, - hospital_tel varchar(11) not null, - primary key (hospital_id) -); - -/*==============================================================*/ -/* Table: 护理 */ -/*==============================================================*/ -create table huli -( - patient_id int not null, - nurse_id int not null, - primary key (patient_id, nurse_id) -); - -/*==============================================================*/ -/* Table: 病房 */ -/*==============================================================*/ -create table inpatient_ward -( - iw_id int not null auto_increment, - hospital_id int, - iw_name varchar(10) not null, - iw_address varchar(20) not null, - primary key (iw_id) -); - -/*==============================================================*/ -/* Table: 护士 */ -/*==============================================================*/ -create table nurse -( - nurse_id int not null auto_increment, - nurse_name varchar(5) not null, - nurse_sex char(1) not null, - nurse_age int not null, - primary key (nurse_id) -); - -/*==============================================================*/ -/* Table: 患者 */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - hospital_id int, - hos_hospital_id int, - patient_name varchar(5) not null, - patient_sex char(1) not null, - patient_tel varchar(11) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: 缴费方式 */ -/*==============================================================*/ -create table payment_method -( - pm_id int not null auto_increment, - pm_name varchar(10) not null, - primary key (pm_id) -); - -/*==============================================================*/ -/* Table: 门诊药房 */ -/*==============================================================*/ -create table pharmacy -( - pharmacy_id int not null auto_increment, - hospital_id int, - prescription_id int, - pharmacy_name varchar(10) not null, - pharmacy_address varchar(20) not null, - primary key (pharmacy_id) -); - -/*==============================================================*/ -/* Table: 处方单 */ -/*==============================================================*/ -create table prescription -( - prescription_id int not null auto_increment, - doctor_id int, - prescription_time time not null, - primary key (prescription_id) -); - -alter table administrative_office add constraint FK_possess foreign key (hospital_id) - references hospital (hospital_id) on delete restrict on update restrict; - -alter table administrative_office add constraint FK_shuyu foreign key (nurse_id) - references nurse (nurse_id) on delete restrict on update restrict; - -alter table bill_of_payment add constraint FK_pay foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table bill_of_payment add constraint FK_pay2 foreign key (pharmacy_id) - references pharmacy (pharmacy_id) on delete restrict on update restrict; - -alter table bill_of_payment add constraint FK_use foreign key (pm_id) - references payment_method (pm_id) on delete restrict on update restrict; - -alter table doctor add constraint FK_belong_to foreign key (ao_id) - references administrative_office (ao_id) on delete restrict on update restrict; - -alter table drug add constraint FK_stockpile foreign key (pharmacy_id) - references pharmacy (pharmacy_id) on delete restrict on update restrict; - -alter table huli add constraint FK_huli foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table huli add constraint FK_huli2 foreign key (nurse_id) - references nurse (nurse_id) on delete restrict on update restrict; - -alter table inpatient_ward add constraint FK_belong2 foreign key (hospital_id) - references hospital (hospital_id) on delete restrict on update restrict; - -alter table patient add constraint FK_be_hospitalized foreign key (hos_hospital_id) - references hospital (hospital_id) on delete restrict on update restrict; - -alter table patient add constraint FK_registration foreign key (hospital_id) - references hospital (hospital_id) on delete restrict on update restrict; - -alter table pharmacy add constraint FK_get_the_medicine foreign key (prescription_id) - references prescription (prescription_id) on delete restrict on update restrict; - -alter table pharmacy add constraint FK_have foreign key (hospital_id) - references hospital (hospital_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_open foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - - -~~~ - diff --git "a/04 \346\235\216\346\230\216\345\201\245/20230914 \347\254\224\350\256\260\350\241\245\344\272\244.md" "b/04 \346\235\216\346\230\216\345\201\245/20230914 \347\254\224\350\256\260\350\241\245\344\272\244.md" deleted file mode 100644 index 7ac922fc736a57dad480e40d600fbf515ef3bd70..0000000000000000000000000000000000000000 --- "a/04 \346\235\216\346\230\216\345\201\245/20230914 \347\254\224\350\256\260\350\241\245\344\272\244.md" +++ /dev/null @@ -1,121 +0,0 @@ -## 视图 - -#### 视图介绍: - -​ 视图(view)是一个虚拟表,为其命名后,用户使用时只需查此虚拟表即可获取结果集,并可以将其当作表来使用。此虚拟表的数据,来源于原表当中。 - -#### 视图的作用: - -​ 简化代码,可以把重复使用的查询封装成视图重复使用,同时可以使复杂的查询易于理解和使用。 - -​ 安全原因,如果一张表中有很多数据不希望让人看到,此时可以使用视图。 - -#### 创建视图语句 - -~~~ mysql -create or replace view 视图名 -as -select name,age from student; -# 查看表和视图 -show full tables; -~~~ - -#### 修改视图语句 - -~~~ mysql -alter view 视图名 as 新的查询语句 -~~~ - - #### 更新视图: - -​ 因为视图表是根据原表数据来的,所有对视图表进行增、删、改操作,也就相当于对原表进行操作。即,有一定的操作是会执行失败的。 - -​ ==所有,一般情况下,最好将视图作为查询数据的虚拟表,而不是通过视图更新数据。== - -#### 重命名视图 - -~~~ mysql -rename table 视图名 to 新视图名; -~~~ - -#### 删除视图 - -~~~ MySQL -drop view if exists 视图名; -~~~ - - - -## 存储过程 - - #### 简单理解:就是将sql语句分装成一个函数(方法) - -#### 创建存储过程格式 - -~~~ mysql -delimiter $$ # 设置$$为语句结尾标识 -create procedure proc01() # 创建存储过程,并命名 -begin - select * from student; # 要执行的sql语句 -end $$ # $$ 到这表示语句结尾 -delimiter ; # 将语句结尾标识设回 ; - -# 调用存储过程 -call proc01() -~~~ - -#### 变量定义 - -1.局部变量:用户自定义,==在begin与end块中有效== - -~~~ mysql -delimiter $$ -create procedure proc02() -begin - declare var_name varchar(5) default '张三'; # 定义变量,默认值为‘张三’ - set var_name = '李四'; # 改变该变量的值 - select var_name; # 李四 -end $$ - -# 调用存储过程 -call proc02(); -~~~ - -2.用户变量:用户自定义,==当前会话(连接)有效==,类似java的成员变量 - -~~~ mysql -delimiter $$ -create procedure proc03() -begin - set var_name = '李四'; # 设置变量值为‘李四’ -end $$ - -# 调用存储过程 -call proc03(); # 运行成功,设置了变量的值 -select var_name; # 李四 -~~~ - -3.系统变量-全局变量:由系统提供,==在整个数据库有效== - -~~~ mysql -# 查看所有全局变量 -show global variables; -# 查看指定的全局变量 -select @@global.全局变量名; -# 修改全局变量值 -set global 全局变量名 = 要修改的值; -set @@global.全局变量名 = 要修改的值; -~~~ - -4.系统变量 - 会话变量:由系统提供,==当前会话(连接)有效== - -~~~ mysql -# 查看所有全局变量 -show session variables; -# 查看指定的全局变量 -select @@session.全局变量名; -# 修改全局变量值 -set session 全局变量名 = 要修改的值; -set @@session.全局变量名 = 要修改的值; -~~~ - diff --git "a/04 \346\235\216\346\230\216\345\201\245/20230916 \346\261\275\350\275\246\345\224\256\345\215\226\347\263\273\347\273\237.md" "b/04 \346\235\216\346\230\216\345\201\245/20230916 \346\261\275\350\275\246\345\224\256\345\215\226\347\263\273\347\273\237.md" deleted file mode 100644 index 1979a89c69fbc92df34992ebfd7d1f85f3ca8373..0000000000000000000000000000000000000000 --- "a/04 \346\235\216\346\230\216\345\201\245/20230916 \346\261\275\350\275\246\345\224\256\345\215\226\347\263\273\347\273\237.md" +++ /dev/null @@ -1,154 +0,0 @@ -![](https://s2.loli.net/2023/09/16/bYhJlVZ3SKnGOH7.png) - -~~~ mysql -create database buy_car charset utf8; -use buy_car; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/16 16:12:55 */ -/*==============================================================*/ - - -drop table if exists car; - -drop table if exists car_brand; - -drop table if exists customer; - -drop table if exists sales_record; - -drop table if exists salesperson; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - cb_id int, - car_name varchar(10) not null, - car_price decimal(4,2) not null, - primary key (car_id) -); -insert into car values -(null,1,'奥迪A6L',42.79), -(null,1,'奥迪A8L',82.98), -(null,1,'奥迪A4L',32.18), -(null,2,'奔驰S400L',86.26), -(null,2,'奔驰GLA',28.78), -(null,2,'奔驰E级',50.25), -(null,3,'宝马X3',63.69), -(null,3,'宝马2系',41.98), -(null,3,'宝马X5',71.99); - -/*==============================================================*/ -/* Table: car_brand */ -/*==============================================================*/ -create table car_brand -( - cb_id int not null auto_increment, - cb_name varchar(10) not null, - primary key (cb_id) -); -insert into car_brand values -(null,'奥迪'), -(null,'奔驰'), -(null,'宝马'); - -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - customer_id int not null auto_increment, - customer_name varchar(5) not null, - customer_sex char(1) not null, - customer_tel varchar(11) not null, - customer_address varchar(20) not null, - primary key (customer_id) -); -insert into customer values -(null,'张三','男','18850625585','福建省南平市'), -(null,'李四','女','16845766554','福建省龙岩市'), -(null,'王五','男','14950028523','福建省泉州市'), -(null,'赵六','女','15650258573','福建省漳州市'), -(null,'田七','女','14589562573','福建省漳州市'); - -/*==============================================================*/ -/* Table: 销售记录 */ -/*==============================================================*/ -create table sales_record -( - sr_id int not null auto_increment, - car_id int, - sp_id int, - customer_id int, - sr_time date not null, - primary key (sr_id) -); -insert into sales_record values -(null,2,1,1,'2023-02-13'), -(null,1,3,1,'2023-05-23'), -(null,3,1,3,'2023-03-19'), -(null,5,2,2,'2023-07-21'), -(null,4,4,5,'2023-06-14'), -(null,6,2,4,'2023-08-15'), -(null,9,3,2,'2023-07-21'); - -/*==============================================================*/ -/* Table: 销售员 */ -/*==============================================================*/ -create table salesperson -( - sp_id int not null auto_increment, - sp_name varchar(5) not null, - sp_sex char(1) not null, - sp_tel varchar(11) not null, - sp_address varchar(20) not null, - primary key (sp_id) -); -insert into salesperson values -(null,'小李','男','14648515156','福建省南平市'), -(null,'小敏','女','18956764856','福建省漳州市'), -(null,'小莉','女','15989525856','福建省龙岩市'), -(null,'小黄','男','15954879156','福建省龙岩市'); - -alter table car add constraint FK_belong_to foreign key (cb_id) - references car_brand (cb_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_buy foreign key (customer_id) - references customer (customer_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_sell_a foreign key (sp_id) - references salesperson (sp_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_sell_b foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - - - - -- 1.查询特定销售员的销售记录(小李) - select * from salesperson s,sales_record sr where s.sp_id = sr.sp_id and sp_name = '小李'; - -- 2.查找销售记录中销售价格最高的汽车 - select * from car where car_price = - (select max(car_price) from car c,sales_record sr where c.car_id = sr.car_id); - -- 3.统计某个销售员的销售总额(小敏) - select sum(car_price) 万元 from car c,sales_record sr where c.car_id = sr.car_id and sp_id =(select sp_id from salesperson where sp_name = '小敏'); - -- 4.根据客户信息查询其购买过的汽车(李四) - select * from car where car_id in - (select car_id from sales_record where customer_id = (select customer_id from customer where customer_name = '李四')); - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额(奔驰) - select cb.cb_name 品牌,count(cb.cb_id) 销售数量,sum(car_price) 总销售额万元 - from car_brand cb,car c,sales_record sr where cb.cb_id = c.cb_id and c.car_id = sr.car_id group by cb.cb_id; - -- 6.检索特定日期范围内的销售了哪些汽车(2023-07-21) - select * from car where car_id in - (select car_id from sales_record where sr_time = '2023-07-21'); - -- 7.查找某车型的销售历史(宝马X3)。 - select * from sales_record where car_id = - (select car_id from car where car_name = '奔驰S400L'); - -- 8.统计每个销售员的销售数量 - select sp_name 销售员,count(sp.sp_id) 销售数量 from salesperson sp , sales_record sr where sp.sp_id = sr.sp_id group by sp.sp_id; - -~~~ - diff --git "a/04 \346\235\216\346\230\216\345\201\245/20230919 \346\237\245\350\257\242\345\244\215\344\271\240\351\242\230.md" "b/04 \346\235\216\346\230\216\345\201\245/20230919 \346\237\245\350\257\242\345\244\215\344\271\240\351\242\230.md" deleted file mode 100644 index 2e527da277ac58ae9bd70d2dbdb2351dbda4aea5..0000000000000000000000000000000000000000 --- "a/04 \346\235\216\346\230\216\345\201\245/20230919 \346\237\245\350\257\242\345\244\215\344\271\240\351\242\230.md" +++ /dev/null @@ -1,776 +0,0 @@ -## mysql复习 - -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不是null,就保持原值 - -limit 起始数,显示数 - -desc 库名:显示表结构 - -length(email):email的字节长度 - -#### 自然连接 - -表,表 where 字段=字段 and 字段=字段 - -#### 联表区间 - -表 left join 表 on 表.字段 between 表.字段 and 表.字段(不支持别名) - -#### 自连接 - -inner join - -not in(条件,条件) - -!(between 20 and 50) - -#### 代码 - -~~~ mysql - -create database text01 charset utf8; -use text01; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - - - - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -#理解1:计算12月的基本工资 - select sum(salary * 12) 工资总和 from employees ; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - select sum(salary * 12) + sum(salary * 12 * commission_pct) 实发工资 from employees; - select sum(salary * 12 + salary * 12 * ifnull(commission_pct,0)) 实发工资 from employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - select distinct(job_id) from employees; - -# 3.查询工资大于12000的员工姓名和工资 - select first_name 姓名,salary 工资 from employees where salary > 12000; - -# 4.查询员工号为176的员工的姓名和部门号 - select first_name 姓名,department_id 部门号 from employees where employee_id = 176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - desc departments; - select * from departments; - - - -# 第04章_运算符课后练习 -# 1.选择工资不在5000到12000的员工的姓名和工资 - select first_name 姓名,salary 工资 from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - select first_name 姓名,department_id 部门号 from employees where department_id in(20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - select first_name 姓名,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,奖金和奖金级别 - select first_name 姓名,e.salary*commission_pct 奖金,grade_level 奖金级别 from employees e left join job_grades j on e.salary*commission_pct between j.lowest_sal and j.highest_sal where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - select first_name 姓名 from employees where first_name like '__尔'; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - select * from employees where last_name like '%特%' and last_name like '%尔%' - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - select * from employees where first_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - select first_name 姓名,job_title 工种 from employees e left join jobs j on e.job_id=j.job_id where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,108 的员工姓名、工资、管理者id - select first_name 员工姓名,salary 工资,manager_id 管理者id from employees where manager_id in(100,101,108) - - - - -#第05章_排序与分页的课后练习 - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - select first_name 姓名,department_id 部门号,(salary * 12) 年薪 from employees order by 年薪 desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - select * from employees where salary not between 8000 and 17000 order by salary desc limit 21,19; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - select * from employees where email like '%e%' order by char_length(email) desc,department_id; - - - - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - select first_name 姓名,e.job_id 部门号,job_title 部门名称 from employees e,jobs j where e.job_id=j.job_id - -# 2.查询90号部门员工的job_id和90号部门的location_id - select job_id,location_id from employees e,departments d where e.department_id = d.department_id and e.department_id = 90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - select last_name ,department_name ,d.location_id ,city - from employees e,departments d,locations l - where e.department_id = d.department_id and d.location_id = l.location_id and commission_pct is not null; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - - #子查询 - select last_name ,job_id ,b.department_id ,department_name from employees e, - (select department_id ,department_name from departments where location_id = - (select location_id from locations where city = '多伦多')) b where e.department_id=b.department_id; - - #连表查 - select last_name ,job_id ,d.department_id ,department_name - from locations l ,departments d ,employees e - where l.location_id = d.location_id and d.department_id = e.department_id and city = '多伦多'; - - -#sql92语法(自然连接): - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - #select * from locations join departments join employees where department_name = '行政部'; - select d.department_name 部门名称,l.street_address 部门地址,e.first_name 姓名,j.job_title 工作,e.salary 工资 from locations l - left join departments d on l.location_id = d.location_id - left join employees e on d.department_id = e.department_id - right join jobs j on e.job_id = j.job_id where d.department_name = '行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - select e1.last_name 员工姓名,e1.employee_id 员工编号,e2.last_name 上级姓名,e2.employee_id 上级的员工编号 from employees e1,employees e2 where e1.manager_id =e2.employee_id - -# 7.查询哪些部门没有员工 - select department_name 部门名称 from departments d left join employees e on d.department_id = e.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - select city 没有部门的城市 from locations where location_id not in - (select distinct(location_id) from departments); - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - select * from employees where department_id in - (select department_id from departments where department_name in('销售部','信息技术部')); - - - - -# 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees ; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - select j.job_id, max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 - from jobs j left join employees e on j.job_id = e.job_id group by j.job_id; - -#4.选择各个job_id的员工人数 - select j.job_id,count(j.job_id) from jobs j left join employees e on j.job_id = e.job_id group by j.job_id; - -# 5.查询员工最高工资和最低工资的差距 - select max(salary)-min(salary) 最高工资和最低工资的差距 from employees ; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - select e1.manager_id,min(e1.salary) 最低工资 - from employees e1 right join employees e2 on e1.manager_id = e2.employee_id - where e1.salary >6000 group by e1.manager_id - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - select d.department_name 部门名,d.location_id,count(e.department_id) 员工数量,avg(e.salary) 平均工资 - from employees e right join departments d on e.department_id = d.department_id - group by d.department_id order by 平均工资 desc - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - select d.department_name 部门名,j.job_title 工种名,min(e.salary) 最低工资 from jobs j right join employees e on j.job_id = e.job_id left join departments d on e.department_id = d.department_id group by j.job_id,d.department_id; - - - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - select last_name 员工姓名,salary 工资 from employees where department_id = - (select department_id from employees where last_name = '兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - #select l.location_id, avg(e.salary) 平均工资 from locations l right join departments d on l.location_id = d.location_id left join employees e on d.department_id = e.department_id group by l.location_id; - - select employee_id,first_name,salary from employees where salary>(select avg(salary) from employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - select last_name, job_id, salary from employees where salary > - (select max(e.salary) from jobs j left join employees e on j.job_id = e.job_id where j.job_id = 'SA_MAN'); - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - #select * from employees where last_name like '' -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - select employee_id 员工号 from employees where department_id in - (select department_id from departments where location_id = 1700); - -#6.查询管理者是 金 的员工姓名和工资 - select last_name 姓名,salary 工资 from employees where manager_id in - (select employee_id from employees where last_name = '金'); - -#7.查询工资最低的员工信息: last_name, salary - select last_name,salary from employees where salary = - (select min(salary) from employees); - - - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - # 连表查 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - # 子查询 - select d.*,a.平均工资 from departments d right join - (select department_id,avg(salary) 平均工资 from employees group by department_id having avg(salary) = - (select avg(salary) 平均工资 from employees group by department_id order by 平均工资 limit 0,1)) a - on d.department_id = a.department_id; - - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 - select j.*,avg(e.salary) 平均工资 - from jobs j right join employees e on j.job_id = e.job_id group by j.job_id order by 平均工资 desc limit 0,1; - -#11.查询平均工资高于公司平均工资的部门有哪些? - select d.department_name 部门名,avg(e.salary) 平均工资 - from departments d right join employees e on d.department_id = e.department_id - group by d.department_id having 平均工资 > (select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - select * from employees where employee_id in - (select distinct(a.employee_id) from - (select e2.* from employees e1 left join employees e2 on e1.manager_id = e2.employee_id) a); - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - select * from employees where employee_id in - (select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - select min(e.salary) 最低工资 from employees e right join - (select department_id,max(salary) 最高工资 from employees group by department_id order by 最高工资 limit 0,1) a - on e.department_id = a.department_id ; - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - select last_name, department_id, email, salary from employees where employee_id = - (select employee_id from employees e right join - (select department_id,avg(salary) 平均工资 from employees group by department_id order by 平均工资 desc limit 0,1) a - on e.department_id = a.department_id limit 0,1); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - select job_id from jobs where job_id != 'ST_CLERK'; - -#16. 选择所有没有管理者的员工的last_name - select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - select * from employees where last_name = 'De Haan' - -#方式2: - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - select e.employee_id 员工号,e.last_name 姓名,e.salary 工资,a.平均工资 from employees e left join - (select department_id,avg(salary) 平均工资 from employees group by department_id) a - on e.department_id = a.department_id and e.salary > a.平均工资; - -#方式2:在FROM中声明子查询 - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - select department_name from departments where department_id in - (select distinct department_id from employees where employee_id in - (select manager_id from employees group by manager_id having count(manager_id)>5)); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - select country_id from locations where location_id in - (select location_id from departments group by location_id having count(location_id) > 2); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - - - - -~~~ - - \ No newline at end of file diff --git "a/04 \346\235\216\346\230\216\345\201\245/20230920 RBAC\347\254\224\350\256\260.md" "b/04 \346\235\216\346\230\216\345\201\245/20230920 RBAC\347\254\224\350\256\260.md" deleted file mode 100644 index e34e9bd9efe11a32003acb28581fccdb3249e8f1..0000000000000000000000000000000000000000 --- "a/04 \346\235\216\346\230\216\345\201\245/20230920 RBAC\347\254\224\350\256\260.md" +++ /dev/null @@ -1,174 +0,0 @@ -### RBAC (Role-Based Access Control) - -RBAC : 基于角色访问控制权限,是一种数据库设计思想,一个控制模型 - -==RBAC是主流设计模式== - -#### 数据库能存什么 - -1. 业务数据表:用户、商品 -2. 功能资源表:菜单信息表、页面代码 - -#### 权限使用背景 - -菜单权限: 不同用户登录系统后,展示菜单不同 - -按钮权限:不同用户查看同一个对象时,展示按钮不一样 - -数据权限:可见数据不同 - -操作权限:看得到点不着 例如:腾讯视频VIP你可以看到视频但是不可以播放 - -#### RBAC由三个部分组成 - -1. 用户 -2. 角色:是RBAC是的核心 -3. 权限 - -- User(用户):每个用户都有唯一的UID识别,并被授予不同的角色 -- Role(角色):不同角色具有不同的权限 -- Permission(权限):访问权限 -- 用户-角色映射:用户和角色之间的映射关系 -- 角色-权限映射:角色和权限之间的映射 - -权限关联实现授权,给用户分配应当有的对应权限 - -##### RBAC 的优点: - -简化了用户和权限的关系 - -易扩展,易维护 - -##### 缺点: - -RBAC模型没有提供操作顺序的控制机制,这一缺陷得RBAC模型很难适应那些对操作次序有严格要求的系统 - -###### 练习 - -~~~ mysql -create database text03 charset utf8; -use text03; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:27:53 */ -/*==============================================================*/ - - -drop table if exists menu; - -drop table if exists role; - -drop table if exists role_menu; - -drop table if exists `user`; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: menu */ -/*==============================================================*/ -create table menu -( - menu_id int not null auto_increment, - menu_name varchar(10) not null, - menu_address varchar(150) not null, - primary key (menu_id) -); -insert into menu values -(null,'首页','http://www.md.com/'), -(null,'查询学生信息','http://www.md.com/student'), -(null,'查询教师信息','http://www.md.com/teacher'), -(null,'查询教师工资','http://www.md.com/salary'); -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name varchar(10) not null, - primary key (role_id) -); -insert into role values -(null,'校长'), -(null,'老师'), -(null,'学生'); - -/*==============================================================*/ -/* Table: role_menu */ -/*==============================================================*/ -create table role_menu -( - menu_id int not null, - role_id int not null, - primary key (menu_id, role_id) -); -insert into role_menu values -(1,1), -(2,1), -(3,1), -(4,1), -(1,2), -(2,2), -(3,2), -(1,3), -(2,3); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table `user` -( - user_id int not null auto_increment, - user_name varchar(10) not null, - user_paw varchar(10) not null, - primary key (user_id) -); -insert into `user` values -(null,'张三','88888888'), -(null,'丘丘','66666666'), -(null,'小明','12345678'), -(null,'小红','12345678'); - -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - role_id int not null, - user_id int not null, - primary key (role_id, user_id) -); -insert into user_role values -(1,1), -(2,2), -(3,3), -(3,4); - -alter table role_menu add constraint FK_role_menu foreign key (menu_id) - references menu (menu_id) on delete restrict on update restrict; - -alter table role_menu add constraint FK_role_menu2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - - -delimiter $$ -create procedure proc01(in in_name varchar(5),in in_psw varchar(10)) -begin - select user_name,role_name,menu_name,menu_address - from `user` u,user_role ur,role r,role_menu rm,menu m where u.user_id = ur.user_id and ur.role_id = r.role_id and r.role_id = rm.role_id and rm.menu_id = m.menu_id and u.user_name = in_name and u.user_paw = in_psw; -end $$ -delimiter ; - -call proc01('张三','88888888'); -call proc01('丘丘','66666666'); -call proc01('小明','12345678'); -call proc01('小红','12345678'); -~~~ - diff --git "a/04 \346\235\216\346\230\216\345\201\245/20230921 SKU\347\254\224\350\256\260.md" "b/04 \346\235\216\346\230\216\345\201\245/20230921 SKU\347\254\224\350\256\260.md" deleted file mode 100644 index f584be2e25d09c68e689b0755e687f3c2a105898..0000000000000000000000000000000000000000 --- "a/04 \346\235\216\346\230\216\345\201\245/20230921 SKU\347\254\224\350\256\260.md" +++ /dev/null @@ -1,191 +0,0 @@ -### 什么是SKU - -SKU: 英文全称为Stock Keeping Unit,简称SKU,是产品入库后一种编码归类方法,也是库存控制的最小单位。库存进出计量的单位, 可以是以件、盒、托盘等为单位。在服装、鞋类商品中使用最多最普遍。 例如纺织品中一个SKU通常表示:规格、颜色、款式。 - -### 什么是SPU - -SPU: 是商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个产品的特性。通俗点讲,属性值、特性相同的商品就可以称为一个SPU。 - -#### 总结:SPU是标准化产品单元,区分品种;SKU是库存量单位,区分单品;商品特指与商家有关的商品,可对应多个SKU。 - -### ER图 - -![](https://s2.loli.net/2023/09/21/lJTPQFUuSvmELYa.png) - -### 代码 - -~~~ mysql -create database text01 charset utf8; -use text01; - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 17:07:58 */ -/*==============================================================*/ - - -drop table if exists goods; - -drop table if exists goods_attribute; - -drop table if exists goods_attribute_value; - -drop table if exists goods_middle; - -drop table if exists specification; - -/*==============================================================*/ -/* Table: 商品表 */ -/*==============================================================*/ -create table goods -( - goods_id int not null auto_increment, - goods_name varchar(50) not null, - primary key (goods_id) -); -insert into goods values -(null,'华为 Mate60 Pro'); - -/*==============================================================*/ -/* Table: 商品属性表 */ -/*==============================================================*/ -create table goods_attribute -( - ga_id int not null auto_increment, - ga_name varchar(10) not null, - primary key (ga_id) -); -insert into goods_attribute values -(null,'颜色'), -(null,'版本'); - -/*==============================================================*/ -/* Table: 商品属性值表 */ -/*==============================================================*/ -create table goods_attribute_value -( - gav_id int not null auto_increment, - gav_name varchar(10) not null, - primary key (gav_id) -); -insert into goods_attribute_value values -(null,'黑色'), -(null,'白色'), -(null,'绿色'), -(null,'256G'), -(null,'512G'), -(null,'1T'); - - -/*==============================================================*/ -/* Table: 商品中间表 */ -/*==============================================================*/ -create table goods_middle -( - gm_id int not null auto_increment, - sf_id int, - ga_id int, - gav_id int, - primary key (gm_id) -); -insert into goods_middle values -(null,1,1,1), -(null,1,2,4), -(null,2,1,2), -(null,2,2,4), -(null,3,1,3), -(null,3,2,4), -(null,4,1,1), -(null,4,2,5), -(null,5,1,2), -(null,5,2,5), -(null,6,1,1), -(null,6,2,6), -(null,7,1,2), -(null,7,2,6), -(null,8,1,3), -(null,8,2,6); - -/*==============================================================*/ -/* Table: 规格表 */ -/*==============================================================*/ -create table specification -( - sf_id int not null auto_increment, - goods_id int, - sf_name varchar(50) not null, - sf_price decimal(6,2) not null, - sf_stock int not null, - primary key (sf_id) -); -insert into specification values -(null,1,'华为 Mate 60 Pro 256G+黑色',6999,0), -(null,1,'华为 Mate 60 Pro 256G+白色',6999,5), -(null,1,'华为 Mate 60 Pro 256G+绿色',6999,5), -(null,1,'华为 Mate 60 Pro 512G+黑色',7999,10), -(null,1,'华为 Mate 60 Pro 512G+白色',7999,20), -(null,1,'华为 Mate 60 Pro 1T+黑色',8999,30), -(null,1,'华为 Mate 60 Pro 1T+白色',8999,30), -(null,1,'华为 Mate 60 Pro 1T+绿色',8999,30); - - -alter table goods_middle add constraint FK_Relationship_2 foreign key (sf_id) - references specification (sf_id) on delete restrict on update restrict; - -alter table goods_middle add constraint FK_Relationship_3 foreign key (ga_id) - references goods_attribute (ga_id) on delete restrict on update restrict; - -alter table goods_middle add constraint FK_Relationship_4 foreign key (gav_id) - references goods_attribute_value (gav_id) on delete restrict on update restrict; - -alter table specification add constraint FK_Relationship_1 foreign key (goods_id) - references goods (goods_id) on delete restrict on update restrict; - - -# 视图(查询所有) -create or replace view select_all -as -SELECT - s.sf_id, - s.sf_name, - gav.gav_name, - s.sf_price -FROM - goods g, - specification s, - goods_middle gm, - goods_attribute ga, - goods_attribute_value gav -WHERE - g.goods_id = s.goods_id - AND s.sf_id = gm.sf_id - AND gm.ga_id = ga.ga_id - AND gm.gav_id = gav.gav_id - order by s.sf_id ; - - # 查询视图 - select * from select_all; - - -# 存储过程(查询指定的类型) -delimiter $$ -create procedure proc01(in in_color varchar(5),in in_ram varchar(10)) -begin - select * from specification where sf_id = - (select a.sf_id from - (select sf_id,gav_name from goods_middle gm,goods_attribute_value gav where gm.gav_id = gav.gav_id and gav_name = in_color) as a - , - (select sf_id,gav_name from goods_middle gm,goods_attribute_value gav where gm.gav_id = gav.gav_id and gav_name = in_ram) as b - where a.sf_id = b.sf_id); -end $$ -delimiter ; - -# 调用存储过程 -call proc01('白色','256G'); -call proc01('绿色','1T'); -call proc01('黑色','512G'); - - -~~~ - diff --git "a/04 \346\235\216\346\230\216\345\201\245/20230924 \345\255\230\345\202\250\350\277\207\347\250\213\347\232\204\344\274\240\345\217\202\357\274\210\351\242\204\344\271\240\357\274\211.md" "b/04 \346\235\216\346\230\216\345\201\245/20230924 \345\255\230\345\202\250\350\277\207\347\250\213\347\232\204\344\274\240\345\217\202\357\274\210\351\242\204\344\271\240\357\274\211.md" deleted file mode 100644 index c974510366d5a23d76f3b6ee232c5a1801e5f77c..0000000000000000000000000000000000000000 --- "a/04 \346\235\216\346\230\216\345\201\245/20230924 \345\255\230\345\202\250\350\277\207\347\250\213\347\232\204\344\274\240\345\217\202\357\274\210\351\242\204\344\271\240\357\274\211.md" +++ /dev/null @@ -1,106 +0,0 @@ -#### 存储过程的传参 - -#### in :表示传入的参数 - -只有一个参数 - -~~~ mysql -delimiter $$ -create procedure proc04(in name varchar(5)) # in 表示传入参数 -begin - select * from student where student.name = name; # 将传递的参数赋值并利用 -end $$ -delimiter ; - -call proc04("张三"); # 传递参数,执行语句,得到张三的所有信息 -call proc04("李四"); # 传递参数,执行语句,得到李四的所有信息 -~~~ - -有多个参数 - -~~~ mysql -# 需求:查询指定部门,大于多少薪资的员工信息 (两个参数但是可变的) -delimiter $$ -create procedure proc05(in param_dname varchar(10),in param_sal decimal(7,2)) -begin - select * from dept d,emp e where d.dname = param_dname and e.sal > param_sal; -end $$ -delimiter ; - -call proc05("学工部",20000); # 调用分装好的语句,查询学工部薪资大于20000的员工信息 -call proc05("销售部",10000); -~~~ - -#### out :表示从存储过程内部传值给调用者 - -一个out参数 - -~~~ mysql -# 需求:传入员工编号,返回员工姓名 -delimiter $$ -create procedure proc06(in in_empno int, out out_ename varchar(5)) -begin - select ename into out_ename from emp where empno = in_empno; #into 表示将查询的结果赋值给out_ename -end $$ -delimiter ; - -call proc06(1001,@o_ename); # 传入员工编号,定义一个变量接收返回的结果 -select @o_ename; # 查询变量值 -~~~ - -多个out参数 - -~~~ mysql -# 需求:传入员工编号,返回员工姓名、薪资 -delimiter $$ -create procedure proc07(in in_empno int, out out_ename varchar(5), out out_sal decimal(7,2)) -begin - select ename,sal into out_ename,out_sal from emp where empno = in_empno; # 赋值字段一一对应,字段之间逗号隔开 -end $$ -delimiter ; - -call proc07(1001,@o_ename,@o_sal); # 定义变量接收返回结果 -select @o_ename; -select @o_sal; -~~~ - -#### inout:表示从外部传入的参数进过修改后可以返回的变量,既可以使用传入变量的值,也可以修改传入变量的值 - -案例一 - -~~~ mysql -# 需求:传入一个数字,传出这个数字的10倍值 -delimiter $$ -create procedure proc08(inout num int) -begin - set num = num * 10; -end $$ -delimiter ; - -set @inout_num = 2; # 设一个变量用来接收变化的值,并给初始值 -call proc08(@inout_num); # 调用存储过程,并将值传入 -select @inout_num; # 得到改变的值 20 -~~~ - -案例二 - -~~~ mysql -# 需求:传入员工名,拼接部门号,传入薪资,求出年薪 -# 拼接要求: 30_张三 -delimiter $$ -create procedure proc08(inout inout_ename varchar(5),inout inout_sal int) -begin - # concat_ws 是一个拼接的函数,可以指定拼接格式 - select concat_ws('_',deptno,ename) into inout_ename from emp where emp.ename = inout_ename; - set inout_sal = inout_sal * 12; -end $$ -delimiter ; -# 定义变量,并赋初始值 -set @inout_ename = "张三"; -set @inout_sal = 3000; -# 调用存储过程,得到结果 -call proc08(@inout_ename,@inout_sal); -# 打印结果 -select @inout_ename; -select @inout_sal; -~~~ diff --git "a/04 \346\235\216\346\230\216\345\201\245/20230926 Check\347\272\246\346\235\237\344\270\216\350\247\206\345\233\276.md" "b/04 \346\235\216\346\230\216\345\201\245/20230926 Check\347\272\246\346\235\237\344\270\216\350\247\206\345\233\276.md" deleted file mode 100644 index b62980bda810a696d01c8aa7888dcae0a6994e9a..0000000000000000000000000000000000000000 --- "a/04 \346\235\216\346\230\216\345\201\245/20230926 Check\347\272\246\346\235\237\344\270\216\350\247\206\345\233\276.md" +++ /dev/null @@ -1,349 +0,0 @@ -## Check 约束 - -作用:检查某个字段的值是否符合XX要求,一般指的是值的范围 - -例: - -~~~ mysql -create table student( - gender char(1), - age int, - check(gender in('男','女')), - check(age > 0) -); -~~~ - -## 视图 - -#### 视图介绍: - -​ 视图(view)是一个虚拟表,为其命名后,用户使用时只需查此虚拟表即可获取结果集,并可以将其当作表来使用。此虚拟表的数据,来源于原表当中。 - -#### 视图的作用: - -​ 简化代码,可以把重复使用的查询封装成视图重复使用,同时可以使复杂的查询易于理解和使用。 - -​ 安全原因,如果一张表中有很多数据不希望让人看到,此时可以使用视图。 - -#### 创建视图语句 - -语法一: - -~~~ mysql -create view 视图名 as 查询语句 -~~~ - -语法二: - -~~~ mysql -create view 视图名(字段别名) as 查询语句 # 字段别名的个数要与查询语句一样 -~~~ - -#### 修改视图语句 - -语法一: - -~~~ mysql -create or replace view 视图名 as 查询语句 # 有就修改,没就创建 -~~~ - -语法二: - -~~~ mysql -alter view 视图名 as 新的查询语句 # 前提是被修改的视图要存在 -~~~ - - #### 更新视图: - -​ 因为视图表是根据原表数据来的,所有对视图表进行增、删、改操作,也就相当于对原表进行操作。即,有一定的操作是会执行失败的。 - -​ ==所有,一般情况下,最好将视图作为查询数据的虚拟表,而不是通过视图更新数据。== - -#### 重命名视图 - -~~~ mysql -rename table 视图名 to 新视图名; -~~~ - -#### 删除视图 - -~~~ MySQL -drop view if exists 视图名; -~~~ - -## 视图练习 - -~~~ mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - - - - -#第14章_视图的课后练习 - - -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -create view employee_vu as -select LAST_NAME 姓名,EMPLOYEE_ID 员工号,DEPARTMENT_ID 部门号 from employees; - -#2. 显示视图的结构 -desc employee_vu; - -#3. 查询视图中的全部内容 -select * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -create or replace view employee_vu as -select - LAST_NAME 姓名, - EMPLOYEE_ID 员工号, - DEPARTMENT_ID 部门号 -from employees -where DEPARTMENT_ID = 80; - -#练习2: - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -create view emp_v1 as -select - concat(last_name,' ',first_name) 员工姓名, - salary 工资, - email 邮箱 -from employees -where phone_number like '011%'; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -create or replace view emp_v1 as -select - concat(last_name,' ',first_name) 员工姓名, - salary 工资, - email 邮箱 -from employees -where phone_number like '011%' and email like '%e%' ; - -select * from emp_v1 -#3. 向 emp_v1 插入一条记录,是否可以? -# 不可以,因为emp_v1是一个视图,它是一个只读的虚拟表格,只是将查询语句的结果封装成一个新的表格而已。因此,无法通过直接向MySQL视图中插入数据 - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -update emp_v1 set 工资 = 工资 + 1000; - -#5. 删除emp_v1中姓名为Olsen的员工 -delete from emp_v1 where 员工姓名 like 'olsen%' - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create view emp_v2 as -select - department_id 部门id, - max(salary) 最高工资 -from employees -where salary > 12000 group by department_id; -#查询方二:select department_id 部门id,max(salary) 最高工资 from employees group by department_id having 最高工资 > 12000 ; -select * from emp_v2; - -#7. 向 emp_v2 中插入一条记录,是否可以? -# 不可以,因为emp_v2是一个视图,它是一个只读的虚拟表格,只是将查询语句的结果封装成一个新的表格而已。因此,无法通过直接向MySQL视图中插入数据 - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v2; -drop view emp_v1; - - -~~~ - diff --git "a/05 \350\260\242\351\223\226\346\265\251/20230910.md" "b/05 \350\260\242\351\223\226\346\265\251/20230910.md" deleted file mode 100644 index 2f590cc0b1bd68956a973056a5fe727a3754aceb..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/20230910.md" +++ /dev/null @@ -1,5 +0,0 @@ -- Conceptual Data Model----------概念模型 -- Physical Data Model--------------物理模型 -- Object-Oriented Model-----------逻辑模型 - -P是PrimaryIdentifier是否为**主键**表述的缩写,勾选了P就代表当前被勾选字段是该表的主键。M是Mandatory的缩写,属性值是否允许为空的意思。D是displayed的缩写,表示是否在实体图形符号中显示该属性。 \ No newline at end of file diff --git "a/05 \350\260\242\351\223\226\346\265\251/20230912\344\275\234\344\270\232.md" "b/05 \350\260\242\351\223\226\346\265\251/20230912\344\275\234\344\270\232.md" deleted file mode 100644 index 5c47a8cddc631680bb8b7945184c48b8f328a623..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/20230912\344\275\234\344\270\232.md" +++ /dev/null @@ -1,65 +0,0 @@ -/==============================================================/ /* DBMS name: MySQL 5.0 / / Created on: 2023/9/12 17:16:23 / /==============================================================*/ - -drop table if exists Relationship_2; - -drop table if exists Relationship_3; - -drop table if exists Relationship_4; - -drop table if exists Relationship_5; - -drop table if exists Relationship_6; - -drop table if exists actor; - -drop table if exists comment; - -drop table if exists employee; - -drop table if exists movie; - -drop table if exists people; - -drop table if exists "short review"; - -/==============================================================/ /* Table: Relationship_2 / /==============================================================*/ create table Relationship_2 ( "p-name" char(4) not null, "m-name" varchar(5) not null, score decimal(3,1) not null, primary key ("p-name", "m-name") ); - -/==============================================================/ /* Table: Relationship_3 / /==============================================================*/ create table Relationship_3 ( director char(4) not null, "m-name" varchar(5) not null, actorname varchar(4) not null, primary key (director, "m-name") ); - -/==============================================================/ /* Table: Relationship_4 / /==============================================================*/ create table Relationship_4 ( "a-name" char(4) not null, director char(4) not null, scriptwritername varchar(4) not null, primary key ("a-name", director) ); - -/==============================================================/ /* Table: Relationship_5 / /==============================================================*/ create table Relationship_5 ( "c-id" varchar(11) not null, "p-name" char(4) not null, "c-start" varchar(11) not null, primary key ("c-id", "p-name") ); - -/==============================================================/ /* Table: Relationship_6 / /==============================================================*/ create table Relationship_6 ( "s-id" varchar(11) not null, "p-name" char(4) not null, "s-startµÈ¼¶" varchar(12) not null, primary key ("s-id", "p-name") ); - -/==============================================================/ /* Table: actor / /==============================================================*/ create table actor ( "a-name" char(4) not null, "a-sex" char(1) not null, datetime datetime not null, Constellation char(3) not null, birthplace varchar(5) not null, job char(2) not null, "Foreign name" varchar(8) not null, Chinesename char(4) not null, family varchar(25) not null, imdbID varchar(15) not null, primary key ("a-name") ); - -/==============================================================/ /* Table: comment / /==============================================================*/ create table comment ( "c-id" varchar(11) not null, "s-content" varchar(500) not null, primary key ("c-id") ); - -/==============================================================/ /* Table: employee / /==============================================================*/ create table employee ( director char(4) not null, star varchar(4) not null, scriptwriter char(4) not null, primary key (director) ); - -/==============================================================/ /* Table: movie / /==============================================================*/ create table movie ( "m-name" varchar(5) not null, "m-type" varchar(5) not null, "m-time" int not null, "release-date" time not null, "rename" varchar(20) not null, primary key ("m-name") ); - -/==============================================================/ /* Table: people / /==============================================================*/ create table people ( "p-name" char(4) not null, "p-sex" char(1) not null, primary key ("p-name") ); - -/==============================================================/ /* Table: "short review" / /==============================================================*/ create table "short review" ( "s-id" varchar(11) not null, "s-content" varchar(500) not null, primary key ("s-id") ); - -alter table Relationship_2 add constraint FK_Relationship_2 foreign key ("p-name") references people ("p-name") on delete restrict on update restrict; - -alter table Relationship_2 add constraint FK_Relationship_7 foreign key ("m-name") references movie ("m-name") on delete restrict on update restrict; - -alter table Relationship_3 add constraint FK_Relationship_3 foreign key (director) references employee (director) on delete restrict on update restrict; - -alter table Relationship_3 add constraint FK_Relationship_8 foreign key ("m-name") references movie ("m-name") on delete restrict on update restrict; - -alter table Relationship_4 add constraint FK_Relationship_4 foreign key ("a-name") references actor ("a-name") on delete restrict on update restrict; - -alter table Relationship_4 add constraint FK_Relationship_9 foreign key (director) references employee (director) on delete restrict on update restrict; - -alter table Relationship_5 add constraint FK_Relationship_10 foreign key ("p-name") references people ("p-name") on delete restrict on update restrict; - -alter table Relationship_5 add constraint FK_Relationship_5 foreign key ("c-id") references comment ("c-id") on delete restrict on update restrict; - -alter table Relationship_6 add constraint FK_Relationship_11 foreign key ("p-name") references people ("p-name") on delete restrict on update restrict; - -alter table Relationship_6 add constraint FK_Relationship_6 foreign key ("s-id") references "short review" ("s-id") on delete restrict on update restrict; \ No newline at end of file diff --git "a/05 \350\260\242\351\223\226\346\265\251/20230914\344\275\234\344\270\232.md" "b/05 \350\260\242\351\223\226\346\265\251/20230914\344\275\234\344\270\232.md" deleted file mode 100644 index 5cb6426e59beeb9c1ba4f65ebb4fdd00d09e6b0e..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/20230914\344\275\234\344\270\232.md" +++ /dev/null @@ -1,35 +0,0 @@ -/==============================================================/ /* DBMS name: MySQL 5.0 / / Created on: 2023/9/13 22:58:34 / /==============================================================*/ - -drop table if exists department; - -drop table if exists diagnose; - -drop table if exists doctor; - -drop table if exists hospital; - -drop table if exists pharmacy; - -drop table if exists sick; - -/==============================================================/ /* Table: department / /==============================================================*/ create table department ( d_id varchar(11) not null, hospital_name varchar(10), d_name varchar(11) not null, d_tel varchar(15) not null, d_address varchar(25) not null, primary key (d_id) ); - -/==============================================================/ /* Table: diagnose / /==============================================================*/ create table diagnose ( "doctor-ID" varchar(15) not null, "sick-IDcar" varchar(15) not null, "drug-id" varchar(15), "prescription-id" varchar(15) not null, primary key ("doctor-ID", "sick-IDcar") ); - -/==============================================================/ /* Table: doctor / /==============================================================*/ create table doctor ( "doctor-ID" varchar(15) not null, d_id varchar(11), "doctor-name" char(4) not null, "doctor-tel" varchar(15) not null, primary key ("doctor-ID") ); - -/==============================================================/ /* Table: hospital / /==============================================================*/ create table hospital ( hospital_name varchar(10) not null, primary key (hospital_name) ); - -/==============================================================/ /* Table: pharmacy / /==============================================================*/ create table pharmacy ( "drug-id" varchar(15) not null, "drug-name" varchar(12) not null, primary key ("drug-id") ); - -/==============================================================/ /* Table: sick / /==============================================================*/ create table sick ( "sick-name" char(4) not null, "sick-age" int not null, "sick-sex" char(1) not null, "sick-tel" varchar(15) not null, "sick-IDcar" varchar(15) not null, primary key ("sick-IDcar") ); - -alter table department add constraint FK_Relationship_1 foreign key (hospital_name) references hospital (hospital_name) on delete restrict on update restrict; - -alter table diagnose add constraint FK_Relationship_4 foreign key ("doctor-ID") references doctor ("doctor-ID") on delete restrict on update restrict; - -alter table diagnose add constraint FK_Relationship_5 foreign key ("sick-IDcar") references sick ("sick-IDcar") on delete restrict on update restrict; - -alter table diagnose add constraint FK_Relationship_6 foreign key ("drug-id") references pharmacy ("drug-id") on delete restrict on update restrict; - -alter table doctor add constraint FK_Relationship_2 foreign key (d_id) references department (d_id) on delete restrict on update restrict; \ No newline at end of file diff --git "a/05 \350\260\242\351\223\226\346\265\251/20230917.md" "b/05 \350\260\242\351\223\226\346\265\251/20230917.md" deleted file mode 100644 index 75445624c86c71229c38ab4696336f89a66db566..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/20230917.md" +++ /dev/null @@ -1,156 +0,0 @@ -``` -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/17 18:11:14 */ -/*==============================================================*/ -create database qiche charset utf8; -use qiche; - -drop table if exists automobile; - -drop table if exists client; - -drop table if exists record; - -drop table if exists salesman; - -/*==============================================================*/ -/* Table: automobile */ -/*==============================================================*/ -create table automobile #汽车 -( - a_id int(3) not null auto_increment, #汽车编号 - a_name varchar(10) not null, #汽车名称 - a_sellingprice decimal(7,1) not null, #汽车售价 - a_brand varchar(10) not null, #汽车品牌 - primary key (a_id) -); -insert into automobile values -(01,'五菱神光mini',20000.0,'五菱宏光'), -(02,'玛拉莎蒂2023',900000.0,'玛莎拉蒂'), -(03,'宝牛SUV',250000.0,'宝马'), -(04,'五菱宏光2077',10000.0,'五菱宏光'); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client #顾客 -( - c_id int(2) not null auto_increment, #顾客编号 - c_name varchar(10) not null, #顾客姓名 - c_sex varchar(2) not null, #顾客性别 - primary key (c_id) -); -insert into client values -(2001,'德莱厄斯','男'), -(2002,'塞恩','男'), -(2003,'蒙多','男'); -/*==============================================================*/ -/* Table: record */ -/*==============================================================*/ - - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman #销售员 -( - s_id int(2) not null auto_increment, #工号 - s_name varchar(5) not null, #姓名 - s_sex varchar(2) not null, #性别 - primary key (s_id) -); -insert into salesman values -(1001,'梦泪','男'), -(1002,'坤哥','男'), -(1003,'厄斐琉斯','男'); - -create table record #销售记录 -( - r_id int(2) not null auto_increment, #销售编号 - s_id int not null, #工号 - c_id int not null, #顾客编号 - a_id int not null, #汽车编号 - primary key (r_id) -); -insert into record values -(3001,1001,2002,02), -(3002,1002,2001,01), -(3003,1001,2002,03), -(3004,1003,2003,04); - -alter table record add constraint FK_Relationship_2 foreign key (s_id) - references salesman (s_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_3 foreign key (c_id) - references client (c_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_4 foreign key (a_id) - references automobile (a_id) on delete restrict on update restrict; - -- 1.查询特定销售员的销售记录 -SELECT - s.s_id 工号, - s_name 销售员, - r_id 销售编号, - a_name 汽车型号, - a_sellingprice 售价, - a_brand 汽车品牌 -FROM - salesman s - JOIN record r - JOIN automobile a ON s.s_id = r.s_id - AND a.a_id = r.a_id -WHERE - s.s_id =( - SELECT - s_id - FROM - salesman - WHERE - s_name = '梦泪' - ); - -- 2.查找销售记录中销售价格最高的汽车 - select a.* from record r join automobile a on r.a_id=a.a_id where r.a_id = (select a_id from automobile where a_brand=(select max(a_brand) from automobile)); - -- 3.统计某个销售员的销售总额 -SELECT - s_name 销售员, - sum(a_sellingprice) 销售总额 -FROM - salesman s - JOIN record r - JOIN automobile a ON s.s_id = r.s_id - AND a.a_id = r.a_id - group by s.s_name having s.s_name='梦泪'; - -- 4.根据客户信息查询其购买过的汽车 - select c_name 顾客,c_sex 性别,a_name 汽车型号, a_sellingprice 售价,a_brand 型号 from client c join record r join automobile a on c.c_id=r.c_id and r.a_id = a.a_id where c.c_name='塞恩'; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 -SELECT - a_brand 品牌, - count( r.a_id) 销售数量, - sum( a.a_sellingprice ) 销售总额 -FROM - record r - JOIN automobile a ON r.a_id = a.a_id -GROUP BY - a_brand; - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - SELECT - a_name 汽车型号, - a_brand 品牌, - r.a_id 销售数量, - a.a_sellingprice 销售总额 -FROM - record r - JOIN automobile a ON r.a_id = a.a_id where a.a_name='五菱神光mini'; - -- 8.统计每个销售员的销售数量 -SELECT - s_name 销售员, - count(r.a_id) 销售总额 -FROM - salesman s - JOIN record r - JOIN automobile a ON s.s_id = r.s_id - AND a.a_id = r.a_id - group by s.s_name; -``` \ No newline at end of file diff --git "a/05 \350\260\242\351\223\226\346\265\251/20230922.md" "b/05 \350\260\242\351\223\226\346\265\251/20230922.md" deleted file mode 100644 index fb69a0960883a6bb4753923e79a8324da03862c8..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/20230922.md" +++ /dev/null @@ -1,3 +0,0 @@ -SPU:标准化产品单元(Standard Product Unit),是商品信息聚合的最小单位,是一组可复用标准化信息的集合,主要也是为了在交易端对一组同类型商品做页面的聚合展示,解决的是一品多型号多规格等等多属性的问题; -SKU:最小的库存单位(StockKeeping Unit),sku是库存存贮的最小单位,商品的进货、销售、售价、库存等最终都是打在sku身上的,最终的交易都决定在一个sku个体上; -标准商品(cspu/mku):对于标准商品,行业内不同系统不同领域叫法可能会有差异,有的叫cspu,有的叫mku,这个概念一般是在大型的电商系统中才会用到,解决的是一品多商的问题,比如A商家、B商家、C商家……(以下省略N个商家)都售卖同一种商品abc,从同一个品牌商那里进货,那用户搜索abc的时候,会出来N个商品的搜索结果,以及N的相关商品的搜索结果,没有聚合展示,对用户选品带来困扰。标品就是将这N个商品的搜索结果做聚合,仅展示标准商品,便于用户选品。 \ No newline at end of file diff --git "a/05 \350\260\242\351\223\226\346\265\251/20230925\351\242\204\344\271\240.md" "b/05 \350\260\242\351\223\226\346\265\251/20230925\351\242\204\344\271\240.md" deleted file mode 100644 index 1f26f8cae8454bffbe6660b301821d1d668f389d..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/20230925\351\242\204\344\271\240.md" +++ /dev/null @@ -1,43 +0,0 @@ -#### 1.事务 - -为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - -#### 事务的四个特性 - -1.原子性:事务包含的这一系列操作,要么全部成功,要么全部失败 - -2.一致性:事务完成之后,不会将非法的数据写入数据库。 - -3.隔离性:多个事务可以在一定程度上并发执行 - -4.持久性:事务完成之后,数据要永久保存 - -#### 2.视图 - -在已有的表或者视图上创建的虚拟表 - -创建视图: create view 视图名 asselect - -可以对(单表)视图进行一些增删改查的操作,这些操作会影响到原始的表 - -删除视图:drop view 视图名 - -#### 3.索引 - -为了提高查询的速度而在数据库断创建的一种排序的数据结构 - -#### 4.储存过程 - -存储在数据库端的一组为了完成特点功能的sql语句 - -存储过程:create procedure 存储过程名(【参数】) - -参数格式(参数类型 参数名 数据类型) - -参数类型有三种 - -IN:输入参数,改参数的值必须在调用该存储过程时指定,在存储过程内部使用,不能返回。缺省值是IN - -OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - -INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回 \ No newline at end of file diff --git "a/05 \350\260\242\351\223\226\346\265\251/20230926.md" "b/05 \350\260\242\351\223\226\346\265\251/20230926.md" deleted file mode 100644 index 17d49f87a5a738181468fb123df8d7659f99cc3b..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/20230926.md" +++ /dev/null @@ -1,70 +0,0 @@ -#第14章_视图的课后练习 - -USE view_db; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE VIEW employees_vu AS SELECT -last_name 姓名, -employee_id 员工号, -department_id 部门号 -FROM employees; -#2. 显示视图的结构 -desc employees_vu; -#3. 查询视图中的全部内容 -SELECT * FROM employees_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -CREATE or REPLACE view employees_vu(last_name,employee_id,department_id) -AS -SELECT last_name,employee_id,department_id -from employees -WHERE department_id=80; -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -CREATE or REPLACE VIEW emp_v1 -AS -SELECT last_name,salary,email -from employees -WHERE phone_number like '011%'; -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -CREATE or REPLACE view emp_v1 -AS -SELECT last_name,salary,email,phone_number -FROM employees -WHERE -phone_number like'011%'and email like '%e%'; -SELECT * FROM emp_v1; -#3. 向 emp_v1 插入一条记录,是否可以? -desc emp_v1; -INSERT into emp_v1 VALUES -('sadasdsada1',55555,'asdafaf','411651616'); - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE emp_v1 set salary=salary+1000; -#5. 删除emp_v1中姓名为Olsen的员工 -DELETE FROM emp_v1 WHERE last_name='Olsen'; -SELECT * from emp_v1 WHERE last_name='Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -CREATE or REPLACE view emp_v2 -AS -SELECT department_id,max(salary) -FROM employees -GROUP BY department_id -HAVING max(salary) > 12000; -SELECT * FROM emp_v2; - -#7. 向 emp_v2 中插入一条记录,是否可以? -desc emp_v2; -INSERT into emp_v2 VALUES -(60,18880); - - -#8. 删除刚才的emp_v2 和 emp_v1 -DROP emp_v2 and emp_V1 \ No newline at end of file diff --git "a/05 \350\260\242\351\223\226\346\265\251/9.20.md" "b/05 \350\260\242\351\223\226\346\265\251/9.20.md" deleted file mode 100644 index a750feb85e8d51af308a79d4f45b9332e826f4ea..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/9.20.md" +++ /dev/null @@ -1,737 +0,0 @@ -``` -create database text01 charset utf8; -use text01; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - - - - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -#理解1:计算12月的基本工资 - select sum(salary * 12) 工资总和 from employees ; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - select sum(salary * 12) + sum(salary * 12 * commission_pct) 实发工资 from employees; - select sum(salary * 12 + salary * 12 * ifnull(commission_pct,0)) 实发工资 from employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - select distinct(job_id) from employees; - -# 3.查询工资大于12000的员工姓名和工资 - select first_name 姓名,salary 工资 from employees where salary > 12000; - -# 4.查询员工号为176的员工的姓名和部门号 - select first_name 姓名,department_id 部门号 from employees where employee_id = 176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - desc departments; - select * from departments; - - - -# 第04章_运算符课后练习 -# 1.选择工资不在5000到12000的员工的姓名和工资 - select first_name 姓名,salary 工资 from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - select first_name 姓名,department_id 部门号 from employees where department_id in(20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - select first_name 姓名,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,奖金和奖金级别 - select first_name 姓名,e.salary*commission_pct 奖金,grade_level 奖金级别 from employees e left join job_grades j on e.salary*commission_pct between j.lowest_sal and j.highest_sal where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - select first_name 姓名 from employees where first_name like '__尔'; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - select * from employees where last_name like '%特%' and last_name like '%尔%' - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - select * from employees where first_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - select first_name 姓名,job_title 工种 from employees e left join jobs j on e.job_id=j.job_id where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,108 的员工姓名、工资、管理者id - select first_name 员工姓名,salary 工资,manager_id 管理者id from employees where manager_id in(100,101,108) - - - - -#第05章_排序与分页的课后练习 - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - select first_name 姓名,department_id 部门号,(salary * 12) 年薪 from employees order by 年薪 desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - select * from employees where salary not between 8000 and 17000 order by salary desc limit 21,19; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - select * from employees where email like '%e%' order by char_length(email) desc,department_id; - - - - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - select first_name 姓名,e.job_id 部门号,job_title 部门名称 from employees e,jobs j where e.job_id=j.job_id - -# 2.查询90号部门员工的job_id和90号部门的location_id - select job_id,location_id from employees e,departments d where e.department_id = d.department_id and e.department_id = 90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - select last_name ,department_name ,d.location_id ,city - from employees e,departments d,locations l - where e.department_id = d.department_id and d.location_id = l.location_id and commission_pct is not null; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - - #子查询 - select last_name ,job_id ,b.department_id ,department_name from employees e, - (select department_id ,department_name from departments where location_id = - (select location_id from locations where city = '多伦多')) b where e.department_id=b.department_id; - - #连表查 - select last_name ,job_id ,d.department_id ,department_name - from locations l ,departments d ,employees e - where l.location_id = d.location_id and d.department_id = e.department_id and city = '多伦多'; - - -#sql92语法(自然连接): - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - #select * from locations join departments join employees where department_name = '行政部'; - select d.department_name 部门名称,l.street_address 部门地址,e.first_name 姓名,j.job_title 工作,e.salary 工资 from locations l - left join departments d on l.location_id = d.location_id - left join employees e on d.department_id = e.department_id - right join jobs j on e.job_id = j.job_id where d.department_name = '行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - select e1.last_name 员工姓名,e1.employee_id 员工编号,e2.last_name 上级姓名,e2.employee_id 上级的员工编号 from employees e1,employees e2 where e1.manager_id =e2.employee_id - -# 7.查询哪些部门没有员工 - select department_name 部门名称 from departments d left join employees e on d.department_id = e.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - select city 没有部门的城市 from locations where location_id not in - (select distinct(location_id) from departments); - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - select * from employees where department_id in - (select department_id from departments where department_name in('销售部','信息技术部')); - - - - -# 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees ; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - select j.job_id, max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 - from jobs j left join employees e on j.job_id = e.job_id group by j.job_id; - -#4.选择各个job_id的员工人数 - select j.job_id,count(j.job_id) from jobs j left join employees e on j.job_id = e.job_id group by j.job_id; - -# 5.查询员工最高工资和最低工资的差距 - select max(salary)-min(salary) 最高工资和最低工资的差距 from employees ; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - select e1.manager_id,min(e1.salary) 最低工资 - from employees e1 right join employees e2 on e1.manager_id = e2.employee_id - where e1.salary >6000 group by e1.manager_id - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - select d.department_name 部门名,d.location_id,count(e.department_id) 员工数量,avg(e.salary) 平均工资 - from employees e right join departments d on e.department_id = d.department_id - group by d.department_id order by 平均工资 desc - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - select d.department_name 部门名,j.job_title 工种名,min(e.salary) 最低工资 from jobs j right join employees e on j.job_id = e.job_id left join departments d on e.department_id = d.department_id group by j.job_id,d.department_id; - - - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - select last_name 员工姓名,salary 工资 from employees where department_id = - (select department_id from employees where last_name = '兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - #select l.location_id, avg(e.salary) 平均工资 from locations l right join departments d on l.location_id = d.location_id left join employees e on d.department_id = e.department_id group by l.location_id; - - select employee_id,first_name,salary from employees where salary>(select avg(salary) from employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - select last_name, job_id, salary from employees where salary > - (select max(e.salary) from jobs j left join employees e on j.job_id = e.job_id where j.job_id = 'SA_MAN'); - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - #select * from employees where last_name like '' -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - select employee_id 员工号 from employees where department_id in - (select department_id from departments where location_id = 1700); - -#6.查询管理者是 金 的员工姓名和工资 - select last_name 姓名,salary 工资 from employees where manager_id in - (select employee_id from employees where last_name = '金'); - -#7.查询工资最低的员工信息: last_name, salary - select last_name,salary from employees where salary = - (select min(salary) from employees); - - - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - # 连表查 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - # 子查询 - select d.*,a.平均工资 from departments d right join - (select department_id,avg(salary) 平均工资 from employees group by department_id having avg(salary) = - (select avg(salary) 平均工资 from employees group by department_id order by 平均工资 limit 0,1)) a - on d.department_id = a.department_id; - - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 - select j.*,avg(e.salary) 平均工资 - from jobs j right join employees e on j.job_id = e.job_id group by j.job_id order by 平均工资 desc limit 0,1; - -#11.查询平均工资高于公司平均工资的部门有哪些? - select d.department_name 部门名,avg(e.salary) 平均工资 - from departments d right join employees e on d.department_id = e.department_id - group by d.department_id having 平均工资 > (select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - select * from employees where employee_id in - (select distinct(a.employee_id) from - (select e2.* from employees e1 left join employees e2 on e1.manager_id = e2.employee_id) a); - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - select * from employees where employee_id in - (select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - select min(e.salary) 最低工资 from employees e right join - (select department_id,max(salary) 最高工资 from employees group by department_id order by 最高工资 limit 0,1) a - on e.department_id = a.department_id ; - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - select last_name, department_id, email, salary from employees where employee_id = - (select employee_id from employees e right join - (select department_id,avg(salary) 平均工资 from employees group by department_id order by 平均工资 desc limit 0,1) a - on e.department_id = a.department_id limit 0,1); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - select job_id from jobs where job_id != 'ST_CLERK'; - -#16. 选择所有没有管理者的员工的last_name - select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - select * from employees where last_name = 'De Haan' - -#方式2: - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - select e.employee_id 员工号,e.last_name 姓名,e.salary 工资,a.平均工资 from employees e left join - (select department_id,avg(salary) 平均工资 from employees group by department_id) a - on e.department_id = a.department_id and e.salary > a.平均工资; - -#方式2:在FROM中声明子查询 - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - select department_name from departments where department_id in - (select distinct department_id from employees where employee_id in - (select manager_id from employees group by manager_id having count(manager_id)>5)); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - select country_id from locations where location_id in - (select location_id from departments group by location_id having count(location_id) > 2); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` \ No newline at end of file diff --git "a/05 \350\260\242\351\223\226\346\265\251/SKU\344\275\234\344\270\232.md" "b/05 \350\260\242\351\223\226\346\265\251/SKU\344\275\234\344\270\232.md" deleted file mode 100644 index 4ea5de61a19d1021cec15914462f5cbe0f3c24d8..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/SKU\344\275\234\344\270\232.md" +++ /dev/null @@ -1,169 +0,0 @@ -~~~mysql -spu与sku: - -1.SPu指的是商品,spu届性就是不会影响到库存和价格的属性,又 -叫关键属性,与商品是一对一的关系 - -2.sku指的是具体规格单品,sku属性就是会影响到库存和价格的属性 -又叫销售属性,与商品是多对一的关系 - -3.一个spu有多个sku -~~~ - - - -~~~mysql - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:27:34 */ -/*==============================================================*/ -CREATE DATABASE uu charset utf8; -use uu; - -drop table if exists property; - -drop table if exists property_value; - -drop table if exists sku; - -drop table if exists sku_property; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: property */ -/*==============================================================*/ -create table property -( - property_id int not null auto_increment, - property_name char(10) not null, - primary key (property_id) -); - -/*==============================================================*/ -/* Table: property_value */ -/*==============================================================*/ -create table property_value -( - property_value_id int not null auto_increment, - property_value_name char(20) not null, - primary key (property_value_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_inventory varchar(50) not null, - sku_price float(7,0) not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: sku_property */ -/*==============================================================*/ -create table sku_property -( - sku_property_id int not null auto_increment, - sku_id int, - property_id int, - property_value_id int, - primary key (sku_property_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_particulars varchar(100) not null, - primary key (spu_id) -); - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -alter table sku_property add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table sku_property add constraint FK_Relationship_3 foreign key (property_id) - references property (property_id) on delete restrict on update restrict; - -alter table sku_property add constraint FK_Relationship_4 foreign key (property_value_id) - references property_value (property_value_id) on delete restrict on update restrict; - - --- 商品表 -INSERT INTO spu VALUES -(1,'华为mate60','遥遥领先'), -(2,'畅享15plus','巨巨坑'); - - --- 规格表 -INSERT INTO sku VALUES -(1,1,'华为 mate60 pro 256G 雅丹黑','60',6999), -(2,1,'华为 mate60 pro 256G 雅川青','60',6999), -(3,1,'华为 mate60 pro 256G 南糥紫','66',6999), -(4,1,'华为 mate60 pro 512G 雅丹黑','80',7999), -(5,1,'华为 mate60 pro 512G 雅川青','120',7999), -(6,1,'华为 mate60 pro 512G 南糥紫','90',7999); - - --- 属性表 -INSERT INTO property VALUES -(1,'颜色'), -(2,'内存'); - - --- 属性值表 -INSERT INTO property_value VALUES -(1,'雅丹黑'), -(2,'雅川青'), -(3,'南糥紫'), -(4,'256G'), -(5,'512G'); - - - --- 规格属性关联表 -INSERT INTO sku_property VALUES -(1,1,1,1),-- 256G 雅丹黑 -(2,1,2,4),-- 256G 雅丹黑 -(3,2,1,2),-- 256G 雅川青 -(4,2,2,4),-- 256G 雅川青 -(5,3,1,3),-- 256G 南糥紫 -(6,3,2,4),-- 256G 南糥紫 -(7,4,1,1),-- 512G 雅丹黑 -(8,4,2,5),-- 512G 雅丹黑 -(9,5,1,2),-- 512G 雅川青 -(10,5,2,5),-- 512G 雅川青 -(11,6,1,3),-- 512G 南糥紫 -(12,6,2,5);-- 512G 南糥紫 - - --- 自然连接全部表,查询所有信息 -select * FROM -spu s, -sku sk, -property p, -property_value pv, -sku_property sp -WHERE -s.spu_id=sk.spu_id -and sk.sku_id=sp.sku_id -and p.property_id=sp.property_id -and pv.property_value_id=sp.property_value_id; - - - -``` -~~~ - diff --git "a/05 \350\260\242\351\223\226\346\265\251/\345\233\276\344\271\246\351\246\206\344\275\234\344\270\232.md" "b/05 \350\260\242\351\223\226\346\265\251/\345\233\276\344\271\246\351\246\206\344\275\234\344\270\232.md" deleted file mode 100644 index 4b5b337ba608572dc3dc7a66e68f26aee095e6ed..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/\345\233\276\344\271\246\351\246\206\344\275\234\344\270\232.md" +++ /dev/null @@ -1,51 +0,0 @@ -图书馆作业 - -CREATE DATABASE bookstore CHARSET utf8; -use bookstore; -CREATE table admi( -admi_Id VARCHAR(20) not null, -admi_name VARCHAR(20) not null, -admi_age VARCHAR(20) not null, -admi_gender VARCHAR(20) not null, -PRIMARY key(admi_id) -); -CREATE table library( -li_id VARCHAR(20) not null PRIMARY key, -li_address VARCHAR(20) not null, -admi_Id VARCHAR(20) not null, -FOREIGN key (admi_id)REFERENCES admi(admi_id) -); -CREATE table books( -book_id VARCHAR(20) PRIMARY key, -book_name VARCHAR(20), -li_id VARCHAR(20) not null, -FOREIGN key (li_id)REFERENCES library(li_id) -); -CREATE table student( -st_id VARCHAR(20), -st_name VARCHAR(20), -st_age VARCHAR(20), -st_gender VARCHAR(20), -book_id VARCHAR(20), -FOREIGN key (book_id) REFERENCES books(book_id) -); -CREATE table press( -pr_id VARCHAR(20), -pr_name VARCHAR(20), -pr_phone VARCHAR(20), -pr_add VARCHAR(20), -book_id VARCHAR(20), -FOREIGN key (book_id) REFERENCES books(book_id) -); - -笔记 - -软件 powerpesigner - -第一步 创建概念模型 - -第二部 转成逻辑模型 ldk - -第三部 转换成物理模型pdk - -第四步 生成DDL \ No newline at end of file diff --git "a/05 \350\260\242\351\223\226\346\265\251/\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" "b/05 \350\260\242\351\223\226\346\265\251/\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" deleted file mode 100644 index 693b8f30d2b9c5d0115e71fb345e9c7f6b9b4cf2..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" +++ /dev/null @@ -1,9 +0,0 @@ -大二更加讲究实际应用也就是实操,难度会比大一更加困难 - -大一更多的是理论 - -实训内容 - -1. Linux 服务器: Nginx,MongoDB -2. 项目中可能实现的技术: 中间件、鉴别权限 -3. 如果时间允许 小程序 \ No newline at end of file diff --git "a/05 \350\260\242\351\223\226\346\265\251/\347\254\254\344\270\211\346\254\241\347\254\224\350\256\260.md" "b/05 \350\260\242\351\223\226\346\265\251/\347\254\254\344\270\211\346\254\241\347\254\224\350\256\260.md" deleted file mode 100644 index 3d317f5929163fe123931ba10e5c0ac1d746089e..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/\347\254\254\344\270\211\346\254\241\347\254\224\350\256\260.md" +++ /dev/null @@ -1,19 +0,0 @@ -笔记 - -第一范式: - -要求字段的内容,不可再分割,为的是保证数据的原子性 - -例:姓名,省份、城市、区具、地址址 - -第二范式: - -要求在满足第一范式的基础上,要求非主键字投要完全依赖主健(非主键雪完全依赖整个联合主键,而不只很赖部分) - -小明的存在,公须贾依父亲和母亲的存在 - -第三范式: - -满足第二范式的前提下,要求非主键属性要有接依赖于主键 - -示例:儿子依赖爸爸,爸爸依赖爷爷。其中儿子与爷爷属于间接依赖,则不属于第三范式,学生表中建议不要写专业,院级系,将他们分开写,否则将很难修改,还占内存 \ No newline at end of file diff --git "a/05 \350\260\242\351\223\226\346\265\251/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232.md" "b/05 \350\260\242\351\223\226\346\265\251/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232.md" deleted file mode 100644 index b7c12439a525cf5d45981a0dc5f2ec17cf6d2a72..0000000000000000000000000000000000000000 --- "a/05 \350\260\242\351\223\226\346\265\251/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232.md" +++ /dev/null @@ -1,67 +0,0 @@ -1 表之间的关系 - -1.一对一的关系:将其中任一表中主键,放到另一个表当外键; - -2.一对多的关系:将一所在的表的主键,放到多的表当外键 - -3.多对多的关系:必须第三张表,将前面两个表的主键放进来当外键 - -2 数据库设计的方法 - -1.直观设计法 - -2.规范设计法:E-R模型; - -3.计算机辅助设计法:PowerDesigner - -3 E-R图:实体关系图 - -要素:实体(表)、属性(字段)、关系(类似外键约束) - -作业 - -CREATE DATABASE xch charset utf8; -use xch; -CREATE TABLE yuanxi( -yuanxi_id int auto_increment PRIMARY key, -yuanxi_name VARCHAR(10) -); -INSERT INTO yuanxi VALUES -(111,'软件工程'), -(222,'城乡建筑'), -(333,'医学护理'); -CREATE TABLE zuanye( -zuanye_name VARCHAR(10), -zuanye_id int auto_increment primary key, -yuanxi_id int, -FOREIGN key (yuanxi_id) REFERENCES yuanxi(yuanxi_id) -); -INSERT into zuanye VALUES -('软件技术',11,111), -('建筑设计',22,222), -('产后护理',33,333); -CREATE TABLE banji( -banji_id int , -banji_name VARCHAR(10), -nianji VARCHAR(10), -zuanye_id int, -FOREIGN key (zuanye_id) REFERENCES zuanye(zuanye_id) -); -INSERT into banji VALUES -(1,'软件技术2班',22,11), -(2,'建筑设计1班',22,22), -(3,'产后护理1班',22,33); -CREATE TABLE classroom( -classroom_id int PRIMARY key, -classroom_name VARCHAR(10) -); -INSERT into classroom VALUES -(1111,'翻斗花园一'), -(2222,'翻斗花园二'), -(3333,'翻斗花园三'); -CREATE table kecheng -CREATE TABLE student( -student_id int UNION not null, -student_name VARCHAR(10), -student_age int, -); \ No newline at end of file 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" deleted file mode 100644 index 5ca897e99098fd6a02b9cda175cb0f01c9fbe17f..0000000000000000000000000000000000000000 --- "a/06 \351\231\210\345\277\227\344\274\237/20230905.md" +++ /dev/null @@ -1,31 +0,0 @@ -## 大二任务 - -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" deleted file mode 100644 index 96ed90af3c587792cd99ef325416330b260fe12b..0000000000000000000000000000000000000000 --- "a/06 \351\231\210\345\277\227\344\274\237/20230906.md" +++ /dev/null @@ -1,19 +0,0 @@ -### 一对一 - -将其中任意一个表中的主键放到另一个表中当外键 - -### 一对多 - -将一的主键放到多的表中当外键 - -### 多对多 - -必须引进第三张表,将前面两个表的主键当作该表的外键 - -## 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" deleted file mode 100644 index 32e67c2027729236a3a46e191efaa2c3e75df3e8..0000000000000000000000000000000000000000 --- "a/06 \351\231\210\345\277\227\344\274\237/20230907.md" +++ /dev/null @@ -1,105 +0,0 @@ - ## 数据库范式 - -### 第一范式 - -要求字段的内容,不可再分割,为的是保证数据的原子性 - -例如:淘宝的地址信息,一个地址可以拆分为很多,省、市、区、街道和详细地址。 - -### 第二范式 - -要求在满足第一范式的基础上,还要满足数据表里的每一条数据记录,都是可唯一标识的,要求非主键字段要完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 - -例如:你的诞生一定离不开你爸妈。 - -举例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/20230908.md" "b/06 \351\231\210\345\277\227\344\274\237/20230908.md" deleted file mode 100644 index 5bfc1e28c176af08beda8c4ee00521964ab875b6..0000000000000000000000000000000000000000 --- "a/06 \351\231\210\345\277\227\344\274\237/20230908.md" +++ /dev/null @@ -1,145 +0,0 @@ -## 笔记 - -PowerDesigner制作ER图可以转换成数据库形式,操作形式如下: - -第一步:创建概念模型(类似ER图) CDM 以用户角度 - -第二步:转换成逻辑模型 LDM 以计算机角度 - -第三步:转换成物理 PDM 以数据角度 - -第四步:生成DDL - -## ER图 - -![8750562da5843903a5aeabd6c0b120d](https://s2.loli.net/2023/09/11/PlZvLfmqhsAMuyw.png) - -## sql代码 - -```sql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 20:20:24 */ -/*==============================================================*/ -CREATE DATABASE bookes charset utf8; -use bookes; - -drop table if exists book; - -drop table if exists guanli; - -drop table if exists jie; - -drop table if exists librarian; - -drop table if exists library; - -drop table if exists reader; - -drop table if exists system; - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - bo_id char(10) not null, - sys_id int not null, - bo_name char(10) not null, - bo_author char(10) not null, - primary key (bo_id) -); - -/*==============================================================*/ -/* Table: guanli */ -/*==============================================================*/ -create table guanli -( - sys_id int not null, - rar_id int not null, - primary key (sys_id, rar_id) -); - -/*==============================================================*/ -/* Table: jie */ -/*==============================================================*/ -create table jie -( - bo_id char(10) not null, - re_id int not null, - rar_id int, - primary key (bo_id, re_id) -); - -/*==============================================================*/ -/* Table: librarian */ -/*==============================================================*/ -create table librarian -( - rar_id int not null auto_increment, - lib_id int not null, - rar_name varchar(20) not null, - rar_sex varchar(1) not null, - rar_age int not null, - primary key (rar_id) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - lib_id int not null auto_increment, - lib_name varchar(10) not null, - lib_add varchar(100) not null, - primary key (lib_id) -); - -/*==============================================================*/ -/* Table: reader */ -/*==============================================================*/ -create table reader -( - re_id int not null auto_increment, - re_name varchar(5) not null, - re_age int not null, - re_tel numeric(11,0) not null, - primary key (re_id) -); - -/*==============================================================*/ -/* Table: system */ -/*==============================================================*/ -create table system -( - sys_id int not null auto_increment, - sys_mian decimal(4,1) not null, - sys_add varchar(100) not null, - sys_tel numeric(11,0) not null, - primary key (sys_id) -); - -alter table book add constraint FK_lay foreign key (sys_id) - references system (sys_id) on delete restrict on update restrict; - -alter table guanli add constraint FK_guanli foreign key (sys_id) - references system (sys_id) on delete restrict on update restrict; - -alter table guanli add constraint FK_guanli2 foreign key (rar_id) - references librarian (rar_id) on delete restrict on update restrict; - -alter table jie add constraint FK_jie foreign key (bo_id) - references book (bo_id) on delete restrict on update restrict; - -alter table jie add constraint FK_jie2 foreign key (re_id) - references reader (re_id) on delete restrict on update restrict; - -alter table jie add constraint FK_mate foreign key (rar_id) - references librarian (rar_id) on delete restrict on update restrict; - -alter table librarian add constraint FK_manage foreign key (lib_id) - references library (lib_id) on delete restrict on update restrict; - - -``` - diff --git "a/06 \351\231\210\345\277\227\344\274\237/20230912.md" "b/06 \351\231\210\345\277\227\344\274\237/20230912.md" deleted file mode 100644 index 5d14eeab2034413adbf550cb036af7b4e100b0dc..0000000000000000000000000000000000000000 --- "a/06 \351\231\210\345\277\227\344\274\237/20230912.md" +++ /dev/null @@ -1,148 +0,0 @@ -# 作业 9/12 - - - -```MYSQL -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 11:33:36 */ -/*==============================================================*/ -CREATE DATABASE film charset utf8; -use film; - -drop table if exists Commenttype; - -drop table if exists `comment`; - -drop table if exists commentssection; - -drop table if exists country; - -drop table if exists `language`; - -drop table if exists movie; - -drop table if exists movieteam; - -drop table if exists movietypes; - -/*==============================================================*/ -/* Table: Commenttype */ -/*==============================================================*/ -create table Commenttype -( - Commenttype_id int not null auto_increment, - comment_id int not null, - Commenttype_name varchar(10) not null, - primary key (Commenttype_id) -); - -/*==============================================================*/ -/* Table: comment */ -/*==============================================================*/ -create table `comment` -( - comment_id int not null auto_increment, - comment_user varchar(10) not null, - comment_time datetime not null, - comment_content varchar(255) not null, - primary key (comment_id) -); - -/*==============================================================*/ -/* Table: commentssection */ -/*==============================================================*/ -create table commentssection -( - commentssection_id int not null auto_increment, - movie_id int not null, - commentssection_theme varchar(20) not null, - commentssection_source varchar(5) not null, - commentssection_time datetime not null, - primary key (commentssection_id) -); - -/*==============================================================*/ -/* Table: country */ -/*==============================================================*/ -create table country -( - country_id int not null auto_increment, - country_name varchar(10) not null, - primary key (country_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - language_id int not null auto_increment, - language varchar(10) not null, - primary key (language_id) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_id int not null auto_increment, - movietypes_id int not null, - country_id int not null, - comment_id int not null, - language_id int not null, - movie_name varchar(20) not null, - movie_time int not null, - movie_alias varchar(20) not null, - movie_data datetime not null, - TMDB varchar(20) not null, - movie_intro varchar(255) not null, - movie_awards varchar(100) not null, - movie_score decimal(2,1) not null, - primary key (movie_id) -); - -/*==============================================================*/ -/* Table: movieteam */ -/*==============================================================*/ -create table movieteam -( - movieteam_id int not null auto_increment, - movie_id int not null, - movieteam_name varchar(10) not null, - movieteam_age char(1) not null, - movieteam_status varchar(10) not null, - primary key (movieteam_id) -); - -/*==============================================================*/ -/* Table: movietypes */ -/*==============================================================*/ -create table movietypes -( - movietypes_id int not null auto_increment, - movietypes_name varchar(5) not null, - primary key (movietypes_id) -); - -alter table Commenttype add constraint FK_Relationship_5 foreign key (comment_id) - references comment (comment_id) on delete restrict on update restrict; - -alter table commentssection add constraint FK_Relationship_7 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_1 foreign key (movietypes_id) - references movietypes (movietypes_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_2 foreign key (country_id) - references country (country_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_3 foreign key (language_id) - references language (language_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_4 foreign key (comment_id) - references comment (comment_id) on delete restrict on update restrict; - -alter table movieteam add constraint FK_Relationship_6 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; \ No newline at end of file diff --git "a/06 \351\231\210\345\277\227\344\274\237/20230913.md" "b/06 \351\231\210\345\277\227\344\274\237/20230913.md" deleted file mode 100644 index ecf342ed43b90cb0cdafa3c6e3b0f3e20cd1ce0c..0000000000000000000000000000000000000000 --- "a/06 \351\231\210\345\277\227\344\274\237/20230913.md" +++ /dev/null @@ -1,196 +0,0 @@ -E_R图 - -![image-20230914113357495](https://s2.loli.net/2023/09/14/hazeIFEfy73VDsn.png) - -# 代码 - -```MYSQL -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 11:17:52 */ -/*==============================================================*/ -CREATE DATABASE hospital1 charset utf8; -use hospital1; - -drop table if exists aaa; - -drop table if exists administrative; - -drop table if exists doctor; - -drop table if exists doctor_patients; - -drop table if exists drug; - -drop table if exists hospital; - -drop table if exists patients; - -drop table if exists patients_reception; - -drop table if exists prescription; - -drop table if exists prescription_drug; - -drop table if exists reception; - -/*==============================================================*/ -/* Table: aaa */ -/*==============================================================*/ -create table aaa -( - durg_id int not null, - reception_id int not null, - primary key (durg_id, reception_id) -); - -/*==============================================================*/ -/* Table: administrative */ -/*==============================================================*/ -create table administrative -( - administrative_id int not null auto_increment, - hospital_id char(10), - administrative����name varchar(40) not null, - primary key (administrative_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - administrative_id int, - doctor_name varchar(20) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: doctor_patients */ -/*==============================================================*/ -create table doctor_patients -( - patients_id int not null, - doctor_id int not null, - primary key (patients_id, doctor_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - durg_id int not null auto_increment, - drug_name varchar(50) not null, - drug_mioney varchar(100) not null, - primary key (durg_id) -); - -/*==============================================================*/ -/* Table: hospital */ -/*==============================================================*/ -create table hospital -( - hospital_id char(10) not null, - hospital_name varchar(40) not null, - primary key (hospital_id) -); - -/*==============================================================*/ -/* Table: patients */ -/*==============================================================*/ -create table patients -( - patients_id int not null auto_increment, - prescribe_id char(10), - patients_name varchar(20) not null, - primary key (patients_id) -); - -/*==============================================================*/ -/* Table: patients_reception */ -/*==============================================================*/ -create table patients_reception -( - patients_id int not null, - reception_id int not null, - primary key (patients_id, reception_id) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - prescribe_time char(10) not null, - prescribe_id char(10) not null, - doctor_id int, - reception_id int, - patients_id int, - prescribe_amount char(10) not null, - primary key (prescribe_id) -); - -/*==============================================================*/ -/* Table: prescription_drug */ -/*==============================================================*/ -create table prescription_drug -( - durg_id int not null, - prescribe_id char(10) not null, - primary key (durg_id, prescribe_id) -); - -/*==============================================================*/ -/* Table: reception */ -/*==============================================================*/ -create table reception -( - reception_id int not null auto_increment, - reception_name varchar(10) not null, - primary key (reception_id) -); - -alter table aaa add constraint FK_aaa foreign key (durg_id) - references drug (durg_id) on delete restrict on update restrict; - -alter table aaa add constraint FK_aaa2 foreign key (reception_id) - references reception (reception_id) on delete restrict on update restrict; - -alter table administrative add constraint FK_Relationship_6 foreign key (hospital_id) - references hospital (hospital_id) on delete restrict on update restrict; - -alter table doctor add constraint FK_Relationship_7 foreign key (administrative_id) - references administrative (administrative_id) on delete restrict on update restrict; - -alter table doctor_patients add constraint FK_doctor_patients foreign key (patients_id) - references patients (patients_id) on delete restrict on update restrict; - -alter table doctor_patients add constraint FK_doctor_patients2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table patients add constraint FK_prescription_patients2 foreign key (prescribe_id) - references prescription (prescribe_id) on delete restrict on update restrict; - -alter table patients_reception add constraint FK_patients_reception foreign key (patients_id) - references patients (patients_id) on delete restrict on update restrict; - -alter table patients_reception add constraint FK_patients_reception2 foreign key (reception_id) - references reception (reception_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_doctor_prescribe foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription_patients foreign key (patients_id) - references patients (patients_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_price_statistics foreign key (reception_id) - references reception (reception_id) on delete restrict on update restrict; - -alter table prescription_drug add constraint FK_prescription_drug foreign key (durg_id) - references drug (durg_id) on delete restrict on update restrict; - -alter table prescription_drug add constraint FK_prescription_drug2 foreign key (prescribe_id) - references prescription (prescribe_id) on delete restrict on update restrict; - diff --git "a/06 \351\231\210\345\277\227\344\274\237/20230914.md" "b/06 \351\231\210\345\277\227\344\274\237/20230914.md" deleted file mode 100644 index 1866932021818dfcf65aa45b50dc989bd888440e..0000000000000000000000000000000000000000 --- "a/06 \351\231\210\345\277\227\344\274\237/20230914.md" +++ /dev/null @@ -1,15 +0,0 @@ -复习ER图 - -第一步:创建概念模型图(CDM)以用户角度 - -第二步:转换逻辑模型图(LDM)以计算机角度 - -第三步:转换物理模型图(PDM)以数据角度 - -第四步:生成DDL - -表与表的关系:一个表里的几条记录对应另一个表的几条记录 - -数据库范式在实际中不会完全按照范式,根据需求实际操作 - -[【数据库E-R图知识点和相关习题(复试真题)】_e—r模型的题及答案_Penroseblog的博客-CSDN博客](https://blog.csdn.net/qq_44875230/article/details/123584355?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-1-123584355-blog-106179701.235^v38^pc_relevant_anti_t3&spm=1001.2101.3001.4242.2&utm_relevant_index=4) \ No newline at end of file diff --git "a/06 \351\231\210\345\277\227\344\274\237/20230915.md" "b/06 \351\231\210\345\277\227\344\274\237/20230915.md" deleted file mode 100644 index 2ea59421aefd640e8caa897c137c730d58efd245..0000000000000000000000000000000000000000 --- "a/06 \351\231\210\345\277\227\344\274\237/20230915.md" +++ /dev/null @@ -1,210 +0,0 @@ -![image-20230917220642520](https://s2.loli.net/2023/09/17/rbkQX1HenwVu8z5.png) - -````mysql - -# 应用场景: - -```m --- 1.查询特定销售员的销售记录 --- 2.查找销售记录中销售价格最高的汽车 --- 3.统计某个销售员的销售总额 --- 4.根据客户信息查询其购买过的汽车 --- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 --- 6.检索特定日期范围内的销售了哪些汽车 --- 7.查找某车型的销售历史。 --- 8.统计每个销售员的销售数量 - -``` - -```mysql -/*==============================================================*/ -/* DBMS name:czw MySQL 5.0 */ -/* Created on: 2023-09-15 08:55:58 */ -/*==============================================================*/ - -create database no_money_car charset utf8; - -use no_money_car; - -drop table if exists admin; - -drop table if exists car; - -drop table if exists car_brand; - -drop table if exists car_type; - -drop table if exists guke; - -drop table if exists xiaoshou; - -/*==============================================================*/ -/* Table: car_brand */ -/*==============================================================*/ -create table car_brand -( - car_brand_id int not null auto_increment, - car_brand_name varchar(20) not null, - primary key (car_brand_id) -); - -insert into car_brand values -(0,'宝马'), -(0,'大众'), -(0,'奔驰'), -(0,'玛莎拉蒂'); - -/*==============================================================*/ -/* Table: car_type */ -/*==============================================================*/ -create table car_type -( - car_type_id int not null auto_increment, - car_type_name varchar(10) not null, - primary key (car_type_id) -); - -insert into car_type values -(0,'SUV'), -(0,'轿车'), -(0,'货车'), -(0,'跑车'); - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - car_type_id int, - car_brand_id int, - car_name varchar(20) not null, - car_money numeric(8,1) not null, - primary key (car_id) -); - -insert into car values -(0,4,4,'B24',8851507.0), -(0,1,1,'A57',6505841.0), -(0,2,3,'蹦蹦',3548060.0), -(0,2,1,'486',7516152.0); - -/*==============================================================*/ -/* Table: guke */ -/*==============================================================*/ -create table guke -( - guke_id int not null auto_increment, - guke_name varchar(6) not null, - guke_tel varchar(11) not null, - primary key (guke_id) -); - -insert into guke values -(0,'刘总','15825681476'), -(0,'张总','18813681156'), -(0,'周总','17447681479'), -(0,'笑总','14563681278'); - -/*==============================================================*/ -/* Table: xiaoshou */ -/*==============================================================*/ -create table xiaoshou -( - xiaoshou_id int not null auto_increment, - xiaoshou_name varchar(6) not null, - xiaoshou_tel char(11) not null, - primary key (xiaoshou_id) -); - -insert into xiaoshou values -(0,'马量','16573821841'), -(0,'司马易','13828921841'), -(0,'孙武空','12815824841'); - -/*==============================================================*/ -/* Table: admin */ -/*==============================================================*/ -create table admin -( - admin_id int not null auto_increment, - xiaoshou_id int, - guke_id int, - car_id int, - admin_date date not null, - primary key (admin_id) -); - -insert into admin values -(0,1,1,1,'2022-9-4'), -(0,3,4,3,'2022-9-3'), -(0,3,2,2,'2022-9-3'), -(0,1,1,3,'2022-9-5'); - --- 1.查询特定销售员的销售记录 - -select * from xiaoshou x -join admin a on x.xiaoshou_id=a.xiaoshou_id -join car c on c.car_id=a.car_id -join car_type t on c.car_type_id=t.car_type_id -join car_brand b on c.car_brand_id=b.car_brand_id -where xiaoshou_name='孙武空'; - - -- 2.查找销售记录中销售价格最高的汽车 - -select max(car_money) from car c; - - -- 3.统计某个销售员的销售总额 - -select sum(car_money) from xiaoshou x -join admin a on x.xiaoshou_id=a.xiaoshou_id -join car c on c.car_id=a.car_id where xiaoshou_name='孙武空'; - - -- 4.根据客户信息查询其购买过的汽车 - -select * from guke g -left join admin a on g.guke_id=a.guke_id -left join car c on a.car_id=c.car_id; - - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -select car_brand_name,count(car_money),sum(car_money) from car_brand b -left join car c on b.car_brand_id=c.car_brand_id group by b.car_brand_id; - - -- 6.检索特定日期范围内的销售了哪些汽车 - -select car_name from admin a -left join car c on a.car_id=c.car_id where admin_date='2022-09-03'; - - -- 7.查找某车型的销售历史。 - -select car_name,admin_date from car c -left join admin a on c.car_id=a.car_id; - - -- 8.统计每个销售员的销售数量 - -select xiaoshou_name,count(car_name) from xiaoshou x -left join admin a on x.xiaoshou_id=a.xiaoshou_id -left join car c on a.car_id=c.car_id group by x.xiaoshou_id; - -alter table admin add constraint FK_sale foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table admin add constraint FK_select foreign key (guke_id) - references guke (guke_id) on delete restrict on update restrict; - -alter table admin add constraint FK_sell foreign key (xiaoshou_id) - references xiaoshou (xiaoshou_id) on delete restrict on update restrict; - -alter table car add constraint FK_brand foreign key (car_brand_id) - references car_brand (car_brand_id) on delete restrict on update restrict; - -alter table car add constraint FK_classify foreign key (car_type_id) - references car_type (car_type_id) on delete restrict on update restrict; - - -``` - - -```` - diff --git "a/06 \351\231\210\345\277\227\344\274\237/20230919.md" "b/06 \351\231\210\345\277\227\344\274\237/20230919.md" deleted file mode 100644 index a04db479b0790944e86fbfc18fc489a5667ab23b..0000000000000000000000000000000000000000 --- "a/06 \351\231\210\345\277\227\344\274\237/20230919.md" +++ /dev/null @@ -1,742 +0,0 @@ -### mysql复习 - -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以如果遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不null,就保持原值 - -### 建立数据库 - -```mysql -create database db1 charset utf8; - -use db1; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; -``` - -### 查询 - -```mysql -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -select sum(12*salary) from employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - -select sum(salary*12+ifnull(salary*commission_pct*12,0)) from employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - -select distinct job_id from employees; - -# 3.查询工资大于12000的员工姓名和工资 - -select first_name,salary from employees where salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 - -select first_name,department_id from employees where employee_id=176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -select first_name,salary from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select first_name,department_id from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -select first_name,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select employee_id,salary,grade_level from employees e left join job_grades j on e.salary between j.lowest_sal and j.highest_sal where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select * from employees where first_name like '__尔'; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -select * from employees where last_name like '%特%' and last_name like '%尔%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select * from employees where first_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select e.first_name,j.job_title from employees e left join jobs j on e.job_id=j.job_id where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select first_name,salary,manager_id from employees where manager_id in (100,101,110); - -#第05章_排序与分页的课后练习 - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - -select first_name,department_id,salary*12 from employees order by salary*12 desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select first_name,salary from employees where salary not between 8000 and 17000 order by salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -select * from employees where email like '%e%' order by length(email) desc,department_id asc; - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - -select first_name,e.department_id,department_name from employees e left join departments d on e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -select e.job_id,d.location_id from employees e left join departments d on e.department_id=d.department_id where e.department_id=90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select e.last_name,d.department_name,d.location_id,l.city from employees e left join departments d on e.department_id=d.department_id left join locations l on d.location_id=l.location_id where commission_pct is not null; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select e.last_name,e.job_id,d.department_id,d.department_name from employees e left join departments d on e.department_id=d.department_id left join locations l on d.location_id=l.location_id where l.city='多伦多'; - -#sql92语法(自然连接): - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -select department_name,street_address,first_name,job_title,salary from jobs j,employees e,departments d,locations l where j.job_id=e.job_id and e.department_id=d.department_id and d.location_id=l.location_id and department_name='行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select e.first_name,e.employee_id,s.last_name,s.employee_id from employees e inner join employees s on e.employee_id=s.employee_id; - -# 7.查询哪些部门没有员工 - -select department_name from departments d left join employees e on d.department_id=e.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - -select city from departments d right join locations l on d.location_id=l.location_id where department_id is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select e.* from departments d,employees e where d.department_id=e.department_id and d.department_name='销售部' or d.department_name='信息技术部'; - -# 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - -select max(salary),min(salary),avg(salary),sum(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - -select job_id,max(salary),min(salary),avg(salary),sum(salary) from employees group by job_id; - -#4.选择各个job_id的员工人数 - -select job_id,count(employee_id) from employees group by job_id; - -# 5.查询员工最高工资和最低工资的差距 - -select max(salary)-min(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - -select manager_id,min(salary) from employees where manager_id is not null group by manager_id having min(salary)>6000; - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name,d.location_id,count(employee_id),avg(salary) from departments d left join employees e on d.department_id=e.department_id group by d.department_id order by avg(salary) desc; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select j.job_title,min(salary),department_name from jobs j left join employees e on j.job_id=e.job_id left join departments d on e.department_id=d.department_id group by j.job_id,d.department_id; - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - -select * from employees where department_id =(select department_id from employees where last_name='兹洛特基') and salary=(select salary from employees where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - -select employee_id,first_name,salary from employees where salary>(select avg(salary) from employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name,job_id,salary from employees where salary>(select max(salary) from employees where JOB_ID = 'SA_MAN'); - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -select employee_id,last_name from employees where department_id=(select department_id from employees where last_name like '%u%'); - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -select first_name,employee_id from employees where department_id in (select department_id from departments where location_id=1700); - -#6.查询管理者是 金 的员工姓名和工资 - -select first_name,salary from employees where manager_id in (select manager_id from employees where last_name='金'); - -#7.查询工资最低的员工信息: last_name, salary - -select last_name,salary from employees where salary=(select min(salary) from employees); - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 - -select * from departments where department_id =(select department_id from employees group by department_id having avg(salary)=(select min(s) from (select avg(salary) s from employees group by department_id) a)); - -#方式2: -# 部门平均<= 公司所有平均 - -select * from departments where department_id=(select department_id from employees group by department_id having avg(salary)<=all(select avg(salary) from employees group by department_id)); - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - -select d.*,(select avg(salary) from employees where department_id=d.department_id) from departments d where department_id =(select department_id from employees group by department_id having avg(salary)=(select min(s) from (select avg(salary) s from employees group by department_id) a)); - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -select * from jobs where job_id=(select job_id from employees group by job_id having avg(salary)=(select max(s) from (select avg(salary) s from employees group by job_id) a)); - -#方式2:平均工资>=所有平均工资 - -select * from jobs where job_id=(select job_id from employees group by job_id having avg(salary)>=all(select avg(salary) from employees group by job_id)); - -#11.查询平均工资高于公司平均工资的部门有哪些? - -select department_id from employees where department_id is not null group by department_id having avg(salary)>(select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - -select e.* from employees e inner join employees s on e.employee_id=s.manager_id; - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - -select * from employees where employee_id=any(select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - -select min(salary) from employees group by department_id having max(salary)<=all(select max(salary) from employees group by department_id); - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary - -select last_name,department_id,email,salary from employees where department_id = (select department_id from employees group by department_id having avg(salary)>=all(select avg(salary) from employees group by department_id)); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 - -select department_id from departments where department_id !=all(select department_id from employees where job_id='ST_CLERK'); - -#16. 选择所有没有管理者的员工的last_name - -select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - -select employee_id,first_name,hire_date,salary from employees e where e.manager_id=(select employee_id from employees where first_name = 'De Haan'); - -#方式2: - -select employee_id, last_name, hire_date, salary from employees e where exists(select * from employees s where e.employee_id=s.manager_id and s.first_name='De Haan'); - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - -select employee_id,last_name,salary from employees e1 where salary > (select avg(salary) from employees e2 where e2.department_id = e1.department_id); - -#方式2:在FROM中声明子查询 - -select employee_id,last_name,salary from employees e1,(select department_id,AVG(salary) s from employees e2 group by department_id) a where e1.department_id = a.department_id and e1.salary > a.s; - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - -select department_name,department_id from departments d where 5 < (select count(*) from employees e where d.department_id = e.department_id); - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -select country_id from locations l where 2 < (select count(*) from departments d where l.location_id=d.location_id); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` - diff --git "a/06 \351\231\210\345\277\227\344\274\237/20230920.md" "b/06 \351\231\210\345\277\227\344\274\237/20230920.md" deleted file mode 100644 index 52ceb55420e6d42269e64111890c4f36a5318b8b..0000000000000000000000000000000000000000 --- "a/06 \351\231\210\345\277\227\344\274\237/20230920.md" +++ /dev/null @@ -1,107 +0,0 @@ -# 笔记 - -#### RBAC:(Role-Based Access Control)基于角色的权限访问控制权限管制模型,目前权限的主流方案,核心为角色 - -数据库可以储存:业务代码,功能代码 - -User(用户):每个用户都有唯一的UID识别,并被授予不同的角色 - -Role(角色):不同角色具有不同的权限 - -Permission(权限):访问权限 - -用户-角色映射:用户和角色之间的映射关系 - -角色-权限映射:角色和权限之间的映射 - -### sku - -SKU 英文全称为Stock Keeping Unit,简称 SKU ,是产品入库后一种编码归类方法,也是库存控制的最小单位。一款商品,每个颜色,每个尺码,每一型号等都有出现一个 sku ,便于电商品牌识别商品。 - -### 作业 - -![image-20230920171301260](https://s2.loli.net/2023/09/21/9JDFtVnrSkCveOf.png) - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:24:17 */ -/*==============================================================*/ - - -drop table if exists jurisdiction; - -drop table if exists personal; - -drop table if exists personal_role; - -drop table if exists role; - -drop table if exists role_jurisdiction; - -/*==============================================================*/ -/* Table: jurisdiction */ -/*==============================================================*/ -create table jurisdiction -( - jurisdiction_id int not null auto_increment, - jurisdiction_name varchar(50) not null, - primary key (jurisdiction_id) -); - -/*==============================================================*/ -/* Table: personal */ -/*==============================================================*/ -create table personal -( - personal_id int not null auto_increment, - personal_name varchar(11) not null, - personal_pwd varchar(11) not null, - primary key (personal_id) -); - -/*==============================================================*/ -/* Table: personal_role */ -/*==============================================================*/ -create table personal_role -( - role_id int not null, - personal_id int not null, - primary key (role_id, personal_id) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name varchar(50) not null, - primary key (role_id) -); - -/*==============================================================*/ -/* Table: role_jurisdiction */ -/*==============================================================*/ -create table role_jurisdiction -( - jurisdiction_id int not null, - role_id int not null, - primary key (jurisdiction_id, role_id) -); - -alter table personal_role add constraint FK_personal_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table personal_role add constraint FK_personal_role2 foreign key (personal_id) - references personal (personal_id) on delete restrict on update restrict; - -alter table role_jurisdiction add constraint FK_role_jurisdiction foreign key (jurisdiction_id) - references jurisdiction (jurisdiction_id) on delete restrict on update restrict; - -alter table role_jurisdiction add constraint FK_role_jurisdiction2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - - -``` - diff --git "a/06 \351\231\210\345\277\227\344\274\237/20230921.md" "b/06 \351\231\210\345\277\227\344\274\237/20230921.md" deleted file mode 100644 index 0aa3b63666ae7d50f7542423196b8e86ceb3104e..0000000000000000000000000000000000000000 --- "a/06 \351\231\210\345\277\227\344\274\237/20230921.md" +++ /dev/null @@ -1,132 +0,0 @@ -### sku - -SKU是类似一款商品,每款都有出现一个SKU。一款商品有许多颜色,则是有多个SKU - -例如:一款手机,有白色,黑色,红色 - -### spu - -一般SPU 与SKU 是一对一,或者一对多的关系;如果一对多的话就是不同的规格 - -例如:spu比作商品的款,sku比作商品的数量 - -SPU指一个商品集合,一般来说就是一个集合链。一个服装的集合链会包括相似款式和不同的尺码,SKU则是最小品类单元,同一个款式的衣服不同的尺码也算不同的SKU。SKU多见于前台的商品编号,SPU多见于后台的商品管理 - - - -![image-20230921223126500](C:\Users\1761144610\AppData\Roaming\Typora\typora-user-images\image-20230921223126500.png) - - - - - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:41:07 */ -/*==============================================================*/ - -CREATE DATABASE biao charset utf8; - -use biao; - -drop table if exists lan; - -drop table if exists property; - -drop table if exists sku; - -drop table if exists spu; - -drop table if exists valuez; - -/*==============================================================*/ -/* Table: lan */ -/*==============================================================*/ -create table lan -( - lan_id int not null auto_increment, - property_id int, - values_id int, - sku_id int, - primary key (lan_id) -); - -/*==============================================================*/ -/* Table: property */ -/*==============================================================*/ -create table property -( - property_id int not null auto_increment, - property_name varchar(10) not null, - primary key (property_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(20) not null, - sku_price decimal(8,1) not null, - sku_numb int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_text text, - primary key (spu_id) -); - -/*==============================================================*/ -/* Table: valuez */ -/*==============================================================*/ -create table valuez -( - values_id int not null auto_increment, - values_name varchar(20) not null, - primary key (values_id) -); - -alter table lan add constraint FK_Relationship_1 foreign key (property_id) - references property (property_id) on delete restrict on update restrict; - -alter table lan add constraint FK_Relationship_2 foreign key (values_id) - references valuez (values_id) on delete restrict on update restrict; - -alter table lan add constraint FK_Relationship_3 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table sku add constraint FK_Relationship_4 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - - -``` - -```mysql -INSERT INTO `spu` (`spu_id`, `spu_name`, `spu_text`) VALUES (1, '红米50', '还不错哦!'); - -INSERT INTO `sku` (`sku_id`, `spu_id`, `sku_name`, `sku_price`, `sku_numb`) VALUES (1, 1, '红米 白色', 3450.0, 400); -INSERT INTO `sku` (`sku_id`, `spu_id`, `sku_name`, `sku_price`, `sku_numb`) VALUES (2, 1, '红米 黑色', 3452.0, 500); -INSERT INTO `sku` (`sku_id`, `spu_id`, `sku_name`, `sku_price`, `sku_numb`) VALUES (3, NULL, '红米 红色', 3333.0, 600); - -INSERT INTO `valuez` (`values_id`, `values_name`) VALUES (1, '红色'); -INSERT INTO `valuez` (`values_id`, `values_name`) VALUES (2, '黑色'); -INSERT INTO `valuez` (`values_id`, `values_name`) VALUES (3, '白色'); -INSERT INTO `valuez` (`values_id`, `values_name`) VALUES (4, '512'); -INSERT INTO `valuez` (`values_id`, `values_name`) VALUES (5, '252'); -INSERT INTO `valuez` (`values_id`, `values_name`) VALUES (6, '128'); - -INSERT INTO `property` (`property_id`, `property_name`) VALUES (1, '颜色'); -INSERT INTO `property` (`property_id`, `property_name`) VALUES (2, '内存'); - -``` - diff --git "a/06 \351\231\210\345\277\227\344\274\237/20230922.md" "b/06 \351\231\210\345\277\227\344\274\237/20230922.md" deleted file mode 100644 index 38ba81f3a04cb1bf08e318a15846044b06baa12a..0000000000000000000000000000000000000000 --- "a/06 \351\231\210\345\277\227\344\274\237/20230922.md" +++ /dev/null @@ -1,127 +0,0 @@ -## 数据库高级预习 - -当数据库复杂需要多条 SQL 语句查询时,可以使用存储过程去完成这个需求。 - -### 创建存储过程语法 - -使用 create procedure 语句创建存储过程 - -#### 声明语句结束符 - -```mysql -delimiter $$ - -delimiter // -``` - -#### 创建 mysql 存储过程、存储函数 - -```mysql -create procedure 存储过程名(参数) -``` - -#### 存储过程体 - -```mysql -create function 存储函数名(参数) -``` - -#### 参数类型有三种: - -```mysql -IN: 输入参数,该参数的值必须在调用该存储过程时指定,在存储过程内部使用, 不能返回。 - -缺省值是IN。 - -OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - -INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回。 -``` - -### 事务 - - 为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - -#### 事务的四个特性 - -原子性:事务包含的这一系列操作,要么全部成功,要么全部失败(由DBMS的事务管理子系统来实现)。 - -一致性:事务完成之后,不会将非法的数据写入数据库(由DBMS的完整性子系统执行测试任务)。 - -隔离性:多个事务可以在一定程度上并发执行(由DBMS的并发控制子系统实现)。 - -持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上)(由DBMS的恢复管理子系统实现的)。 - -#### 隔离级别 - - 隔离级别从低到高依次是"读未提交"、“读已提交”、“可重复读取”和“序列化”,隔离级别越高,性能越低。mysql 数据库默认隔离级别是“可重复读取”,oracle是“读已提交”。数据库底层使用的“加锁”的机制来实现不同的隔离级别,包括对整个表加锁,对表中的行加锁。 - -### 视图 - -在已有的表或者视图上创建的虚拟表。 - -#### 创建视图 - -```mysql -create view 视图名 as select -``` - -注:可以对单表或者多表进行查询,数据库会将视图的定义保存下来。 - -可以对(单表)视图进行一些增删改查操作,这些操作会影响到原始的表。 - -#### 删除视图 - -```mysql -drop view 视图名 -``` - -### 索引 - - 为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - - 注:索引类似于一本书的目录 - -#### 创建索引 - -```mysql -create index 索引名 on 表名(字段列表) -``` - -在经常作为查询条件的字段加索引,除此以外,还要在分组、过滤、排序及联合查询的字段上加索引。 - -#### 删除索引 - -```mysql -drop index 索引名 on 表名 -``` - -### 锁 - -共享锁(S锁,读锁)和排他锁(X锁,写锁)——行锁 - -``` -共享锁:若事务A 对某行数据加S锁,此时允许其他事务对该行数据加S锁,即可以有多个事务共同读取改行数 据,但是不允许其他事务对该数据加X锁 - -排他锁(X锁,写锁,独占锁):若事务A对某行数据加X锁,此时不允许其他事务对该行数据加任何锁 -``` - -数据库中 - -1. 数据库中进行增,删,改操作时,会自动给行添加排他锁,行数据添加上了排他锁,不允许其他事务对该行数据加任何锁 -2. 数据库中进行查(select)操作时,对数据不加任何锁 - -1. 给行数据手动添加共享锁: - - ```mysql - select ..from..lock in share mode - select..from .. for share - ``` - -2. 添加排他锁: - - ```mysql - select...from...for update - ``` - - \ No newline at end of file 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" deleted file mode 100644 index 97896ba2e3d6760269933247109daa97095216fa..0000000000000000000000000000000000000000 Binary files "a/06 \351\231\210\345\277\227\344\274\237/\346\215\225\350\216\267.PNG" and /dev/null differ diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230905\347\254\224\350\256\260\344\270\200.md" "b/07 \345\210\230\346\226\207\351\224\213/20230905\347\254\224\350\256\260\344\270\200.md" deleted file mode 100644 index 4431652f528cc5637a24b8f0dc7ac43c8197c509..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230905\347\254\224\350\256\260\344\270\200.md" +++ /dev/null @@ -1,32 +0,0 @@ -### 理论知识普及 - - 大二:实际应用(实操)学习MySQL高级、MVC框架等。 - - - -大二下:1. node.js、vue.js 前端 简化开发,有UI框架配合。 - -​ 2.sppingBoot(Redis,webApi) - -​ (关系型 数据库)MongoDB:No-SQL,key-value键值对的形式存在。 - - - -大二下实训:1.Linux 服务器:NGINX - -​ 2.项目中可能实现的技术:中间件,签权,鉴别权限。 - -​ 3.小程序:uniapp移动端开发。 - - - -### 课后知识普及 - -### 1、技术栈: - -​ 一个项目要求用什么技术实现,可以称为技术选型(选方案)。 - -### 2、技能树: - -​ 一个人具备的技能。称为技术树(通俗来讲就一个人的天赋加点)。 - diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230906\347\254\224\350\256\260\344\272\214.md" "b/07 \345\210\230\346\226\207\351\224\213/20230906\347\254\224\350\256\260\344\272\214.md" deleted file mode 100644 index 691202f2e7978c7f2969a17ae3e98d5b21f07ffd..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230906\347\254\224\350\256\260\344\272\214.md" +++ /dev/null @@ -1,159 +0,0 @@ -### 数据库设计 - -关系是相互的:一个学生可以选多个课程;一个课程可以被多个学生选,必须引用第三张表。 - -表之间的关系: -1.一对一的关系:一个学生(学号,编号,身份证寒外键),只有一个身份证(身份证号) - 将其中任一表中的主键,放到另一个表当外健。 - -2.一对多的关系(多对一的关系):一个班级 (班级编号),有多个学生(学生编号)班级编号 - 将一所在的表的主键,放到多的表当外键。 - -3.多对多的关系:一个学生可以选修多门课程,一门课程可以被多个学生选修 - 必须第三张表,将前面两个表的主键放进来当外健。 - - - -数据库的设计方式: - -1.直观设计法 2.规范设计法 3.计算机辅助设计法 - - -### 什么是ER图? - -(1)概念 - ER图:实体关系图,简记E-R图,是指以实体、关系、属性三个基木概念概括数据的基木结构,从而描静态数据结构的概念模式。 - -(2)要素 - 3要素:实体、属性、和关系。 - -(3)表示 - 实体型: - 属性: - 1.用椭圆形或圆角矩形表示,与相应的实体连接起来; - 2.主属性名称下加下划线; - 联系(关系): - 1.用菱形表示,姜形框内写明联系的名称; - -​ 2.用线与实体相连,可标上联系的类型; -​ 3.联系也可以有自己的属性; -​ 4.用矩形表示,矩形框内写明实体名; - - - -~~~ sql -# 作业 - -~~~ mysql -CREATE DATABASE sc charset utf8; -use sc; -#院系表 -CREATE TABLE department( -d_id int primary KEY, -d_name VARCHAR(20) -); - -INSERT INTO department VALUES -(111,'软件工程学院'), -(112,'财经商贸学院'), -(113,'医疗医护学院'); - -# 专业表 -CREATE TABLE major( -m_id int PRIMARY KEY, -m_name VARCHAR(20), -d_id int, -foreign key(d_id) references department(d_id) -); - -INSERT into major VALUES -(11,'软件技术',111), -(22,'会计',112), -(33,'护理',113); -#班级表 -CREATE TABLE class( -cl_id int PRIMARY key, -cl_name VARCHAR(20), - grade VARCHAR(20), - m_id int, - FOREIGN key(m_id) REFERENCES major(m_id) -); - -insert into class values -(1,'软件技术2班','22级',11), -(2,'软件技术3班','21级',11), -(3,'软件技术4班','23级',11); -#教师表 -CREATE TABLE teacher( -t_id int PRIMARY key, -t_name VARCHAR(20), -t_sex VARCHAR(5) -); - -insert into teacher values -(1,'邹狠尾','男'), -(2,'温贵雯','男'), -(3,'徐永春','女'); -# 课程表 -CREATE TABLE courses( -c_id int PRIMARY key, -c_name VARCHAR(20), -t_id int, -FOREIGN KEY (t_id) REFERENCES teacher(t_id) -); -insert into courses VALUES -(1,'java',1), -(2,'html',2), -(3,'php',3); -# 学生表 -CREATE TABLE student( -s_id int PRIMARY key, -s_name VARCHAR(5), -s_sex VARCHAR(2), -c_id int, -FOREIGN key(c_id) REFERENCES class(c_id) -); - -insert into student values -(01,'小刘','男',1), -(02,'大刘','女',2), -(03,'老刘','女',3); -# 成绩表 -CREATE TABLE grades( -g_gr int, -s_id int, -c_id int, -FOREIGN KEY(s_id) REFERENCES student(s_id), -FOREIGN KEY(c_id) REFERENCES courses(c_id) -); - -INSERT into grades VALUES -(70,1,3), -(80,3,2), -(90,2,1); -#教室表 -CREATE TABLE classroom( -room_id int PRIMARY KEY, -room_name VARCHAR(20), -room_address VARCHAR(20) -); - - -insert into classroom values -(1,'实训八','望云楼'), -(2,'实训五','望云楼'), -(3,'实训三','望云楼'); -# 课程表 -CREATE TABLE curriculum( -room_id int, -cu_week VARCHAR(10), -cu_courseid int, -FOREIGN KEY(room_id) REFERENCES classroom(room_id) -); - -INSERT into curriculum VALUES -(1,'星期一',2), -(1,'星期一',3), -(1,'星期一',1); -~~~ - diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230907\347\254\224\350\256\260\344\270\211.md" "b/07 \345\210\230\346\226\207\351\224\213/20230907\347\254\224\350\256\260\344\270\211.md" deleted file mode 100644 index 043a8b11f650b379b759443de61f77a8a09063df..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230907\347\254\224\350\256\260\344\270\211.md" +++ /dev/null @@ -1,40 +0,0 @@ -### 数据库的范式 - -### 第一范式 - -要求字段的内容,不可再分割,为的是保证数据的原子性 - -例如:淘宝的地址信息,一个地址可以拆分为很多,省、市、区、街道和详细地址。 - -### 第二范式 - -要求在满足第一范式的基础上,还要满足数据表里的每一条数据记录,都是可唯一标识的,要求非主键字段要完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 - -例如:你的诞生一定离不开你爸妈。 - -举例1:成绩表(学号,课程,成绩)学号和课程合在一起才能构成主键,才能知道成绩多少。 - -举例2:比赛表(球员编号、姓名、年龄、比赛编号、比赛时间、比赛场地、得分) - -姓名和年龄只依赖球员编号 - -比赛时间和比赛场地只依赖比赛编号 - -得分依赖于球员编号和比赛编号 - -所以按照第二范式要分成三个表 - -### 第三范式 - -满足第二范式的前提下,要求非主键属性要直接依赖于主键 - -举例:(学号、姓名、班级、班主任)这个表中,学号是主键,它可以确认姓名、班级、班主任,符合了第二范式,但是在非主键字段中,我们也可以通过班级推导出该班级的班主任,所以它是不符合第三范式的 - -拆分成两个表 - -学号、姓名、班级 - -班级、班主任 - -通过把班级与班主任的映射关系另外做成一张映射表,我们就成功地消除了表中的传递依赖了 - diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230908 powerdesigner.md" "b/07 \345\210\230\346\226\207\351\224\213/20230908 powerdesigner.md" deleted file mode 100644 index 6735b568cc13b6b32e140d23059548edbf3da489..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230908 powerdesigner.md" +++ /dev/null @@ -1,131 +0,0 @@ -## powerdesigner - -第一步:创建概念模型图(CDM)以用户角度 - -第二步:转换逻辑模型图(LDM)以计算机角度 - -第三步:转换物理模型图(PDM)以数据角度 - -第四步:生成DDL - -表与表的关系:一个表里的几条记录对应另一个表的几条记录 - -数据库范式在实际中不会完全按照范式,根据需求实际操作 - -~~~java -## 题目:图书管理系统 - -```mysql -create database lib charset utf8; - -use lib; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/10 18:25:47 */ -/*==============================================================*/ - - -drop table if exists administrator; - -drop table if exists book; - -drop table if exists reader; - -drop table if exists stacks; - -drop table if exists system; - -drop table if exists type; - -/*==============================================================*/ -/* Table: administrator */ -/*==============================================================*/ -create table administrator -( - a_id char(10) not null, - a_name char(5) not null, - primary key (a_id) -); - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - b_id int not null auto_increment, - b_name varchar(10) not null, - author varchar(5) not null, - publication varchar(10) not null, - b_num int not null, - primary key (b_id) -); - -/*==============================================================*/ -/* Table: reader */ -/*==============================================================*/ -create table reader -( - r_id int not null auto_increment, - r_name char(5) not null, - r_sex char(1) not null, - r_age int not null, - primary key (r_id) -); - -/*==============================================================*/ -/* Table: stacks */ -/*==============================================================*/ -create table stacks -( - s_id int not null auto_increment, - b_id int not null, - s_name varchar(5) not null, - s_address varchar(5) not null, - primary key (s_id) -); - -/*==============================================================*/ -/* Table: system */ -/*==============================================================*/ -create table system -( - date_id int not null auto_increment, - b_id int not null, - r_id int not null, - a_id char(10) not null, - borrow date not null, - `return` date not null, - actual date, - primary key (date_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - b_id int not null, - type_name varchar(3) not null, - primary key (type_id) -); - -alter table stacks add constraint FK_deposit foreign key (b_id) - references book (b_id) on delete restrict on update restrict; - -alter table system add constraint FK_Relationship_3 foreign key (b_id) - references book (b_id) on delete restrict on update restrict; - -alter table system add constraint FK_Relationship_4 foreign key (r_id) - references reader (r_id) on delete restrict on update restrict; - -alter table system add constraint FK_manage foreign key (a_id) - references administrator (a_id) on delete restrict on update restrict; - -alter table type add constraint FK_categorize foreign key (b_id) - references book (b_id) on delete restrict on update restrict; - - -``` -~~~ \ No newline at end of file diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230910\347\254\224\350\256\260\345\233\233.md" "b/07 \345\210\230\346\226\207\351\224\213/20230910\347\254\224\350\256\260\345\233\233.md" deleted file mode 100644 index 28b4f3c5dabd79b45c7675fda6ee0e5dbf5a3bce..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230910\347\254\224\350\256\260\345\233\233.md" +++ /dev/null @@ -1,132 +0,0 @@ -# 笔记 - -1、创建概念模型(类似ER图)CDM(用户角度) -2、转换成逻辑模型LDM(计算机角度) -3、转换成物理模型PDM(数据库角度) -4、生成DDL - -```java - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 14:58:55 */ -/*==============================================================*/ -CREATE database books charset utf8; -use books; - -drop table if exists administrators; - -drop table if exists author; - -drop table if exists book; - -drop table if exists bowor; - -drop table if exists press; - -drop table if exists readers; - -drop table if exists stack; - -/*==============================================================*/ -/* Table: administrators */ -/*==============================================================*/ -create table administrators -( - ad_id int not null, - ad_name char(10) not null, - ad_sex char(1) not null, - ad_duties char(10) not null, - primary key (ad_id) -); - -/*==============================================================*/ -/* Table: author */ -/*==============================================================*/ -create table author -( - auth_id int not null, - auth_wprks char(10) not null, - auth_price int not null, - primary key (auth_id) -); - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - bo_id int not null, - st_id int not null, - auth_id int not null, - pr_id int not null, - bo_name char(20) not null, - bo_price int not null, - bo_author char(10) not null, - primary key (bo_id) -); - -/*==============================================================*/ -/* Table: bowor */ -/*==============================================================*/ -create table bowor -( - re_id int not null, - bo_id int not null, - primary key (re_id, bo_id) -); - -/*==============================================================*/ -/* Table: press */ -/*==============================================================*/ -create table press -( - pr_id int not null, - pr_name char(10) not null, - pr_date date not null, - primary key (pr_id) -); - -/*==============================================================*/ -/* Table: readers */ -/*==============================================================*/ -create table readers -( - re_id int not null, - re_name char(20) not null, - re_age int not null, - re_sex char(1) not null, - primary key (re_id) -); - -/*==============================================================*/ -/* Table: stack */ -/*==============================================================*/ -create table stack -( - st_id int not null, - ad_id int not null, - st_address char(20) not null, - st_area int not null, - st_tel int not null, - primary key (st_id) -); - -alter table book add constraint FK_deposit foreign key (st_id) - references stack (st_id) on delete restrict on update restrict; - -alter table book add constraint FK_have foreign key (pr_id) - references press (pr_id) on delete restrict on update restrict; - -alter table book add constraint FK_work foreign key (auth_id) - references author (auth_id) on delete restrict on update restrict; - -alter table bowor add constraint FK_bowor foreign key (re_id) - references readers (re_id) on delete restrict on update restrict; - -alter table bowor add constraint FK_bowor2 foreign key (bo_id) - references book (bo_id) on delete restrict on update restrict; - -alter table stack add constraint FK_Relationship_5 foreign key (ad_id) - references administrators (ad_id) on delete restrict on update restrict; -``` \ No newline at end of file diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230912\347\224\265\345\275\261\347\256\241\347\220\206.md" "b/07 \345\210\230\346\226\207\351\224\213/20230912\347\224\265\345\275\261\347\256\241\347\220\206.md" deleted file mode 100644 index 6db6cd24265ad9788e2820dcf416dd060bd422d9..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230912\347\224\265\345\275\261\347\256\241\347\220\206.md" +++ /dev/null @@ -1,202 +0,0 @@ - - -### 电影管理 - -``` java -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 11:33:30 */ -/*==============================================================*/ - - -drop table if exists actor; - -drop table if exists director; - -drop table if exists film; - -drop table if exists "film language"; - -drop table if exists "film review"; - -drop table if exists "film types"; - -drop table if exists film_region; - -drop table if exists language; - -drop table if exists protagonist; - -drop table if exists region; - -drop table if exists scriptwriter; - -drop table if exists type; - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - actor_id int not null auto_increment, - actor_name varchar(4) not null, - primary key (actor_id) -); - -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - film_id int not null, - actor_id int not null, - primary key (film_id, actor_id) -); - -/*==============================================================*/ -/* Table: film */ -/*==============================================================*/ -create table film -( - film_id int not null auto_increment, - film_name varchar(10) not null, - film_date date not null, - film_time time not null, - primary key (film_id) -); - -/*==============================================================*/ -/* Table: "film language" */ -/*==============================================================*/ -create table "film language" -( - film_id int not null, - lgg_id char(10) not null, - primary key (film_id, lgg_id) -); - -/*==============================================================*/ -/* Table: "film review" */ -/*==============================================================*/ -create table "film review" -( - fr_id char(10) not null, - film_id int not null, - fr_grade char(1) not null, - fr_title varchar(10), - fr_text text, - primary key (fr_id) -); - -/*==============================================================*/ -/* Table: "film types" */ -/*==============================================================*/ -create table "film types" -( - film_id int not null, - type_id int not null, - primary key (film_id, type_id) -); - -/*==============================================================*/ -/* Table: film_region */ -/*==============================================================*/ -create table film_region -( - film_id int not null, - region_id int not null, - primary key (film_id, region_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - lgg_id char(10) not null, - lgg_name varchar(10) not null, - primary key (lgg_id) -); - -/*==============================================================*/ -/* Table: protagonist */ -/*==============================================================*/ -create table protagonist -( - film_id int not null, - actor_id int not null, - primary key (film_id, actor_id) -); - -/*==============================================================*/ -/* Table: region */ -/*==============================================================*/ -create table region -( - region_id int not null auto_increment, - region_name varchar(10) not null, - primary key (region_id) -); - -/*==============================================================*/ -/* Table: scriptwriter */ -/*==============================================================*/ -create table scriptwriter -( - film_id int not null, - actor_id int not null, - primary key (film_id, actor_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name varchar(2) not null, - primary key (type_id) -); - -alter table director add constraint FK_director foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table director add constraint FK_director2 foreign key (actor_id) - references actor (actor_id) on delete restrict on update restrict; - -alter table "film language" add constraint "FK_film language" foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table "film language" add constraint "FK_film language2" foreign key (lgg_id) - references language (lgg_id) on delete restrict on update restrict; - -alter table "film review" add constraint "FK_movie evaluation" foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table "film types" add constraint "FK_film types" foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table "film types" add constraint "FK_film types2" foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table film_region add constraint FK_film_region foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table film_region add constraint FK_film_region2 foreign key (region_id) - references region (region_id) on delete restrict on update restrict; - -alter table protagonist add constraint FK_protagonist foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table protagonist add constraint FK_protagonist2 foreign key (actor_id) - references actor (actor_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter2 foreign key (actor_id) - references actor (actor_id) on delete restrict on update restrict; - - -``` - diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230913\345\214\273\347\224\237\350\215\257\345\223\201\347\227\205\344\272\272.md" "b/07 \345\210\230\346\226\207\351\224\213/20230913\345\214\273\347\224\237\350\215\257\345\223\201\347\227\205\344\272\272.md" deleted file mode 100644 index a8bf9f19dcfaf4e0ae79e0b7e2302c0013fe3389..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230913\345\214\273\347\224\237\350\215\257\345\223\201\347\227\205\344\272\272.md" +++ /dev/null @@ -1,110 +0,0 @@ -````java - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 23:37:23 */ -/*==============================================================*/ - -create database hospital charset utf8; -use hospital; - -drop table if exists department; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists lookpatient; - -drop table if exists patient; - -drop table if exists patientEat; - -/*==============================================================*/ -/* Table: department */ -/*==============================================================*/ -create table department -( - doctor_id int not null, - department_id int not null auto_increment, - department_name varchar(10) not null, - department_tel int not null, - primary key (department_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - doctor_name varchar(10) not null, - doctor_age int not null, - doctor_sex char(1) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - drug_name varchar(10) not null, - drug_price int not null, - drug_category varchar(10) not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: lookpatient */ -/*==============================================================*/ -create table lookpatient -( - doctor_id int not null, - patient_id int not null, - primary key (doctor_id, patient_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(10) not null, - patient_age int not null, - patient_sex char(1) not null, - patient_sfz int not null, - patient_tel int not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: patientEat */ -/*==============================================================*/ -create table patientEat -( - drug_id int not null, - patient_id int not null, - primary key (drug_id, patient_id) -); - -alter table department add constraint FK_employ foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table lookpatient add constraint FK_lookpatient foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table lookpatient add constraint FK_lookpatient2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table patientEat add constraint FK_patientEat foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -alter table patientEat add constraint FK_patientEat2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; -``` - -```` - diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230917\351\224\200\345\224\256\346\261\275\350\275\246\351\241\276\345\256\242.md" "b/07 \345\210\230\346\226\207\351\224\213/20230917\351\224\200\345\224\256\346\261\275\350\275\246\351\241\276\345\256\242.md" deleted file mode 100644 index f1d2beef002b3e84f161050501d338cc8e31a1fa..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230917\351\224\200\345\224\256\346\261\275\350\275\246\351\241\276\345\256\242.md" +++ /dev/null @@ -1,203 +0,0 @@ -### 笔记 - - - -1.查询特定销售员的销售记录 -2.查找销售记录中销售价格最高的汽车 -3.统计某个销售员的销售总额 -4.根据客户信息查询其购买过的汽车 -5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 -6.检索特定日期范围内的销售了哪些汽车 -7.查找某车型的销售历史。 -8.统计每个销售员的销售数量 - - - -~~~ java -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:55:58 */ -/*==============================================================*/ - -create database no_money_car charset utf8; - -use no_money_car; - -drop table if exists admin; - -drop table if exists car; - -drop table if exists car_brand; - -drop table if exists car_type; - -drop table if exists guke; - -drop table if exists xiaoshou; - -/*==============================================================*/ -/* Table: car_brand */ -/*==============================================================*/ -create table car_brand -( - car_brand_id int not null auto_increment, - car_brand_name varchar(20) not null, - primary key (car_brand_id) -); - -insert into car_brand values -(0,'宝马'), -(0,'大众'), -(0,'奔驰'), -(0,'玛莎拉蒂'); - -/*==============================================================*/ -/* Table: car_type */ -/*==============================================================*/ -create table car_type -( - car_type_id int not null auto_increment, - car_type_name varchar(10) not null, - primary key (car_type_id) -); - -insert into car_type values -(0,'SUV'), -(0,'轿车'), -(0,'货车'), -(0,'跑车'); - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - car_type_id int, - car_brand_id int, - car_name varchar(20) not null, - car_money numeric(8,1) not null, - primary key (car_id) -); - -insert into car values -(0,4,4,'B24',8851507.0), -(0,1,1,'A57',6505841.0), -(0,2,3,'蹦蹦',3548060.0), -(0,2,1,'486',7516152.0); - -/*==============================================================*/ -/* Table: guke */ -/*==============================================================*/ -create table guke -( - guke_id int not null auto_increment, - guke_name varchar(6) not null, - guke_tel varchar(11) not null, - primary key (guke_id) -); - -insert into guke values -(0,'刘总','15825681476'), -(0,'张总','18813681156'), -(0,'周总','17447681479'), -(0,'笑总','14563681278'); - -/*==============================================================*/ -/* Table: xiaoshou */ -/*==============================================================*/ -create table xiaoshou -( - xiaoshou_id int not null auto_increment, - xiaoshou_name varchar(6) not null, - xiaoshou_tel char(11) not null, - primary key (xiaoshou_id) -); - -insert into xiaoshou values -(0,'马量','16573821841'), -(0,'司马易','13828921841'), -(0,'孙武空','12815824841'); - -/*==============================================================*/ -/* Table: admin */ -/*==============================================================*/ -create table admin -( - admin_id int not null auto_increment, - xiaoshou_id int, - guke_id int, - car_id int, - admin_date date not null, - primary key (admin_id) -); - -insert into admin values -(0,1,1,1,'2022-9-4'), -(0,3,4,3,'2022-9-3'), -(0,3,2,2,'2022-9-3'), -(0,1,1,3,'2022-9-5'); - --- 1.查询特定销售员的销售记录 - -select * from xiaoshou x -join admin a on x.xiaoshou_id=a.xiaoshou_id -join car c on c.car_id=a.car_id -join car_type t on c.car_type_id=t.car_type_id -join car_brand b on c.car_brand_id=b.car_brand_id -where xiaoshou_name='孙武空'; - - -- 2.查找销售记录中销售价格最高的汽车 - -select max(car_money) from car c; - - -- 3.统计某个销售员的销售总额 - -select sum(car_money) from xiaoshou x -join admin a on x.xiaoshou_id=a.xiaoshou_id -join car c on c.car_id=a.car_id where xiaoshou_name='孙武空'; - - -- 4.根据客户信息查询其购买过的汽车 - -select * from guke g -left join admin a on g.guke_id=a.guke_id -left join car c on a.car_id=c.car_id; - - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -select car_brand_name,count(car_money),sum(car_money) from car_brand b -left join car c on b.car_brand_id=c.car_brand_id group by b.car_brand_id; - - -- 6.检索特定日期范围内的销售了哪些汽车 - -select car_name from admin a -left join car c on a.car_id=c.car_id where admin_date='2022-09-03'; - - -- 7.查找某车型的销售历史。 - -select car_name,admin_date from car c -left join admin a on c.car_id=a.car_id; - - -- 8.统计每个销售员的销售数量 - -select xiaoshou_name,count(car_name) from xiaoshou x -left join admin a on x.xiaoshou_id=a.xiaoshou_id -left join car c on a.car_id=c.car_id group by x.xiaoshou_id; - -alter table admin add constraint FK_sale foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table admin add constraint FK_select foreign key (guke_id) - references guke (guke_id) on delete restrict on update restrict; - -alter table admin add constraint FK_sell foreign key (xiaoshou_id) - references xiaoshou (xiaoshou_id) on delete restrict on update restrict; - -alter table car add constraint FK_brand foreign key (car_brand_id) - references car_brand (car_brand_id) on delete restrict on update restrict; - -alter table car add constraint FK_classify foreign key (car_type_id) - references car_type (car_type_id) on delete restrict on update restrict; - -~~~ - diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230919MySQL\345\244\215\344\271\240.md" "b/07 \345\210\230\346\226\207\351\224\213/20230919MySQL\345\244\215\344\271\240.md" deleted file mode 100644 index 8e2e00d2341ea18c732186894ec892a81f63e409..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230919MySQL\345\244\215\344\271\240.md" +++ /dev/null @@ -1,764 +0,0 @@ -## mysql复习 - -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不null,就保持原值 - -limit 起始数,显示数 - -desc 库名:显示表结构 - -length(email):email的字节长度 - -#### 自然连接 - -表,表 where 字段=字段 and 字段=字段 - -#### 联表区间 - -表 left join 表 on 表.字段 between 表.字段 and 表.字段(不支持别名) - -#### 自连接 - -inner join - -not in(条件,条件) - -!(between 20 and 50) - - - -~~~java -### 建库建表 - -```mysql -create database db1 charset utf8; - -use db1; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; -``` - -### 查询语句 - -```mysql -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -select sum(12*salary) from employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - -select sum(salary*12+ifnull(salary*commission_pct*12,0)) from employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - -select distinct job_id from employees; - -# 3.查询工资大于12000的员工姓名和工资 - -select first_name,salary from employees where salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 - -select first_name,department_id from employees where employee_id=176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -select first_name,salary from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select first_name,department_id from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -select first_name,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select employee_id,salary,grade_level from employees e left join job_grades j on e.salary between j.lowest_sal and j.highest_sal where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select * from employees where first_name like '__尔'; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -select * from employees where last_name like '%特%' and last_name like '%尔%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select * from employees where first_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select e.first_name,j.job_title from employees e left join jobs j on e.job_id=j.job_id where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select first_name,salary,manager_id from employees where manager_id in (100,101,110); - -#第05章_排序与分页的课后练习 - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - -select first_name,department_id,salary*12 from employees order by salary*12 desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select first_name,salary from employees where salary not between 8000 and 17000 order by salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -select * from employees where email like '%e%' order by length(email) desc,department_id asc; - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - -select first_name,e.department_id,department_name from employees e left join departments d on e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -select e.job_id,d.location_id from employees e left join departments d on e.department_id=d.department_id where e.department_id=90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select e.last_name,d.department_name,d.location_id,l.city from employees e left join departments d on e.department_id=d.department_id left join locations l on d.location_id=l.location_id where commission_pct is not null; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select e.last_name,e.job_id,d.department_id,d.department_name from employees e left join departments d on e.department_id=d.department_id left join locations l on d.location_id=l.location_id where l.city='多伦多'; - -#sql92语法(自然连接): - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -select department_name,street_address,first_name,job_title,salary from jobs j,employees e,departments d,locations l where j.job_id=e.job_id and e.department_id=d.department_id and d.location_id=l.location_id and department_name='行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select e.first_name,e.employee_id,s.last_name,s.employee_id from employees e inner join employees s on e.employee_id=s.employee_id; - -# 7.查询哪些部门没有员工 - -select department_name from departments d left join employees e on d.department_id=e.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - -select city from departments d right join locations l on d.location_id=l.location_id where department_id is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select e.* from departments d,employees e where d.department_id=e.department_id and d.department_name='销售部' or d.department_name='信息技术部'; - -# 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - -select max(salary),min(salary),avg(salary),sum(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - -select job_id,max(salary),min(salary),avg(salary),sum(salary) from employees group by job_id; - -#4.选择各个job_id的员工人数 - -select job_id,count(employee_id) from employees group by job_id; - -# 5.查询员工最高工资和最低工资的差距 - -select max(salary)-min(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - -select manager_id,min(salary) from employees where manager_id is not null group by manager_id having min(salary)>6000; - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name,d.location_id,count(employee_id),avg(salary) from departments d left join employees e on d.department_id=e.department_id group by d.department_id order by avg(salary) desc; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select j.job_title,min(salary),department_name from jobs j left join employees e on j.job_id=e.job_id left join departments d on e.department_id=d.department_id group by j.job_id,d.department_id; - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - -select * from employees where department_id =(select department_id from employees where last_name='兹洛特基') and salary=(select salary from employees where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - -select employee_id,first_name,salary from employees where salary>(select avg(salary) from employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name,job_id,salary from employees where salary>(select max(salary) from employees where JOB_ID = 'SA_MAN'); - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -select employee_id,last_name from employees where department_id=(select department_id from employees where last_name like '%u%'); - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -select first_name,employee_id from employees where department_id in (select department_id from departments where location_id=1700); - -#6.查询管理者是 金 的员工姓名和工资 - -select first_name,salary from employees where manager_id in (select manager_id from employees where last_name='金'); - -#7.查询工资最低的员工信息: last_name, salary - -select last_name,salary from employees where salary=(select min(salary) from employees); - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 - -select * from departments where department_id =(select department_id from employees group by department_id having avg(salary)=(select min(s) from (select avg(salary) s from employees group by department_id) a)); - -#方式2: -# 部门平均<= 公司所有平均 - -select * from departments where department_id=(select department_id from employees group by department_id having avg(salary)<=all(select avg(salary) from employees group by department_id)); - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - -select d.*,(select avg(salary) from employees where department_id=d.department_id) from departments d where department_id =(select department_id from employees group by department_id having avg(salary)=(select min(s) from (select avg(salary) s from employees group by department_id) a)); - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -select * from jobs where job_id=(select job_id from employees group by job_id having avg(salary)=(select max(s) from (select avg(salary) s from employees group by job_id) a)); - -#方式2:平均工资>=所有平均工资 - -select * from jobs where job_id=(select job_id from employees group by job_id having avg(salary)>=all(select avg(salary) from employees group by job_id)); - -#11.查询平均工资高于公司平均工资的部门有哪些? - -select department_id from employees where department_id is not null group by department_id having avg(salary)>(select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - -select e.* from employees e inner join employees s on e.employee_id=s.manager_id; - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - -select * from employees where employee_id=any(select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - -select min(salary) from employees group by department_id having max(salary)<=all(select max(salary) from employees group by department_id); - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary - -select last_name,department_id,email,salary from employees where department_id = (select department_id from employees group by department_id having avg(salary)>=all(select avg(salary) from employees group by department_id)); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 - -select department_id from departments where department_id !=all(select department_id from employees where job_id='ST_CLERK'); - -#16. 选择所有没有管理者的员工的last_name - -select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - -select employee_id,first_name,hire_date,salary from employees e where e.manager_id=(select employee_id from employees where first_name = 'De Haan'); - -#方式2: - -select employee_id, last_name, hire_date, salary from employees e where exists(select * from employees s where e.employee_id=s.manager_id and s.first_name='De Haan'); - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - -select employee_id,last_name,salary from employees e1 where salary > (select avg(salary) from employees e2 where e2.department_id = e1.department_id); - -#方式2:在FROM中声明子查询 - -select employee_id,last_name,salary from employees e1,(select department_id,AVG(salary) s from employees e2 group by department_id) a where e1.department_id = a.department_id and e1.salary > a.s; - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - -select department_name,department_id from departments d where 5 < (select count(*) from employees e where d.department_id = e.department_id); - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -select country_id from locations l where 2 < (select count(*) from departments d where l.location_id=d.location_id); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 -~~~ \ No newline at end of file diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230920RBAC.md" "b/07 \345\210\230\346\226\207\351\224\213/20230920RBAC.md" deleted file mode 100644 index f0f946f59cd1934c6900b7896ead67b2a2da201c..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230920RBAC.md" +++ /dev/null @@ -1,158 +0,0 @@ -## RBAC(Role-Based Access Control) - -一种数据库设计思想,基于角色的访问权限管制模型,目前权限的主流方案,核心为角色 - -在 RBAC 模型里面,有3个基础组成部分,分别是:用户、角色和权限 - -- User(用户):每个用户都有唯一的UID识别,并被授予不同的角色 -- Role(角色):不同角色具有不同的权限 -- Permission(权限):访问权限 -- 用户-角色映射:用户和角色之间的映射关系 -- 角色-权限映射:角色和权限之间的映射 - -管理员和普通用户被授予不同的权限,普通用户只能去修改和查看个人信息,而不能创建用户和冻结用户,而管理员由于被授予所有权限,所以可以做所有操作 - -## 预习 SKU - -SKU 英文全称为Stock Keeping Unit,简称 SKU ,是产品入库后一种编码归类方法,也是库存控制的最小单位。一款商品,每个颜色,每个尺码,每一型号等都有出现一个 sku ,便于电商品牌识别商品。 - -既然 sku 被定义为最小存货单元,商家就可以选择自己设定 sku,一般来说是以件、盒、个、托盘等为单位。 - -- 大厂的 sku 就可以是一箱, -- 超市的 sku 就可以是一盒, -- 零售商的 sku 可以是一个。 - -~~~java -## RBAC练习 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:30:32 */ -/*==============================================================*/ -create database school charset utf8; - -use school; - -drop table if exists management; - -drop table if exists role; - -drop table if exists role_management; - -drop table if exists user; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: management */ -/*==============================================================*/ -create table management -( - management_id int not null auto_increment, - management_name varchar(10) not null, - managemen_comment varchar(50) not null, - management_type char(10) not null, - primary key (management_id) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name varchar(3) not null, - role_comment char(10) not null, - primary key (role_id) -); - -/*==============================================================*/ -/* Table: role_management */ -/*==============================================================*/ -create table role_management -( - management_id int not null, - role_id int not null, - primary key (management_id, role_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_name varchar(5) not null, - user_pwd char(6) not null, - primary key (user_id) -); - -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - role_id int not null, - user_id int not null, - primary key (role_id, user_id) -); - -alter table role_management add constraint FK_role_management foreign key (management_id) - references management (management_id) on delete restrict on update restrict; - -alter table role_management add constraint FK_role_management2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - - - --- ---------------------------- --- Records of management --- ---------------------------- -INSERT INTO `management` VALUES (1, '学生信息'); -INSERT INTO `management` VALUES (2, '教师信息'); -INSERT INTO `management` VALUES (3, '工资信息'); -INSERT INTO `management` VALUES (4, '首页'); - --- ---------------------------- --- Records of role --- ---------------------------- -INSERT INTO `role` VALUES (1, '校长'); -INSERT INTO `role` VALUES (2, '教师'); -INSERT INTO `role` VALUES (3, '学生'); - --- ---------------------------- --- Records of role_management --- ---------------------------- -INSERT INTO `role_management` VALUES (1, 1); -INSERT INTO `role_management` VALUES (2, 1); -INSERT INTO `role_management` VALUES (3, 1); -INSERT INTO `role_management` VALUES (4, 1); -INSERT INTO `role_management` VALUES (1, 2); -INSERT INTO `role_management` VALUES (2, 2); -INSERT INTO `role_management` VALUES (4, 2); -INSERT INTO `role_management` VALUES (1, 3); -INSERT INTO `role_management` VALUES (4, 3); --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '一一', '123456'); -INSERT INTO `user` VALUES (2, '二二', '123456'); -INSERT INTO `user` VALUES (3, '三三', '123456'); -INSERT INTO `user` VALUES (4, '四四', '123456'); - --- ---------------------------- --- Records of user_role --- ---------------------------- -INSERT INTO `user_role` VALUES (1, 1); -INSERT INTO `user_role` VALUES (2, 2); -INSERT INTO `user_role` VALUES (2, 3); -INSERT INTO `user_role` VALUES (3, 4); -``` -~~~ \ No newline at end of file diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230921 \351\201\245\351\201\245\351\242\206\345\205\210.md" "b/07 \345\210\230\346\226\207\351\224\213/20230921 \351\201\245\351\201\245\351\242\206\345\205\210.md" deleted file mode 100644 index 7c7fd5beab8094ce17f784c4f82f40963c0bb435..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230921 \351\201\245\351\201\245\351\242\206\345\205\210.md" +++ /dev/null @@ -1,98 +0,0 @@ -### 笔记 - -今天学到了sku,spu - -sku是库存量单位一个项目可能有多个SKU - -spu: 是商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个产品的特性。通俗点讲,属性值、特性相同的商品就可以称为一个spu - - - -~~~java - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:41:07 */ -/*==============================================================*/ -create database zy charset utf8; -use zy; - -drop table if exists attributes; - -drop table if exists attributes_value; - -drop table if exists relation; - -drop table if exists sku; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_id int not null auto_increment, - attributes_name varchar(50) not null, - primary key (attributes_id) -); - -/*==============================================================*/ -/* Table: attributes_value */ -/*==============================================================*/ -create table attributes_value -( - value_id int not null auto_increment, - value_content varchar(50) not null, - primary key (value_id) -); - -/*==============================================================*/ -/* Table: relation */ -/*==============================================================*/ -create table relation -( - relation_id int not null auto_increment, - sku_id int, - attributes_id int, - value_id int, - primary key (relation_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price decimal(9,2) not null, - sku_kc int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_content varchar(50) not null, - primary key (spu_id) -); - -alter table relation add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table relation add constraint FK_Relationship_3 foreign key (attributes_id) - references attributes (attributes_id) on delete restrict on update restrict; - -alter table relation add constraint FK_Relationship_4 foreign key (value_id) - references attributes_value (value_id) on delete restrict on update restrict; - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; -``` -~~~ \ No newline at end of file diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230924\345\244\215\344\271\240.md" "b/07 \345\210\230\346\226\207\351\224\213/20230924\345\244\215\344\271\240.md" deleted file mode 100644 index 38aca5ce6f1573a62b923af224943fdb033b8733..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230924\345\244\215\344\271\240.md" +++ /dev/null @@ -1,23 +0,0 @@ -#### 事务的特性 - - 原子性隔离性持久性 - -#### 2.视图 - - 在已有的表或者视图上创建的虚拟表 - - 创建视图: create view 视图名 asselect - - 删除视图:drop view 视图名 - -#### 3.索引 - - 为了提高查询的速度而在数据库断创建的一种排序的数据结构 - -#### 参数类型有三种 - -IN:输入参数,改参数的值必须在调用该存储过程时指定,在存储过程内部使用,不能返回。缺省值是IN - -OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回 - -INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回 \ No newline at end of file diff --git "a/07 \345\210\230\346\226\207\351\224\213/20230927\350\247\206\345\233\276.md" "b/07 \345\210\230\346\226\207\351\224\213/20230927\350\247\206\345\233\276.md" deleted file mode 100644 index 2ac5b6e8f1434e4dd3cb7476879e2dd1bf5ab422..0000000000000000000000000000000000000000 --- "a/07 \345\210\230\346\226\207\351\224\213/20230927\350\247\206\345\233\276.md" +++ /dev/null @@ -1,347 +0,0 @@ -## 视图 - -#### check 检查约束 - -检查某个字段的值是否符合值的范围 - -```mysql -gender char(1) , /*逗号留不留都可以*/ -check(gender in ('男','女')) -``` - -MySQL 5.7不支持使用,MySQL8.0 可以使用 - -```mysql -/*在utf8中,一个汉字等于一个字符,等于3个字节*/ -check(length(name)>6) /*6指的是6个字节*/ -``` - -视图是一种虚拟表,本身不具有数据,占用很少的内存空间 - -```mysql -concat(last_name,' ',first_name) /*拼接字段*/ -``` - -创建视图语句 - -```mysql -create view 视图名 as select语句 -``` - -删除视图语句 - -```mysql -drop view 视图名1,视图名2 -``` - -修改视图语句 - -```mysql -create or replace view 视图名 as select 语句 -``` - -使用视图 - -```mysql -select * from 视图名 [where 条件] -``` - -查看创建语句 - -```mysql -show create table 表名 -``` - -修改视图语句 - -```mysql -update 表名 set 条件 -insert into 表名 values (值) -``` - -不可以执行insert语句的表 - -1.多表连接 - -## 作业 - -### 建表建库 - -```mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -``` - -### 题目 - -```mysql -#第14章_视图的课后练习 - -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -create view employee_vu as select last_name 姓名,employee_id 员工号,department_id 部门号 from employees; - -#2. 显示视图的结构 -desc employee_vu; - -#3. 查询视图中的全部内容 -select * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -create or replace view employee_vu as select last_name 姓名,employee_id 员工号,department_id 部门号 from employees where department_id=80; -select * from employee_vu; - -#练习2: -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -create view emp_v1 as select last_name 员工姓名,salary 工资,email 邮箱 from employees where phone_number like '011%'; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -create or replace view emp_v1 as select last_name 员工姓名,salary 工资,phone_number 电话号码,email 邮箱 from employees where phone_number like '011%' and email like '%e%'; - -#3. 向 emp_v1 插入一条记录,是否可以? -不可以 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -update emp_v1 set 工资=工资+1000; - -#5. 删除emp_v1中姓名为Olsen的员工 -delete from emp_v1 where 员工姓名='Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create view emp_v2 as select department_id 部门id,max(salary) 最高工资 from employees group by department_id having max(salary)>12000; - -#7. 向 emp_v2 中插入一条记录,是否可以? -不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v2 , emp_v1; -``` \ No newline at end of file diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230905 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" "b/08 \345\256\230\346\226\207\350\257\232/20230905 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" deleted file mode 100644 index 880328b59657949298ad6b2c49bc8098a8b2284f..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230905 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" +++ /dev/null @@ -1,26 +0,0 @@ -### 大二上 - -实际应用(实操)学习mysql高级 MVC框架等 - -### 大二下 - -Node.js(前端) vue.js(前端)简化开发 有UI框架配合 - -spping Boot (redis,webApi) - -### 大二下 - -实训:1.Linux服务器 nginx - - 2. 项目中可能实现的技术:中间件 ,签权 ,鉴别权限 - 3. 小程序 uniapp移动端开发 - -### 课后知识 - -1.技术栈:一个技术要求用用什么技术实现,可以成为技术选型 - -2.技能树:一个人具备的技能,称为技能树 - -3.学会独立完成项目,在老师讲课的基础上,多利用空余时间学习别的知识 - -4.我们应该多关注招聘网站,多以我们学习的专业 招聘职位的岗位要求,为我们的学习目标 可以更好的适应今后的工作 \ No newline at end of file diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" "b/08 \345\256\230\346\226\207\350\257\232/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" deleted file mode 100644 index 9c114ec60a367ecad86c31b9b6e0a12dbc30ffb5..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" +++ /dev/null @@ -1,144 +0,0 @@ -### 可以多根据用户需求和开发的系统的需求,设计出符合对应的DBMS的需求的数据库结构,使其能有效的储存合管理数据 - -## 表与表之间的关系有 一对一 一对多 多对多 - -1.一对一的关系:将其一个主键,放到另一个表当主键 - -2.一对多的关系:将一所在表的主键,放到多的表当当外键 - -3.多对多的关系:必须第三张表,把另外两个表的主键放到这个表当外键 - - - -### E-R图(实体关系图):以实体,关系,属性三个基本概念数据的基本结构 - -联系:用菱形表示,矩形内写明实体名 ,用线与实体相连,可标上联系的类型,联系也可以有自己的属性 - -属性:用椭圆形或者圆角矩形表示,与相应的实体连接起来 ,属性名加下划线 - -要素:实体(表),属性(字段),关系(线的中间加菱形) - -实体:用矩形,主键 加下划线 外键横线中间加菱形 - - - -# 作业 - -~~~ mysql -CREATE DATABASE sc charset utf8; -use sc; -#院系表 -CREATE TABLE department( -d_id int primary KEY, -d_name VARCHAR(20) -); - -INSERT INTO department VALUES -(111,'软件工程学院'), -(112,'财经商贸学院'), -(113,'医疗医护学院'); - -# 专业表 -CREATE TABLE major( -m_id int PRIMARY KEY, -m_name VARCHAR(20), -d_id int, -foreign key(d_id) references department(d_id) -); - -INSERT into major VALUES -(11,'软件技术',111), -(22,'会计',112), -(33,'护理',113); -#班级表 -CREATE TABLE class( -cl_id int PRIMARY key, -cl_name VARCHAR(20), - grade VARCHAR(20), - m_id int, - FOREIGN key(m_id) REFERENCES major(m_id) -); - -insert into class values -(1,'软件技术2班','22级',11), -(2,'软件技术8班','21级',11), -(3,'软件技术4班','23级',11); -#教师表 -CREATE TABLE teacher( -t_id int PRIMARY key, -t_name VARCHAR(20), -t_sex VARCHAR(5) -); - -insert into teacher values -(1,'叶子豪','男'), -(2,'小叶','女'), -(3,'小六','女'); -# 课程表 -CREATE TABLE courses( -c_id int PRIMARY key, -c_name VARCHAR(20), -t_id int, -FOREIGN KEY (t_id) REFERENCES teacher(t_id) -); -insert into courses VALUES -(1,'java',1), -(2,'html',2), -(3,'php',3); -# 学生表 -CREATE TABLE student( -s_id int PRIMARY key, -s_name VARCHAR(5), -s_sex VARCHAR(2), -c_id int, -FOREIGN key(c_id) REFERENCES class(c_id) -); - -insert into student values -(01,'小代','男',1), -(02,'小二','女',2), -(03,'老六','女',3); -# 成绩表 -CREATE TABLE grades( -g_gr int, -s_id int, -c_id int, -FOREIGN KEY(s_id) REFERENCES student(s_id), -FOREIGN KEY(c_id) REFERENCES courses(c_id) -); - -INSERT into grades VALUES -(70,1,3), -(80,3,2), -(90,2,1); -#教室表 -CREATE TABLE classroom( -room_id int PRIMARY KEY, -room_name VARCHAR(20), -room_address VARCHAR(20) -); - - -insert into classroom values -(1,'实训八','望云楼'), -(2,'实训五','望云楼'), -(3,'实训三','望云楼'); -# 课程表 -CREATE TABLE curriculum( -room_id int, -cu_week VARCHAR(10), -cu_courseid int, -FOREIGN KEY(room_id) REFERENCES classroom(room_id) -); - -INSERT into curriculum VALUES -(1,'星期一',2), -(1,'星期一',3), -(1,'星期一',1); - - - -~~~ - - - diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" "b/08 \345\256\230\346\226\207\350\257\232/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" deleted file mode 100644 index 5b98fd6cf5323a7d6bae4e3455477ce0ed0c28f9..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" +++ /dev/null @@ -1,95 +0,0 @@ -# 数据库的范式 - -第一范式:要求字段的内容,不可再分割为保证数据的原子性 - -第二范式:要求在满足第一范式的基础上 要求非主键字段要完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 - -第三范式:满足第二范式的前提下 要求非主键属性要直接依赖于主键 - -~~~ sql -# 建库 -CREATE DATABASE school charset utf8; -# 选库 -use school; -# 院系表 -CREATE TABLE college( -co_id int PRIMARY KEY auto_increment, -co_name VARCHAR(20) -); -# 专业表 -CREATE TABLE major( -ma_id int PRIMARY KEY auto_increment, -ma_name VARCHAR(20), -ma_intor VARCHAR(255), -co_id int, -FOREIGN KEY(co_id) REFERENCES college(co_id) -); -# 班级表 -CREATE TABLE clazz( -cl_id int PRIMARY KEY auto_increment, -cl_name VARCHAR(20), -cl_grade int, -ma_id int, -FOREIGN KEY(ma_id) REFERENCES major(ma_id) -); -# 学生表 -CREATE TABLE student( -st_id int PRIMARY KEY auto_increment, -st_name VARCHAR(20), -st_age int, -st_address VARCHAR(20), -st_gender char(1), -cl_id int, -FOREIGN KEY(cl_id) REFERENCES clazz(cl_id) -); - -# 老师表 -CREATE TABLE teacher( -te_id int PRIMARY KEY auto_increment, -te_name VARCHAR(20), -te_age int, -te_address VARCHAR(20), -te_gender char(1) -); - - -# 课程信息表 -CREATE TABLE coures( -ce_id int PRIMARY KEY auto_increment, -ce_name VARCHAR(20), -te_id int, -FOREIGN KEY(te_id) REFERENCES teacher(te_id) -); - -# 选修(成绩)表 -CREATE TABLE elective( -el_score DOUBLE, -ce_id int, -st_id int, -FOREIGN KEY(ce_id) REFERENCES coures(ce_id), -FOREIGN KEY(st_id) REFERENCES student(st_id) -); - -#教室表 - -CREATE TABLE classroom( -room_id int PRIMARY KEY auto_increment, -room_name int, -room_address VARCHAR(20) -); - -#课程表 -CREATE TABLE curriculum( -cm_id int PRIMARY KEY auto_increment, -cm_name VARCHAR(10), -room_id int, -- 教室主键 -FOREIGN KEY(room_id) REFERENCES classroom(room_id), -te_id int, -- 老师主键 -FOREIGN KEY(te_id) REFERENCES teacher(te_id), -ce_id int, -- 课程信息表主键 -FOREIGN KEY(ce_id) REFERENCES coures(ce_id), -cl_id int, -- 班级表主键 -FOREIGN KEY(cl_id) REFERENCES clazz(cl_id) -); -~~~ - diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230910 \345\233\276\344\271\246\351\246\206.md" "b/08 \345\256\230\346\226\207\350\257\232/20230910 \345\233\276\344\271\246\351\246\206.md" deleted file mode 100644 index 449cd2cbe75564ad5e9ad8077de28553867b8fde..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230910 \345\233\276\344\271\246\351\246\206.md" +++ /dev/null @@ -1,172 +0,0 @@ -## 笔记 - -### powerDesigner - -第一步:创建概念模型(类似于E-R图) CDM(以用户的角度) - -第二步:转换成逻辑模型 LMD (以计算机的角度) - -第三步:转换成物理模型 PDM(以数据库的角度) - -第四步:生成DDL - - - -## 作业 - - - -![image-20230911130253553](https://s2.loli.net/2023/09/11/I4scvGrZ3t18k75.png) - -![image-20230911130317516](https://s2.loli.net/2023/09/11/KsbEO3vA6uwCatG.png) - -~~~ sql -CREATE DATABASE aaa charset utf8; -use aaa; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 4:17:10 */ -/*==============================================================*/ - - -drop table if exists Borrowin; - -drop table if exists administrator; - -drop table if exists author; - -drop table if exists book; - -drop table if exists category; - -drop table if exists library; - -drop table if exists publishing; - -drop table if exists student; - -/*==============================================================*/ -/* Table: Borrowin */ -/*==============================================================*/ -create table Borrowin -( - bo_id int not null, - stu_id char(10) not null, - bo_library char(10) not null, - bo_return char(10) not null, - primary key (bo_id, stu_id) -); - -/*==============================================================*/ -/* Table: administrator */ -/*==============================================================*/ -create table administrator -( - ad_id char(10) not null, - li_id int not null, - ad_name char(5) not null, - ad_sex char(1) not null, - ad_age int not null, - ad_tel varchar(11) not null, - ad_address varchar(30), - primary key (ad_id) -); - -/*==============================================================*/ -/* Table: author */ -/*==============================================================*/ -create table author -( - au_id char(20) not null, - au_name char(10) not null, - au_sex char(1), - zu_tel char(20), - primary key (au_id) -); - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - bo_id int not null auto_increment, - au_id char(20) not null, - cat_id char(10) not null, - bo_name varchar(10) not null, - primary key (bo_id) -); - -/*==============================================================*/ -/* Table: category */ -/*==============================================================*/ -create table category -( - cat_id char(10) not null, - li_id int not null, - cat_name varchar(10) not null, - cat_type varchar(10) not null, - primary key (cat_id) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - li_id int not null auto_increment, - li_address varchar(20) not null, - li_resume varchar(255) not null, - primary key (li_id) -); - -/*==============================================================*/ -/* Table: publishing */ -/*==============================================================*/ -create table publishing -( - pu_id char(10) not null, - bo_id int not null, - pu_name char(20) not null, - pu_tel char(11) not null, - pu_adress varchar(255) not null, - primary key (pu_id) -); - -/*==============================================================*/ -/* Table: student */ -/*==============================================================*/ -create table student -( - stu_id char(10) not null, - stu_name char(5) not null, - stu_sex char(1) not null, - stu_age int not null, - sut_tel varchar(11) not null, - stu_class char(10) not null, - primary key (stu_id) -); - -alter table Borrowin add constraint FK_Borrowin foreign key (bo_id) - references book (bo_id) on delete restrict on update restrict; - -alter table Borrowin add constraint FK_Borrowin2 foreign key (stu_id) - references student (stu_id) on delete restrict on update restrict; - -alter table administrator add constraint FK_manage foreign key (li_id) - references library (li_id) on delete restrict on update restrict; - -alter table book add constraint FK_Relationship_5 foreign key (au_id) - references author (au_id) on delete restrict on update restrict; - -alter table book add constraint FK_Relationship_6 foreign key (cat_id) - references category (cat_id) on delete restrict on update restrict; - -alter table category add constraint FK_Relationship_7 foreign key (li_id) - references library (li_id) on delete restrict on update restrict; - -alter table publishing add constraint FK_publication foreign key (bo_id) - references book (bo_id) on delete restrict on update restrict; - -~~~ - diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230912 \347\224\265\345\275\261\344\275\234\344\270\232.md" "b/08 \345\256\230\346\226\207\350\257\232/20230912 \347\224\265\345\275\261\344\275\234\344\270\232.md" deleted file mode 100644 index 7a6a27478127ae8ed401d76dafb2b1b6c3c80519..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230912 \347\224\265\345\275\261\344\275\234\344\270\232.md" +++ /dev/null @@ -1,216 +0,0 @@ -## 作业 - -![image-20230912150116180](https://s2.loli.net/2023/09/12/kNWrUqi32wMTalc.png) - -~~~ mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 14:57:38 */ -/*==============================================================*/ - - -drop table if exists actor; - -drop table if exists comment; - -drop table if exists critics; - -drop table if exists director; - -drop table if exists language; - -drop table if exists movie; - -drop table if exists producer; - -drop table if exists producing; - -drop table if exists score; - -drop table if exists starring; - -drop table if exists type; - -drop table if exists user; - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - ac_id int not null auto_increment, - ac_name char(10) not null, - ac_sex char(2) not null, - ac_age int not null, - ac_tel char(15) not null, - primary key (ac_id) -); - -/*==============================================================*/ -/* Table: comment */ -/*==============================================================*/ -create table comment -( - com_id int not null auto_increment, - com_appraise varchar(150) not null, - primary key (com_id) -); - -/*==============================================================*/ -/* Table: critics */ -/*==============================================================*/ -create table critics -( - cr_id int not null auto_increment, - mo_id int, - cr_title varchar(50) not null, - cr_appraise varchar(255) not null, - primary key (cr_id) -); - -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - ac_id int not null, - mo_id int not null, - dir_name char(10) not null, - primary key (ac_id, mo_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - lan_id char(10) not null, - mo_id int, - lan_name char(20) not null, - primary key (lan_id) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - mo_id int not null auto_increment, - type_id char(10), - com_id int, - mo_name char(20) not null, - mo_time date not null, - mo_min char(10) not null, - primary key (mo_id) -); - -/*==============================================================*/ -/* Table: producer */ -/*==============================================================*/ -create table producer -( - ac_id int not null, - mo_id int not null, - po_name char(10) not null, - primary key (ac_id, mo_id) -); - -/*==============================================================*/ -/* Table: producing */ -/*==============================================================*/ -create table producing -( - pro_id char(10) not null, - mo_id int, - pro_name varchar(20) not null, - primary key (pro_id) -); - -/*==============================================================*/ -/* Table: score */ -/*==============================================================*/ -create table score -( - user_id int not null, - mo_id int not null, - sc_fs char(10) not null, - primary key (user_id, mo_id) -); - -/*==============================================================*/ -/* Table: starring */ -/*==============================================================*/ -create table starring -( - ac_id int not null, - mo_id int not null, - st_name char(10) not null, - primary key (ac_id, mo_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id char(10) not null, - type_name varchar(20) not null, - primary key (type_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_name char(10) not null, - user_age int, - user_sex char(2), - user_tel char(18) not null, - user_ip char(10), - primary key (user_id) -); - -alter table critics add constraint FK_Relationship_9 foreign key (mo_id) - references movie (mo_id) on delete restrict on update restrict; - -alter table director add constraint FK_director foreign key (ac_id) - references actor (ac_id) on delete restrict on update restrict; - -alter table director add constraint FK_director2 foreign key (mo_id) - references movie (mo_id) on delete restrict on update restrict; - -alter table language add constraint FK_Relationship_8 foreign key (mo_id) - references movie (mo_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_1 foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_13 foreign key (com_id) - references comment (com_id) on delete restrict on update restrict; - -alter table producer add constraint FK_producer foreign key (ac_id) - references actor (ac_id) on delete restrict on update restrict; - -alter table producer add constraint FK_producer2 foreign key (mo_id) - references movie (mo_id) on delete restrict on update restrict; - -alter table producing add constraint FK_Relationship_5 foreign key (mo_id) - references movie (mo_id) on delete restrict on update restrict; - -alter table score add constraint FK_score foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table score add constraint FK_score2 foreign key (mo_id) - references movie (mo_id) on delete restrict on update restrict; - -alter table starring add constraint FK_starring foreign key (ac_id) - references actor (ac_id) on delete restrict on update restrict; - -alter table starring add constraint FK_starring2 foreign key (mo_id) - references movie (mo_id) on delete restrict on update restrict; - - -~~~ - diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230913 \345\214\273\347\224\237\344\275\234\344\270\232.md" "b/08 \345\256\230\346\226\207\350\257\232/20230913 \345\214\273\347\224\237\344\275\234\344\270\232.md" deleted file mode 100644 index 018280c89e4ff83714d9076b41fb25f99bffe3dd..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230913 \345\214\273\347\224\237\344\275\234\344\270\232.md" +++ /dev/null @@ -1,266 +0,0 @@ -## 笔记 - -如果一个主体的属性有多个值那这个属性就可以拆成一个新的主体 - -## 作业 - -![image-20230914001728162](https://s2.loli.net/2023/09/14/c67CgKyaSt8Bz9Q.png) - -~~~ mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 22:17:22 */ -/*==============================================================*/ -CREATE DATABASE yy charset utf8; -use yy; - -drop table if exists cases; - -drop table if exists department; - -drop table if exists diagnosis; - -drop table if exists doctor; - -drop table if exists hospital; - -drop table if exists medicine; - -drop table if exists nurse; - -drop table if exists outpatient; - -drop table if exists patient; - -drop table if exists payment; - -drop table if exists pharmacy; - -drop table if exists ward; - -/*==============================================================*/ -/* Table: cases */ -/*==============================================================*/ -create table cases -( - pat_id char(10) not null, - doc_id char(10) not null, - primary key (pat_id, doc_id) -); - -INSERT into cases VALUES -('1','3'), -('1','5'); - -/*==============================================================*/ -/* Table: department */ -/*==============================================================*/ -create table department -( - dep_id char(10) not null, - hos_id char(10), - dep_name char(20) not null, - primary key (dep_id) -); - -INSERT into department VALUES -('1','3','内科'), -('2','1','外科'); - -/*==============================================================*/ -/* Table: diagnosis */ -/*==============================================================*/ -create table diagnosis -( - pat_id char(10) not null, - nurse_id char(10) not null, - phar_id char(10) not null, - primary key (pat_id, nurse_id) -); - -INSERT into diagnosis VALUES -('1','3','2'), -('3','2','1'); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doc_id char(10) not null, - dep_id char(10), - out_id char(10), - doc_name char(20) not null, - doc_sex char(10) not null, - doc_age int not null, - doc_introduce varchar(255) not null, - doc_tel char(11) not null, - primary key (doc_id) -); - -INSERT into doctor VALUES -('3','1','1','周富','男',30,'帅','13121516141'), -('1','3','3','叶子豪','女',40,'好','16141519175'); - -/*==============================================================*/ -/* Table: hospital */ -/*==============================================================*/ -create table hospital -( - hos_id char(10) not null, - hos_name char(20) not null, - primary key (hos_id) -); - -INSERT into hospital VALUES -('1','1号医院'), -('3','2号医院'); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - med_id char(10) not null, - phar_id char(10), - med_name char(20) not null, - med_time char(10) not null, - primary key (med_id) -); - -INSERT into medicine VALUES -('1','3','2','2020-2-3'), -('1','3','2','2020-3-5'); -/*==============================================================*/ -/* Table: nurse */ -/*==============================================================*/ -create table nurse -( - nurse_id char(10) not null, - phar_id char(10), - nurse_name char(20) not null, - nurse_sex char(2) not null, - nurse_age int not null, - primary key (nurse_id) -); - -INSERT into nurse VALUES -('1','2','小叶','女',30),('3','3','小涛','男',28); - - - -/*==============================================================*/ -/* Table: outpatient */ -/*==============================================================*/ -create table outpatient -( - out_id char(10) not null, - hos_id char(10), - out_name char(20) not null, - primary key (out_id) -); - -INSERT into outpatient VALUES -('1','3','发热科'), -('3','1','内科'); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - pat_id char(10) not null, - ward_id char(10), - pay_id char(10), - pat_name char(10) not null, - pat_sex char(10) not null, - pat_age int not null, - pat_identity char(20) not null, - pat_tel char(11) not null, - primary key (pat_id) -); - -INSERT into patient VALUES -('1','3','2','子豪','男',20,'3500000','13658945168'),('3','1','2','小富','女',30,'31333333','16151418195'); - -/*==============================================================*/ -/* Table: payment */ -/*==============================================================*/ -create table payment -( - pay_id char(10) not null, - pay_name char(20) not null, - pay_amount numeric(8,1) not null, - primary key (pay_id) -); - -INSERT into payment VALUES -('1','120',130.8), -('2','220',1400.3); - -/*==============================================================*/ -/* Table: pharmacy */ -/*==============================================================*/ -create table pharmacy -( - phar_id char(10) not null, - phar_name char(20) not null, - primary key (phar_id) -); - -INSERT into pharmacy VALUES -('1','头孢房'), -('2','999感冒灵房'); - -/*==============================================================*/ -/* Table: ward */ -/*==============================================================*/ -create table ward -( - ward_id char(10) not null, - ward_name char(20) not null, - primary key (ward_id) -); - -INSERT into ward VALUES -('1','210'), -('2','410'); - -/* ====================================== */ -alter table cases add constraint FK_cases foreign key (pat_id) - references patient (pat_id) on delete restrict on update restrict; - -alter table cases add constraint FK_cases2 foreign key (doc_id) - references doctor (doc_id) on delete restrict on update restrict; - -alter table department add constraint FK_Relationship_8 foreign key (hos_id) - references hospital (hos_id) on delete restrict on update restrict; - -alter table diagnosis add constraint FK_diagnosis foreign key (pat_id) - references patient (pat_id) on delete restrict on update restrict; - -alter table diagnosis add constraint FK_diagnosis2 foreign key (nurse_id) - references nurse (nurse_id) on delete restrict on update restrict; - -alter table doctor add constraint FK_Relationship_1 foreign key (dep_id) - references department (dep_id) on delete restrict on update restrict; - -alter table doctor add constraint FK_Relationship_10 foreign key (out_id) - references outpatient (out_id) on delete restrict on update restrict; - -alter table medicine add constraint FK_Relationship_4 foreign key (phar_id) - references pharmacy (phar_id) on delete restrict on update restrict; - -alter table nurse add constraint FK_Relationship_7 foreign key (phar_id) - references pharmacy (phar_id) on delete restrict on update restrict; - -alter table outpatient add constraint FK_Relationship_9 foreign key (hos_id) - references hospital (hos_id) on delete restrict on update restrict; - -alter table patient add constraint FK_Relationship_3 foreign key (ward_id) - references ward (ward_id) on delete restrict on update restrict; - -alter table patient add constraint FK_Relationship_6 foreign key (pay_id) - references payment (pay_id) on delete restrict on update restrict; -~~~ - diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230915 mysql\345\244\215\344\271\240.md" "b/08 \345\256\230\346\226\207\350\257\232/20230915 mysql\345\244\215\344\271\240.md" deleted file mode 100644 index 8bc15811a934b59dc64f142b6b95e3ce7a7cd14d..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230915 mysql\345\244\215\344\271\240.md" +++ /dev/null @@ -1,34 +0,0 @@ -## 复习 -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不null,就保持原值 - -#### ifnull - -计算时,ifnull(xx,代替值)当xx是null时,用代替值计算 - -使用方式:ifnull(字段名) - -limit 起始数,显示数 - -desc 库名:显示表结构 - -length(email):email的字节长度 - -#### 自然连接 - -表,表 where 字段=字段 and 字段=字段 - -#### 联表区间 - -表 left join 表 on 表.字段 between 表.字段 and 表.字段(不支持别名) - -#### 自连接 - -inner join - -not in(条件,条件) - -!(between 20 and 50) \ No newline at end of file diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230917 \345\260\217\346\265\213.md" "b/08 \345\256\230\346\226\207\350\257\232/20230917 \345\260\217\346\265\213.md" deleted file mode 100644 index 7f730378dd180fe65bc517aeafc29cf6c7f33624..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230917 \345\260\217\346\265\213.md" +++ /dev/null @@ -1,125 +0,0 @@ -![image-20230917211022417](https://s2.loli.net/2023/09/17/5URPqvCK6tAkHmo.png) - -~~~ sql - -CREATE DATABASE cat charset utf8; -use cat; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:56:05 */ -/*==============================================================*/ - - -drop table if exists car; - -drop table if exists client; - -drop table if exists salesman; - -drop table if exists salesrecord; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id char(10) not null, - car_brand char(20) not null, - car_model char(10) not null, - car_price decimal(10,1) not null, - primary key (car_id) -); - -INSERT into car VALUES -('s101','奔驰','e500',1000000), -('s102','奥迪','a6',800000), -('s103','法拉利','911',1563452), -('s104','五菱宏光','a100',234102); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - client_id char(20) not null, - client_name varchar(20) not null, - client_sex char(2) not null, - client_age int not null, - client_tel varchar(12) not null, - primary key (client_id) -); - -INSERT into client VALUES -('1','时学安','男',23,'13161554256'), -('2','叶子豪','女',30,'14488796603'), -('3','周富','男',24,'16635696642'), -('4','陈佳炜','男',26,'14851123620'); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - sales_id char(10) not null, - sales_name char(20) not null, - sales_sex char(2) not null, - sales_age int not null, - sales_tel varchar(12) not null, - primary key (sales_id) -); - -INSERT into salesman VALUES -('2','李俊兴','男',35,'14454756321'), -('1','谢铖浩','男',45,'13366522446'), -('3','肖钟凯韩','女',26,'15563320136'), -('4','马达','男',28,'14778952146'); - -/*==============================================================*/ -/* Table: salesrecord */ -/*==============================================================*/ -create table salesrecord -( - sal_quantity int not null, - sal_totalprices decimal(10,1) not null, - sal_time varchar(20) not null, - sal_id char(10) not null, - car_id char(10), - sales_id char(10), - client_id char(20), - primary key (sal_id) -); -INSERT into salesrecord VALUES -(1,1563452,'2022-02-03','1','s103','1','3'), -(1,234102,'2021-03-16','2','s104','3','2'), -(1,1000000,'2023-09-06','3','s101','4','1'), -(1,800000,'2023-12-23','4','s102','2','4'); - -alter table salesrecord add constraint FK_Relationship_1 foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table salesrecord add constraint FK_Relationship_2 foreign key (sales_id) - references salesman (sales_id) on delete restrict on update restrict; - -alter table salesrecord add constraint FK_Relationship_3 foreign key (client_id) - references client (client_id) on delete restrict on update restrict; - - --- 1.查询特定销售员的销售记录 -SELECT * FROM salesrecord where sales_id=(SELECT sales_id FROM salesman where sales_name='马达'); --- 2.查找销售记录中销售价格最高的汽车 -SELECT MAX(car_price) FROM car; -SELECT * FROM car c LEFT JOIN salesrecord s on c.car_id=s.car_id where car_price=(SELECT MAX(car_price) FROM car); --- 3.统计某个销售员的销售总额 -SELECT sum(sal_totalprices) FROM salesman sa LEFT JOIN salesrecord sl on sa.sales_id=sl.sales_id WHERE sales_name="马达" ; --- 4.根据客户信息查询其购买过的汽车 - SELECT c.client_name,car.car_brand FROM client c LEFT JOIN salesrecord s on c.client_id=s.client_id LEFT JOIN car on car.car_id=s.car_id WHERE c.client_name ='周富'; --- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 -SELECT c.car_brand,COUNT(s.sal_quantity) 销售数量,SUM(s.sal_totalprices) 总销售额 FROM car c LEFT JOIN salesrecord s on c.car_id=s.car_id GROUP BY c.car_id; --- 6.检索特定日期范围内的销售了哪些汽车 -SELECT * FROM salesrecord s LEFT JOIN car c on s.car_id=c.car_id where sal_totalprices BETWEEN '2023-09-06' and '2023-12-30'; --- 7.查找某车型的销售历史。 -SELECT * FROM car c LEFT JOIN salesrecord s on c.car_id=s.car_id WHERE c.car_brand='法拉利'; --- 8.统计每个销售员的销售数量 -SELECT c.client_name, COUNT(s.sal_quantity) FROM client c LEFT JOIN salesrecord s on c.client_id=s.client_id GROUP BY client_name; -~~~ - diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230919 \345\244\215\344\271\240 .md" "b/08 \345\256\230\346\226\207\350\257\232/20230919 \345\244\215\344\271\240 .md" deleted file mode 100644 index 19ac09d24709777a05a00239087e820731484b9a..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230919 \345\244\215\344\271\240 .md" +++ /dev/null @@ -1,777 +0,0 @@ -## 作业 - -~~~ sql -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -CREATE DATABASE lx charset utf8; -use lx; - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - - - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 -SELECT sum(salary*12) 基本工资 FROM employees; - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 - -SELECT (sum(salary)+sum(commission_pct*salary))*12 FROM employees; - -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - -SELECT DISTINCT job_id FROM employees; - -# 3.查询工资大于12000的员工姓名和工资 -SELECT first_name 员工姓名,salary 工资 FROM employees where salary>12000; - - -# 4.查询员工号为176的员工的姓名和部门号 - -SELECT first_name 姓名,department_id 部门号 FROM employees where employee_id = 176; -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - -DESC departments; - -SELECT * FROM departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -SELECT first_name 姓名,salary 工资 FROM employees where salary not BETWEEN 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -SELECT first_name 姓名,department_id 部门号 from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -SELECT first_name,job_id from employees where manager_id is null; - - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - - -SELECT first_name 员工姓名,salary 工资,j.grade_level 奖金级别 FROM employees e LEFT JOIN job_grades j on e.commission_pct*salary BETWEEN j.lowest_sal and j.highest_sal; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -SELECT * from employees WHERE first_name like '__尔'; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -SELECT * from employees WHERE last_name like '%特%' and last_name like '%尔%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -SELECT * FROM employees where first_name like '%尔'; -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -SELECT first_name 姓名, j.job_title 工种 FROM employees e LEFT JOIN jobs j on e.job_id=j.job_id where e.department_id BETWEEN 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -SELECT first_name 员工姓名, salary 工资,manager_id 管理者id from employees where manager_id in (100,101,110); - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - -SELECT first_name 姓名 ,department_id 部门号,salary*12 年薪 from employees ORDER BY 年薪 DESC; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -SELECT first_name 姓名 ,salary 工资 from employees where salary not BETWEEN 8000 and 17000 ORDER BY salary desc LIMIT 0,20; - - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -SELECT * FROM employees where email like '%e%' ORDER BY LENGTH(email) desc , department_id asc; - - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 - -SELECT e.first_name 姓名,d.department_id 部门号, d.department_name 部门名称 FROM employees e LEFT JOIN departments d on d.department_id=e.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -SELECT job_id,location_id FROM employees e LEFT JOIN departments d on d.department_id=e.department_id where d.department_id=90; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -SELECT e.last_name , d.department_name , l.location_id,l.city FROM employees e LEFT JOIN departments d on d.department_id=e.department_id LEFT JOIN locations l on l.location_id=d.location_id where commission_pct is not null; - - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -SELECT e.last_name , e.job_id , d.department_id , d.department_name FROM employees e LEFT JOIN departments d on d.department_id=e.department_id LEFT JOIN locations l on l.location_id=d.location_id where l.city='多伦多'; - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -SELECT department_name 部门名称, city 部门地址, e.last_name 姓名, j.job_title 工作, e.salary 工资 FROM employees e,departments d,locations l,jobs j where e.department_id=d.department_id and d.location_id=l.location_id and j.job_id=e.job_id; - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -SELECT b.first_name 员工姓名,b.department_id 员工编号,a.last_name 上级姓名,a.manager_id 上级的员工编号 FROM employees a JOIN employees b where a.department_id=b.department_id; - - -# 7.查询哪些部门没有员工 -SELECT * FROM departments d LEFT JOIN employees e on d.department_id=e.department_id where e.department_id is null; - -# 8. 查询哪个城市没有部门 -SELECT * FROM departments d LEFT JOIN locations l on d.location_id=l.location_id where state_province is null ; - - - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -SELECT * FROM employees e JOIN departments d ON e.department_id = d.department_id WHERE d.department_name like '销售部' or d.department_name like '信息技术部'; - - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - -SELECT MAX(salary) 最大值,MIN(salary) 最小值,AVG(salary) 平均值,SUM(salary) 总和 FROM employees; -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -SELECT MAX(salary) 最大值,MIN(salary) 最小值,AVG(salary) 平均值,SUM(salary) 总和,job_id FROM employees GROUP BY job_id; -#4.选择各个job_id的员工人数 - -SELECT count(job_id) FROM employees GROUP BY job_id; - -# 5.查询员工最高工资和最低工资的差距 -SELECT MAX(salary) - MIN(salary) 差距 FROM employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - - SELECT MAX(salary) 最大值,MIN(salary) 最小值 FROM employees WHERE salary>6000 and manager_id is not null GROUP BY manager_id; - - - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - - -SELECT d.department_name,AVG(salary),count(job_id) FROM employees e JOIN departments d ON e.department_id = d.department_id GROUP BY d.department_name ORDER BY AVG(salary) DESC; - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -SELECT job_title,department_name,min_salary FROM jobs j JOIN employees e on j.job_id=e.job_id join departments d on e.department_id=d.department_id - - - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - - -SELECT last_name,salary FROM employees WHERE department_id= (SELECT department_id FROM employees WHERE last_name like '兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - - -SELECT employee_id,last_name,salary FROM employees WHERE salary>(SELECT AVG(salary) FROM employees); -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary -SELECT last_name, job_id, salary FROM employees WHERE salary>(SELECT MAX(salary) FROM employees WHERE JOB_ID = 'SA_MAN'); - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -SELECT employee_id FROM employees where first_name like "%u%"; -SELECT employee_id 员工号,first_name 姓名 FROM employees where employee_id = (SELECT employee_id FROM employees where first_name like "%u%"); - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -SELECT location_id FROM departments where location_id = 1700; -SELECT first_name,department_id FROM employees where department_id in (SELECT department_id FROM departments where location_id = 1700); - - -#6.查询管理者是 金 的员工姓名和工资 -SELECT last_name FROM employees WHERE last_name='金'; - -SELECT first_name 员工姓名,salary 工资 FROM employees where last_name in (SELECT last_name FROM employees WHERE last_name='金'); -#7.查询工资最低的员工信息: last_name, salary - -SELECT last_name,salary FROM employees WHERE salary =(SELECT MIN(salary) FROM employees); - - -#8.查询平均工资最低的部门信息 -#方式1: -# 部门最低工资=全司最低 - -#方式2 -# 部门平均<= 公司所有平均 - -SELECT department_id FROM employees GROUP BY department_id ORDER BY avg(salary) LIMIT 0,1; - -SELECT DISTINCT d.* FROM employees e LEFT JOIN departments d on e.department_id=d.department_id where d.department_id = (SELECT department_id FROM employees GROUP BY department_id ORDER BY avg(salary) LIMIT 0,1); - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - # 连表查 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - # 子查询 - select d.*,a.平均工资 from departments d right join - (select department_id,avg(salary) 平均工资 from employees group by department_id having avg(salary) = - (select avg(salary) 平均工资 from employees group by department_id order by 平均工资 limit 0,1)) a - on d.department_id = a.department_id; - - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 - select j.*,avg(e.salary) 平均工资 - from jobs j right join employees e on j.job_id = e.job_id group by j.job_id order by 平均工资 desc limit 0,1; - -#11.查询平均工资高于公司平均工资的部门有哪些? - select d.department_name 部门名,avg(e.salary) 平均工资 - from departments d right join employees e on d.department_id = e.department_id - group by d.department_id having 平均工资 > (select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - select * from employees where employee_id in - (select distinct(a.employee_id) from - (select e2.* from employees e1 left join employees e2 on e1.manager_id = e2.employee_id) a); - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - select * from employees where employee_id in - (select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - select min(e.salary) 最低工资 from employees e right join - (select department_id,max(salary) 最高工资 from employees group by department_id order by 最高工资 limit 0,1) a - on e.department_id = a.department_id ; - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - select last_name, department_id, email, salary from employees where employee_id = - (select employee_id from employees e right join - (select department_id,avg(salary) 平均工资 from employees group by department_id order by 平均工资 desc limit 0,1) a - on e.department_id = a.department_id limit 0,1); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - select job_id from jobs where job_id != 'ST_CLERK'; - -#16. 选择所有没有管理者的员工的last_name - select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - select * from employees where last_name = 'De Haan' - -#方式2: - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - select e.employee_id 员工号,e.last_name 姓名,e.salary 工资,a.平均工资 from employees e left join - (select department_id,avg(salary) 平均工资 from employees group by department_id) a - on e.department_id = a.department_id and e.salary > a.平均工资; - -#方式2:在FROM中声明子查询 - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - select department_name from departments where department_id in - (select distinct department_id from employees where employee_id in - (select manager_id from employees group by manager_id having count(manager_id)>5)); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - select country_id from locations where location_id in - (select location_id from departments group by location_id having count(location_id) > 2); -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - -~~~ - diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230920 \347\254\224\350\256\260.md" "b/08 \345\256\230\346\226\207\350\257\232/20230920 \347\254\224\350\256\260.md" deleted file mode 100644 index 3c85fd0fe8933dff24fbb48f1e4979cb623bb5df..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230920 \347\254\224\350\256\260.md" +++ /dev/null @@ -1,153 +0,0 @@ -### 笔记 - - - -RBAC (Role-BasedAccess cotrd) (主流方案) - -1.业务数据表:用户,商品 - -2.功能资源表:菜单信息表,页面代码表 - -### 权限使用场景 - -网页不一样,网页一样,但可以用的菜单不一样,但一个菜单下的网页元素可能不一样(按钮,数据不一样,权限不一样) - - - -按钮权限:不同的用户查看同一个对象时 展示的按钮不一样 - -数据权限:不同的用户查看同一个对象时,可见的数据不一样 - -操作权限:看得到,点不了 - - - -#### RBAC由三个部分组成 - -1. 用户 2. 角色 3. 权限 - -2. - User(用户):每个用户都有唯一的UID识别,并被授予不同的角色 - - - - Role(角色):不同角色具有不同的权限 - - - Permission(权限):访问权限 - 用户-角色映射:用户和角色之间的映射关系 - 角色-权限映射:角色和权限之间的映射 - - - -~~~ sql -/*==============================================================*/ /* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:29:51 */ -/*==============================================================*/ -CREATE DATABASE liunian charset utf8; -USE liunian; -DROP TABLE -IF - EXISTS jurisdiction; -DROP TABLE -IF - EXISTS role; -DROP TABLE -IF - EXISTS role_qx; -DROP TABLE -IF - EXISTS USER; -DROP TABLE -IF - EXISTS user_role; -/*==============================================================*/ -/* Table: jurisdiction */ -/*==============================================================*/ -CREATE TABLE jurisdiction ( - juri_id INT NOT NULL auto_increment, - juri_name CHAR ( 20 ) NOT NULL, - juri_register VARCHAR ( 20 ) NOT NULL, - juri_address VARCHAR ( 20 ) NOT NULL, - PRIMARY KEY ( juri_id ) -); - -INSERT INTO `jurisdiction` VALUES (1, '总指挥', '随地登录', '78星'); -INSERT INTO `jurisdiction` VALUES (2, '指挥', '随地登录', '火星'); -INSERT INTO `jurisdiction` VALUES (3, '支队长', '本地登录', '地球'); -INSERT INTO `jurisdiction` VALUES (4, '教练', '本地登录', '地球'); -INSERT INTO `jurisdiction` VALUES (5, '小丑', '无', '月球'); -INSERT INTO `jurisdiction` VALUES (6, '变态', '无', '地球'); -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -CREATE TABLE role ( role_id INT ( 20 ) NOT NULL auto_increment, role_name CHAR ( 20 ) NOT NULL, PRIMARY KEY ( role_id ) ); - -INSERT INTO `role` VALUES (1, '迪迦'); -INSERT INTO `role` VALUES (2, '泰罗'); -INSERT INTO `role` VALUES (3, '赛罗'); -INSERT INTO `role` VALUES (4, '赛文'); -/*==============================================================*/ -/* Table: role_qx */ -/*==============================================================*/ -CREATE TABLE role_qx ( juri_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY ( juri_id, role_id ) ); - -INSERT INTO `role_qx` VALUES (5, 1); -INSERT INTO `role_qx` VALUES (6, 1); -INSERT INTO `role_qx` VALUES (2, 2); -INSERT INTO `role_qx` VALUES (4, 2); -INSERT INTO `role_qx` VALUES (3, 3); -INSERT INTO `role_qx` VALUES (4, 3); -INSERT INTO `role_qx` VALUES (1, 4); -INSERT INTO `role_qx` VALUES (2, 4); -INSERT INTO `role_qx` VALUES (3, 4); -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -CREATE TABLE USER ( - user_id INT NOT NULL auto_increment, - user_name CHAR ( 20 ) NOT NULL, - user_pwd CHAR ( 20 ) NOT NULL, - PRIMARY KEY ( user_id ) -); - -INSERT INTO `user` VALUES (1, '时学安', '222222'); -INSERT INTO `user` VALUES (2, '周富', '111111'); -INSERT INTO `user` VALUES (3, '肖钟凯韩', '333333'); -INSERT INTO `user` VALUES (4, '叶子豪', '444444'); - -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -CREATE TABLE user_role ( role_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY ( role_id, user_id ) ); - -INSERT INTO `user_role` VALUES (1, 1); -INSERT INTO `user_role` VALUES (2, 2); -INSERT INTO `user_role` VALUES (3, 3); -INSERT INTO `user_role` VALUES (4, 4); - -ALTER TABLE role_qx ADD CONSTRAINT FK_role_qx FOREIGN KEY ( juri_id ) REFERENCES jurisdiction ( juri_id ) ON DELETE RESTRICT ON UPDATE RESTRICT; -ALTER TABLE role_qx ADD CONSTRAINT FK_role_qx2 FOREIGN KEY ( role_id ) REFERENCES role ( role_id ) ON DELETE RESTRICT ON UPDATE RESTRICT; -ALTER TABLE user_role ADD CONSTRAINT FK_user_role FOREIGN KEY ( role_id ) REFERENCES role ( role_id ) ON DELETE RESTRICT ON UPDATE RESTRICT; -ALTER TABLE user_role ADD CONSTRAINT FK_user_role2 FOREIGN KEY ( user_id ) REFERENCES USER ( user_id ) ON DELETE RESTRICT ON UPDATE RESTRICT; - - - -SELECT - u.user_name, - r.role_name, - j.juri_name, - j.juri_register, - j.juri_address -FROM - `user` u, - user_role us, - role r, - role_qx qx, - jurisdiction j -WHERE - u.user_id = us.user_id -AND - us.role_id=r.role_id - and - r.role_id=qx.role_id - and - qx.juri_id=j.juri_id - and u.user_pwd='2b2b2b2b' - and u.user_name='时学安' - ; -~~~ - diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230921 \344\275\234\344\270\232.md" "b/08 \345\256\230\346\226\207\350\257\232/20230921 \344\275\234\344\270\232.md" deleted file mode 100644 index c2ed58bdcb8672973dd3ad82f657724fff6acff6..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230921 \344\275\234\344\270\232.md" +++ /dev/null @@ -1,185 +0,0 @@ -### 笔记 - -sku:规格 (最小库存的单位) - -SKU是指一款商品,每款都有出现一个SKU。 - -一款商品多色,则是有多个SKU, - - 例:一件衣服,有红色、白色、蓝色。 对一种商品而言,当其品牌、型号、配置、等级、花色、包装容量、单位、生产日期、保质期、用途、价格、产地等属性与其他商品存在不同时,可称为一个单品。 - -## SPU与SKU的区别 - -一般SPU 与SKU 是一对一,或者一对多的关系;如果一对多的话就是不同的规格 例子:SPU就是商品的“款”;SKU就是商品的“件” SPU指一个商品集合,一般来说就是一个集合链。 - -一个服装的集合链会包括相似款式和不同的尺码,SKU则是最小品类单元,同一个款式的衣服不同的尺码也算不同的SKU。SKU多见于前台的商品编号,SPU多见于后台的商品管理 - -~~~ SQL - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/21 17:34:09 */ -/*==============================================================*/ - - -CREATE DATABASE scgo charset utf8; -use scgo; - -drop table if exists ability; - -drop table if exists attributes; - -drop table if exists sku; - -drop table if exists sku_spe; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: ability */ -/*==============================================================*/ -create table ability -( - ab_id int not null auto_increment, - ab_name char(20) not null, - primary key (ab_id) -); - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - att_id int not null auto_increment, - att_name char(20) not null, - primary key (att_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int not null, - sku_title varchar(100) not null, - price decimal(8,2) not null, - repertory int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: sku_spe */ -/*==============================================================*/ -create table sku_spe -( - se_id int not null auto_increment, - sku_id int, - att_id int, - ab_id int, - primary key (se_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(20) not null, - spu_details varchar(100) not null, - primary key (spu_id) -); - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -alter table sku_spe add constraint FK_Relationship_2 foreign key (sku_sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table sku_spe add constraint FK_Relationship_3 foreign key (att_id) - references attributes (att_id) on delete restrict on update restrict; - -alter table sku_spe add constraint FK_Relationship_4 foreign key (ab_id) - references ability (ab_id) on delete restrict on update restrict; - - --- 数据 -INSERT INTO `spu` VALUES (1, 'Awp狙击枪', '直架中路'); - -INSERT INTO `attributes` VALUES (1, '崭新出厂'); -INSERT INTO `attributes` VALUES (2, '略有磨损'); -INSERT INTO `attributes` VALUES (3, '野火'); -INSERT INTO `attributes` VALUES (4, '永恒之枪'); -INSERT INTO `attributes` VALUES (5, '巨龙传说'); - -INSERT INTO `sku` VALUES (1, 1, 'Awp|野火(崭新出厂)', 1085.50, 100); -INSERT INTO `sku` VALUES (2, 1, 'Awp|野火(略有磨损)', 624.00, 200); -INSERT INTO `sku` VALUES (3, 1, 'Awp|永恒之枪(崭新出厂)', 90448.00, 287); -INSERT INTO `sku` VALUES (4, 1, 'Awp|永恒之枪(略有磨损)', 76666.00, 101); -INSERT INTO `sku` VALUES (5, 1, 'Awp|巨龙传说(崭新出厂)', 99999.00, 111); -INSERT INTO `sku` VALUES (6, 1, 'Awp|巨龙传说(略有磨损)', 84625.00, 11); - -INSERT INTO `ability` VALUES (1, '皮肤'); -INSERT INTO `ability` VALUES (2, '磨损'); - - -INSERT INTO `sku_spe` VALUES (1, 1, 1, 2); -INSERT INTO `sku_spe` VALUES (2, 1, 3, 1); -INSERT INTO `sku_spe` VALUES (3, 2, 2, 2); -INSERT INTO `sku_spe` VALUES (4, 2, 3, 1); -INSERT INTO `sku_spe` VALUES (5, 3, 1, 2); -INSERT INTO `sku_spe` VALUES (6, 3, 4, 1); -INSERT INTO `sku_spe` VALUES (7, 4, 2, 2); -INSERT INTO `sku_spe` VALUES (8, 4, 4, 1); -INSERT INTO `sku_spe` VALUES (9, 5, 1, 2); -INSERT INTO `sku_spe` VALUES (10, 5, 5, 1); -INSERT INTO `sku_spe` VALUES (11, 6, 2, 2); -INSERT INTO `sku_spe` VALUES (12, 6, 5, 1); - --- 查询1 - -SELECT - spu.spu_name, - sku.sku_title, - price, - ab_name, - att_name -FROM - spu, - sku, - sku_spe sp, - ability ab, - attributes att -WHERE - spu.spu_id = sku.spu_id - AND sku.sku_id = sp.sku_id - AND sp.ab_id = ab.ab_id - AND sp.att_id = att.att_id; - - --- 查询2 - SELECT - spu.spu_name, - sku.sku_title, - price, - ab_name, - att_name -FROM - spu, - sku, - sku_spe sp, - ability ab, - attributes att -WHERE - spu.spu_id = sku.spu_id - AND sku.sku_id = sp.sku_id - AND sp.ab_id = ab.ab_id - AND sp.att_id = att.att_id - and sku.sku_id=( -SELECT aa.sku_id FROM -(SELECT sku_id FROM sku_spe sp,attributes att where sp.att_id=att.att_id and att_name='野火') aa, -(SELECT sku_id FROM sku_spe sp,attributes att where sp.att_id=att.att_id and att_name='略有磨损') bb -where aa.sku_id=bb.sku_id); -~~~ - diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230924 \351\242\204\344\271\240.md" "b/08 \345\256\230\346\226\207\350\257\232/20230924 \351\242\204\344\271\240.md" deleted file mode 100644 index c3c3358f7abb56aff726b30565648b31dd45f66d..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230924 \351\242\204\344\271\240.md" +++ /dev/null @@ -1,30 +0,0 @@ -### 预习 - - #### 1.事务 - -为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - - #### 事务的四个特性 - -1.原子性:事务包含的这一系列操作,要么全部成功,要么全部失败 2.一致性:事务完成之后,不会将非法的数据写入数据库。 - -3.隔离性:多个事务可以在一定程度上并发执行 - -​ 4.持久性:事务完成之后,数据要永久保存 - -#### 2.视图 在已有的表或者视图上创建的虚拟表 - -创建视图: create view 视图名 asselect 可以对(单表)视图进行一些增删改查的操作,这些操作会影响到原始的表 删除视图:drop view 视图名 - -#### 3.索引 - -为了提高查询的速度而在数据库断创建的一种排序的数据结构 - -#### 4.储存过程 - -存储在数据库端的一组为了完成特点功能的sql语句 - -存储过程:create procedure 存储过程名(【参数】) - -参数格式(参数类型 参数名 数据类型) - diff --git "a/08 \345\256\230\346\226\207\350\257\232/20230927 \350\247\206\345\233\276.md" "b/08 \345\256\230\346\226\207\350\257\232/20230927 \350\247\206\345\233\276.md" deleted file mode 100644 index f1d7ca2d30d2851c75747d7eb17af2bebe08fce1..0000000000000000000000000000000000000000 --- "a/08 \345\256\230\346\226\207\350\257\232/20230927 \350\247\206\345\233\276.md" +++ /dev/null @@ -1,136 +0,0 @@ -## 笔记 - -### check约束 - -作用:检查某个字段是否符合要求,一般指的是值的范围 age int age>0 - -~~~ sql -语法:create table 表名( - -sex char(1), - -check (sex in ('男','女')) - -); -~~~ - - - -### 在utf8中一个汉字等于一个字符,等于三个字节 - - - -# 视图 - -1.视图是一种虚拟表,本身是不具有数据的,占用很少的内存空间,它是sql中一个重要概念。 - -2.视图建立在已有表的基础上,视图赖从建立的这些表为基表。 - -### 创建视图 - -~~~ sql -create view 视图名 as 查询语句 ---- 将过滤后的数据,保存成一个视图,有利于数据的安全性 -~~~ - -### 基于视图建立视图 - -建立好一个视图后,在这个视图的基础上,继续建视图 - -### 查看表格的创建过程 - -~~~sql -show create table 表名 -show create table 视图名 -~~~ - -### 更新视图数据 - -视图中的行和底层基表中的行之间必须存在一对一的关系(视图虽然可以更新,但总得来说视图作为虚拟表 不建议更新) - -~~~sql -方法一: -create or replace view 视图名 ---- (有这个视图就更新,没有就创建) -方法二: -alter view ---- (前提是这个修改的视图一定有在) - -~~~ - -### 删除视图 - -语法: - -drop view 视图名 - -drop view if exists 视图名 - -## 作业 - -~~~ sql -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE VIEW employee_vu as -SELECT last_name 姓名,employee_id 员工号 , department_id 部门号 FROM employees; - - -#2. 显示视图的结构 - -show CREATE TABLE employee_vu; -#3. 查询视图中的全部内容 - -SELECT * FROM employee_vu; -#4. 将视图中的数据限定在部门号是80的范围内 - -SELECT * FROM employee_vu WHERE 部门号 >=0 and 部门号 <=80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -CREATE VIEW emp_v1 AS -SELECT last_name 员工姓名,salary 工资,email 邮箱 FROM employees where phone_number like '011%'; - - -SELECT * FROM emp_v1; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - -ALTER VIEW emp_v1 as SELECT last_name 员工姓名,salary 工资,phone_number 电话号码, email 邮箱 FROM employees where phone_number like '011%' and email like '%e%'; - -SELECT * FROM emp_v1; - - -#3. 向 emp_v1 插入一条记录,是否可以? - -不可以 - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE emp_v1 set 工资 = 工资+1000; -#5. 删除emp_v1中姓名为Olsen的员工 - -DELETE from emp_v1 where 员工姓名 ='Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -CREATE view emp_v2 as -SELECT d.department_id,max(salary) FROM employees e,departments d WHERE e.department_id=d.department_id and e.salary > 12000 GROUP BY d.department_id; - - -SELECT * FROM emp_v2; -#7. 向 emp_v2 中插入一条记录,是否可以? - -不可以 - - -#8. 删除刚才的emp_v2 和 emp_v1 -DROP VIEW if exists emp_v2; -DROP VIEW if exists emp_v1; -~~~ - diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230905 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230905 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index 3c97d8f070ec84c9b0c1448ed99068a0f509480e..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230905 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,51 +0,0 @@ -# 笔记 - -​ 新学期,意味着新的目标,充满着新的期待。我们应该以更加积极向上的态度投入到自主学习中,持续发扬软工学子的守正务实、但当实干的精神。 - -​ 新学期、新奋斗、新开始、新起点。 - -​ 我们应当多关注招聘网站,多以我们所学的专业招聘职位的岗位要求,为我们的学习目标;这样可以使我们更好的适应今后的工作。 - -## 例如: - -**前端部分:** -  1)HTML:网页的核心语言,构成网页的基础 -  2)CSS:使网页更加丰富多彩灿烂的利器 -  3)JavaScript:使网页动起来的根本,加强了网页和用户之间的交互 -  4)HTML DOM:换一种更加形象化的角度来看待网页,让我们更加方便的控制 网页 -  5)HTML BOM:与浏览器交互不可或缺的工具 -  6)JavaScript库,主要是:jQuery及其插件、YUI及其插件,使编写网页更加的方便快捷和健壮的强大工具 -  7)AJAX:异步提交,增强了用户使用网页的良好交互体验 -  8)JSON: 比 XML 更小、更快,更易解析的数据传输工具 -  9)FLEX:提供丰富多彩的动画效果 -  10)普元工作流:更加清晰明了的帮助用户处理业务流程上面的工作 -  11)JSP:Servlet的展示层,使网页逻辑与网页设计的显示分离 -  12)JSTL:加强和简化了JSP页面的开发 -  13)EL:使JSP页面写起来更加简单 -**后台部分:** -  1)JAVA语言编程基础部分:内容丰富是Java知识体系结构的核心和基础 -  2)JDBC:提供了一种基准,据此可以构建更高级的工具和接口,使Java开发人员能够编写数据库应用程序 -  3)JavaMail:用于电子邮件的相关的编程工作 -  4)JUnit:单元测试,整个变成工作测试的地位始终非常重要 -  5)Log4j:使我们能够更加细致地控制日志的生成过程 -  6)Servlet:JavaWeb的核心 -  7)Struts2:JavaWeb编程中明星级的框架,优点多功能强使编程工作更简单,主要用于控制跳转 -  8)Spring:JavaWeb编程中明星级的框架,同样优点多功能强使编程工作更简单,主要用于管理对象 -  9)iBatis:JavaWeb编程中明星级的框架,同样也是优点多功能强使编程工作更简单,主要用于程序和数据库之间的交互 -  10)SQL:与数据库交互式编程的必备工具 - **版本控制:** -  1)SVN:版本控制,方便团队协同工作 - - - **WEB服务器:** -  1)Tomcat:优秀免费的中小型WEB服务器 -  2)Weblogic:功能很强大的WEB服务器 - **开发工具:** -  1)Eclipse:开源强大的Java编程工具 -  2)MyEclipse:在eclipse 基础上加上自己的插件开发而成的功能强大的企业级集成开发环境 -**数据库:** -  1)Oracle:数据库业界老大,这个常用一点当然,也仅仅是常用一些常用的功能而已,需要加强 -  2)MySQL:最好的关系型数据库之一 -  3)SqlServer:最好的关系型数据库之一 -**数据库客户端:** -  1)Toad:非常棒的数据库客户端软件 diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230906 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230906 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index 92840d1a113e869bfa3af1f6a08aacd4e1139a40..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230906 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,166 +0,0 @@ -# 笔记 - -## 数据库设计 - -可以根据用户需求和开发的系统的需求,设计出符合对应的DBMS的需求的数据库结构,使其能有效的存储和管理数据。 - - - -### 表之间的关系: - -1、一对一的关系 - -将其一个表的主键,另一个表当主键 - -2、一对多的关系 - -将一所在的表的主键,放到多的表当外键 - -3、多对多的关系 - -必须有第三张表,将前面两个表的主键放到这当主键 - - - -### E-R图(实体关系图) - -要素:实体(表)、属性(字段)和关系(类似外键约束) - -实体:用矩形、主键:加下划线、外键;横线中间加菱形 - - - -## 数据库设计的步骤 - -设计阶股 - -需求分析 - -概念结构设计 - -逻相结构设计 - -物理结构设计 - -数据库的实施 - -数据库的维护 - -# 作业 - -``` mysql -create database tnfb charset utf8; - -use tnfb; - -##院系表 -create table department( - d_id int primary key, - d_name varchar(20) -); -insert into department values -(112,'软件工程学院'), -(113,'财经商贸学院'), -(114,'医疗医护学院'); - -##专业表 -create table speciality( - s_id int primary key, - s_name varchar(20), - d_id int, - foreign key (d_id) references department(d_id) -); -insert into speciality values -(11,'软件技术',112), -(22,'会计',113), -(33,'护理',114); - -##教室表 -create table classroom( -r_id int PRIMARY KEY, -r_name varchar(10) -); -insert into classroom values -(1,'实训八'), -(2,'实训五'), -(3,'实训三'); - -##班级表 -create table class( - c_id int primary key, - c_name varchar(20), - s_id int, - foreign key (s_id) references speciality(s_id) -); -insert into class values -(1,'软件技术2班',11), -(2,'软件技术8班',11), -(3,'软件技术4班',11); - -##课程 -CREATE TABLE course( - couseId int PRIMARY key, - courseName varchar(10), - credit int, - c_id int,##班级编号 - r_id int,##教室编号 - foreign key (c_id) references class(c_id), - foreign key (r_id) references classroom(r_id) -); -insert into course VALUES -(1,'java',78,1,2), -(2,'html',90,2,3), -(3,'php',80,3,1); - -##教师表 -create table teacher( - t_id int primary key, - t_name varchar(20), - sex varchar(20), - d_id int,##院系编号 - couseId int,##课程编号 - foreign key (d_id) references department(d_id), - foreign key (couseId) references course(couseId) -); -insert into teacher values -(1,'老代','男',123,1), -(2,'老二','女',456,2), -(3,'小六','女',789,3); - -##课程表 -create table `select` ( - selectId int primary key, - couseId int,##课程编号 - time varchar(20), - t_id int,##教师编号 - r_id int,##班级编号 - foreign key (couseId) references course(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references classroom(r_id) -); -insert into `select` values -(1,1,'星期一上午',2,3), -(2,2,'星期二下午',1,2), -(3,3,'星期三上午',3,1); - -##学生表 -create table student ( - id int primary key, - name varchar(20), - sex varchar(10), - age int, - address varchar(20), - d_id int,##院系编号 - c_id int,## 课程编号 - selectId int,##选修表的编号 - foreign key (d_id) references department(d_id), - foreign key (c_id) references class(c_id), - foreign key (selectId) references `select`(selectId) -); -insert into student values -(01,'小代','男',18,'团结里3',11,1,1), -(02,'小二','女',28,'团结里4',12,2,2), -(03,'老六','女',38,'团结里5',13,3,3); - -``` - diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230907 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230907 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index 00348b6756a1a5d90a1813aa1681b063c717e46c..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230907 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,90 +0,0 @@ -# 笔记 - -## 数据库的范式 - -1.第一范式:要求字段的内容,不可分割,为的是保证数据的原子性。 - -2.第二范式:要求满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键要依赖整个联合主键),而不能只依赖部分。 - -3.第三范式:满足第二范式的前提上,要求非主键属性要直接依赖于主键。 - - - -# 练习 - -```mysql -create database tnfb charset utf8; -use tnfb; - -#院系表 -create table college( - cll_id int primary key auto_increment, - cll_name varchar(10), - cll_tel char(11) -); - -#专业表 -create table major( - m_id int primary key auto_increment, - m_name varchar(10), - cll_id int, - foreign key(cll_id) references college(cll_id) -); - -#班级表 -create table clazz( - c_id int primary key auto_increment, - c_name varchar(10), - c_grabe int, - m_id int, - foreign key(m_id) references major(m_id) -); - -#教室表 -create table classroom( - cl_id int primary key auto_increment, - cl_name varchar(10) -); -#教师表 -create table teacher( - t_id int primary key auto_increment, - t_name varchar(10), - cll_id int, - foreign key(cll_id) REFERENCES college(cll_id) -); -#课程信息表 -create table message( - me_id int primary key auto_increment, - me_time varchar(20) -); -#课程表 (教室号,上课时间,上课时间段,教师号,课程号,院系号) -create table course( - co_id int primary key auto_increment, - co_name varchar(10), - co_credit int, - cll_id int, - cl_id int, - me_id int, - t_id int, - foreign key(cl_id) REFERENCES classroom(cl_id), - foreign key(cll_id) REFERENCES college(cll_id), - foreign key(me_id) REFERENCES message(me_id), - foreign key(t_id) REFERENCES teacher(t_id) -); - -#学生表 -create table student( - st_id int primary key auto_increment, - st_name varchar(10), - st_grabe int, - c_id int, - co_id int, - foreign key(co_id) references course(co_id), - foreign key(c_id) references clazz(c_id) -); - - - - -``` - diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index e972e71fa997aa3926f91817cbc6840016ee6cf4..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,106 +0,0 @@ -# 笔记 - -## 操作步骤 - -1.创建概念模型(E-R图) CDM - -2.转换成逻辑模型 LDM - -3.转换成物理模型 PDM - -4.生成DDL - - - -# 作业 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/10 19:49:40 */ -/*==============================================================*/ -create database tsglxt charset utf8; -use tsglxt; - -drop table if exists Books; - -drop table if exists Borrowing; - -drop table if exists Borrowing2; - -drop table if exists publishinghouse; - -/*==============================================================*/ -/* Table: Books */ -/*==============================================================*/ -create table publishinghouse ##出版社 -( - pu_id varchar(10) not null, - pu_call char(11) not null, - pu_zip char(6) not null, - primary key (pu_id) -); -insert into publishinghouse values -(1001,'人民出版社','666666'), -(1002,'清华出版社','777777'), -(1003,'代哥出版社','888888'); - -create table Books ##图书 -( - bo_id varchar(20) not null, - pu_id varchar(10) not null, - bo_name varchar(10) not null, - bo_loc varchar(20) not null, - primary key (bo_id) -); -insert into Books values -(01,1001,'简爱','五楼二号柜第一排'), -(02,1002,'三国演义','四楼二号柜第二排'), -(03,1003,'神墓','三楼三号柜第一排'); - -/*==============================================================*/ -/* Table: Borrowing */ -/*==============================================================*/ -create table Borrowing ##借阅者 -( - borr_id varchar(2) not null, - borr_name varchar(6) not null, - primary key (borr_id) -); -insert into Borrowing values -(01,'代总'), -(02,'代副总'), -(03,'小代总'); - -/*==============================================================*/ -/* Table: Borrowing2 */ -/*==============================================================*/ -create table Borrowing2 -( - bo_id varchar(20) not null, - borr_id varchar(2) not null, - borr_date varchar(10) not null, - "Return" varchar(10) not null, - primary key (bo_id, borr_id, borr_date) -); -insert into Borrowing2 values -(01,01,'2023.2.1','2023.2.3'), -(02,02,'2023.7.1','2023.7.3'), -(03,03,'2023.6.1','2023.6.3'); -/*==============================================================*/ -/* Table: publishinghouse */ -/*==============================================================*/ - - -alter table Books add constraint FK_publication foreign key (pu_id) - references publishinghouse (pu_id) on delete restrict on update restrict; - -alter table Borrowing2 add constraint FK_Borrowing foreign key (bo_id) - references Books (bo_id) on delete restrict on update restrict; - -alter table Borrowing2 add constraint FK_Borrowing2 foreign key (borr_id) - references Borrowing (borr_id) on delete restrict on update restrict; - - -``` - diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230912 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230912 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index ecc63b34925dcdb233416667b06387c7fb282926..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230912 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,187 +0,0 @@ -# 笔记 - -2023年9月12日 天晴 心情一般! - -# 作业 - - - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 17:37:52 */ -/*==============================================================*/ -create database movie charset utf8; -use movie; - -drop table if exists Directorinformation; - -drop table if exists address; - -drop table if exists audience; - -drop table if exists booklist; - -drop table if exists film; - -drop table if exists filmreview; - -drop table if exists introq; - -drop table if exists language; - -drop table if exists phrase; - -drop table if exists type; - -/*==============================================================*/ -/* Table: Directorinformation */ -/*==============================================================*/ -create table Directorinformation #详细信息 -( - d_id int not null, - i_id int not null, - d_name varchar(5) not null, - d_sex char(2) not null, - d_age varchar(3) not null, - d_add varchar(50) not null, - primary key (d_id) -); - -/*==============================================================*/ -/* Table: address */ -/*==============================================================*/ -create table address #地址 -( - a_id int not null, - f_id int not null, - a_name varchar(5) not null, - primary key (a_id) -); - -/*==============================================================*/ -/* Table: audience */ -/*==============================================================*/ -create table audience #观众 -( - a_ticketnumber int not null, - f_id int not null, - a_name varchar(5) not null, - a_phone char(11) not null, - primary key (a_ticketnumber) -); - -/*==============================================================*/ -/* Table: booklist */ -/*==============================================================*/ -create table booklist #书单 -( - bo_id int not null, - a_ticketnumber int not null, - bo_list varchar(10) not null, - bo_recommend varchar(50) not null, - primary key (bo_id) -); - -/*==============================================================*/ -/* Table: film */ -/*==============================================================*/ -create table film #电影信息 -( - f_id int not null, - f_name varchar(10) not null, - f_date date not null, - f_time time not null, - primary key (f_id) -); - -/*==============================================================*/ -/* Table: filmreview */ -/*==============================================================*/ -create table filmreview #影评 -( - fi_id int not null, - f_id int not null, - fi_class int not null, - fi_headline varchar(10) not null, - fi_content varchar(100) not null, - primary key (fi_id) -); - -/*==============================================================*/ -/* Table: introq */ -/*==============================================================*/ -create table introq #简介 -( - i_id int not null, - f_id int not null, - i_director varchar(5) not null, - i_scriptwriter varchar(20) not null, - i_protagonist varchar(50) not null, - i_score decimal(3,1) not null, - primary key (i_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language #语言 -( - l_id int not null, - f_id int not null, - l_name varchar(10) not null, - primary key (l_id) -); - -/*==============================================================*/ -/* Table: phrase */ -/*==============================================================*/ -create table phrase#短评 -( - p_id int not null, - f_id int not null, - p_content varchar(100) not null, - primary key (p_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type #类型 -( - t_modelcodet int not null, - f_id int not null, - t_name varchar(5) not null, - primary key (t_modelcodet) -); - -alter table Directorinformation add constraint FK_indetail foreign key (i_id) - references introq (i_id) on delete restrict on update restrict; - -alter table address add constraint FK_e foreign key (f_id) - references film (f_id) on delete restrict on update restrict; - -alter table audience add constraint FK_watch foreign key (f_id) - references film (f_id) on delete restrict on update restrict; - -alter table booklist add constraint FK_g foreign key (a_ticketnumber) - references audience (a_ticketnumber) on delete restrict on update restrict; - -alter table filmreview add constraint FK_a foreign key (f_id) - references film (f_id) on delete restrict on update restrict; - -alter table introq add constraint FK_include foreign key (f_id) - references film (f_id) on delete restrict on update restrict; - -alter table language add constraint FK_h foreign key (f_id) - references film (f_id) on delete restrict on update restrict; - -alter table phrase add constraint FK_b foreign key (f_id) - references film (f_id) on delete restrict on update restrict; - -alter table type add constraint FK_f foreign key (f_id) - references film (f_id) on delete restrict on update restrict; - - -``` - diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230913 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230913 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index 13f1e40ffdb580313e7d777e0d23e9fe04efcecf..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230913 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,114 +0,0 @@ -# 作业 - - - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-13 17:26:56 */ -/*==============================================================*/ - -create database hospital charset utf8; -use hospital; - -drop table if exists cure; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists grab; - -drop table if exists patient; - -/*==============================================================*/ -/* Table: cure */ -/*==============================================================*/ - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor #医生 -( - d_id int(2) not null auto_increment, # 医生编号 - d_name varchar(5) not null, # 医生姓名 - d_type varchar(10) not null, # 医生类型 - d_sex varchar(2) not null, # 医生性别 - d_age varchar(2) not null, # 医生年龄 - primary key (d_id) -); -insert into doctor (d_id,d_name,d_type,d_sex,d_age) values -('1','陈佳炜','胃科','男','18'), -('2','林俊伟','妇产科','女','18'), -('3','代瑞','脑科','男','18'); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug #药品 -( - dr_id int(2) not null auto_increment, # 药品编号 - dr_name varchar(5) not null, # 药品名称 - primary key (dr_id) -); -insert into drug (dr_id,dr_name) values -('1','止泻药'), -('2','阿司匹林'), -('3','胃炎药'); - -/*==============================================================*/ -/* Table: grab */ -/*==============================================================*/ - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient #病人 -( - p_id int(2) not null auto_increment, #病人病号 - p_name varchar(5) not null, #病人姓名 - p_symptom varchar(10) not null, #病人症状 - p_sex varchar(2) not null, #病人性别 - p_age varchar(2) not null, #病人年龄 - primary key (p_id) -); -insert into patient (p_id,p_name,p_symptom,p_sex,p_age) values -('1','张三','头疼','男','18'), -('2','李四','肚子疼','男','18'), -('3','王五','胃炎','男','18'); -create table cure #开药单 -( - p_id int not null, #病人病号 - d_id int not null, #医生编号 - primary key (p_id, d_id) -); - -insert into cure (p_id,d_id)values -('1','2'), -('2','1'), -('3','1'); -create table grab #抓 -( - p_id int not null, #病人病号 - dr_id int not null, #药品编号 - primary key (p_id, dr_id) -); -insert into grab (p_id,dr_id) values -('1','2'), -('2','1'), -('3','3'); -alter table cure add constraint FK_cure foreign key (p_id) - references patient (p_id) on delete restrict on update restrict; - -alter table cure add constraint FK_cure2 foreign key (d_id) - references doctor (d_id) on delete restrict on update restrict; - -alter table grab add constraint FK_grab foreign key (p_id) - references patient (p_id) on delete restrict on update restrict; - -alter table grab add constraint FK_grab2 foreign key (dr_id) - references drug (dr_id) on delete restrict on update restrict; - - -``` - diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230914 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230914 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index 51124cb2f5ad7d0ffe05e23e2c826ca69c8ed98a..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230914 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,11 +0,0 @@ -# 笔记 - -软件:PowerDesigner 的使用方法 - -1、创建概念模型(类型er图) CDM - -2、将概念模型转换成逻辑模型 LDM - -3、将逻辑模型转换成物理模型 PDM - -4用物理模型生成DDL代码 \ No newline at end of file diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230915 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230915 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index 510f63407ae29287b8373969d7db731606435799..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230915 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,165 +0,0 @@ -# 笔记 - -多注意表与表之间的关系 - -# 作业 - - - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/17 18:11:14 */ -/*==============================================================*/ -create database qiche charset utf8; -use qiche; - -drop table if exists automobile; - -drop table if exists client; - -drop table if exists record; - -drop table if exists salesman; - -/*==============================================================*/ -/* Table: automobile */ -/*==============================================================*/ -create table automobile #汽车 -( - a_id int(3) not null auto_increment, #汽车编号 - a_name varchar(10) not null, #汽车名称 - a_sellingprice decimal(7,1) not null, #汽车售价 - a_brand varchar(10) not null, #汽车品牌 - primary key (a_id) -); -insert into automobile values -(01,'五菱神光mini',20000.0,'五菱宏光'), -(02,'玛拉莎蒂2023',900000.0,'玛莎拉蒂'), -(03,'宝牛SUV',250000.0,'宝马'), -(04,'五菱宏光2077',10000.0,'五菱宏光'); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client #顾客 -( - c_id int(2) not null auto_increment, #顾客编号 - c_name varchar(10) not null, #顾客姓名 - c_sex varchar(2) not null, #顾客性别 - primary key (c_id) -); -insert into client values -(2001,'德莱厄斯','男'), -(2002,'塞恩','男'), -(2003,'蒙多','男'); -/*==============================================================*/ -/* Table: record */ -/*==============================================================*/ - - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman #销售员 -( - s_id int(2) not null auto_increment, #工号 - s_name varchar(5) not null, #姓名 - s_sex varchar(2) not null, #性别 - primary key (s_id) -); -insert into salesman values -(1001,'梦泪','男'), -(1002,'坤哥','男'), -(1003,'厄斐琉斯','男'); - -create table record #销售记录 -( - r_id int(2) not null auto_increment, #销售编号 - s_id int not null, #工号 - c_id int not null, #顾客编号 - a_id int not null, #汽车编号 - primary key (r_id) -); -insert into record values -(3001,1001,2002,02), -(3002,1002,2001,01), -(3003,1001,2002,03), -(3004,1003,2003,04); - -alter table record add constraint FK_Relationship_2 foreign key (s_id) - references salesman (s_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_3 foreign key (c_id) - references client (c_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_4 foreign key (a_id) - references automobile (a_id) on delete restrict on update restrict; - -- 1.查询特定销售员的销售记录 -SELECT - s.s_id 工号, - s_name 销售员, - r_id 销售编号, - a_name 汽车型号, - a_sellingprice 售价, - a_brand 汽车品牌 -FROM - salesman s - JOIN record r - JOIN automobile a ON s.s_id = r.s_id - AND a.a_id = r.a_id -WHERE - s.s_id =( - SELECT - s_id - FROM - salesman - WHERE - s_name = '梦泪' - ); - -- 2.查找销售记录中销售价格最高的汽车 - select a.* from record r join automobile a on r.a_id=a.a_id where r.a_id = (select a_id from automobile where a_brand=(select max(a_brand) from automobile)); - -- 3.统计某个销售员的销售总额 -SELECT - s_name 销售员, - sum(a_sellingprice) 销售总额 -FROM - salesman s - JOIN record r - JOIN automobile a ON s.s_id = r.s_id - AND a.a_id = r.a_id - group by s.s_name having s.s_name='梦泪'; - -- 4.根据客户信息查询其购买过的汽车 - select c_name 顾客,c_sex 性别,a_name 汽车型号, a_sellingprice 售价,a_brand 型号 from client c join record r join automobile a on c.c_id=r.c_id and r.a_id = a.a_id where c.c_name='塞恩'; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 -SELECT - a_brand 品牌, - count( r.a_id) 销售数量, - sum( a.a_sellingprice ) 销售总额 -FROM - record r - JOIN automobile a ON r.a_id = a.a_id -GROUP BY - a_brand; - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - SELECT - a_name 汽车型号, - a_brand 品牌, - r.a_id 销售数量, - a.a_sellingprice 销售总额 -FROM - record r - JOIN automobile a ON r.a_id = a.a_id where a.a_name='五菱神光mini'; - -- 8.统计每个销售员的销售数量 -SELECT - s_name 销售员, - count(r.a_id) 销售总额 -FROM - salesman s - JOIN record r - JOIN automobile a ON s.s_id = r.s_id - AND a.a_id = r.a_id - group by s.s_name; -``` - diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230919 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230919 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index aa807ac66d1cf6967786cd5c86276e3f4ab731c0..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230919 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,338 +0,0 @@ -# 笔记 - -得多复习,多学习,学无止尽,学有所成 - -# 作业 - -```mysql -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 -select * from employees; -SELECT sum((ifnull(commission_pct,0)*salary+salary)*12) as 工资总和 FROM employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct -select * from employees; -select DISTINCT job_id from employees; - -# 3.查询工资大于12000的员工姓名和工资 -select * from employees; -select first_name,salary from employees where salary>12000; -# 4.查询员工号为176的员工的姓名和部门号 -select * from employees; -select first_name,department_id from employees WHERE employee_id=176; -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc employees; -select * from employees; -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -select * from employees; -select first_name,salary from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 -select * from employees; -select first_name,department_id from employees where department_id in (20,50); -# 3.选择公司中没有管理者的员工姓名及job_id -select * from employees; -select first_name,job_id from employees where manager_id is null; - - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -select * from employees; -select first_name,salary,g.grade_level from employees e join job_grades g on e.salary between g.lowest_sal and g.highest_sal where commission_pct is not null; - - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 -select * from employees; -select * from employees where last_name like '__尔%'; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -select * from employees; -select * from employees where last_name like '%尔%' and last_name like '%特%'; - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -select * from employees; -select * from employees where first_name like '%尔'; - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -select * from employees; -select first_name,j.job_title from employees e join jobs j on e.job_id=j.job_id where department_id between 80 and 100; -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -select * from employees; -select first_name,salary,manager_id from employees where manager_id in(100,101,110); - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select * from employees ; -SELECT (ifnull(commission_pct,0)*salary+salary)*12 aaa FROM employees ORDER BY aaa desc; -# - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -select * from employees ; -select first_name,salary from employees where salary not between 8000 and 17000 ORDER BY salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select * from employees ; - -select * from employees where email like '%e%' ORDER BY length(email) desc,department_id; - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -select first_name,d.department_id,department_name from employees e join departments d on e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id -select job_id,location_id from employees e join departments d on e.department_id=d.department_id where e.employee_id=90 or d.department_id=90; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -SELECT last_name,department_name,l.location_id,city FROM employees e join departments d join locations l on e.department_id=d.department_id and d.location_id=l.location_id; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -SELECT last_name , job_id , d.department_id , department_name FROM employees e join departments d join locations l on e.department_id=d.department_id and d.location_id=l.location_id where city='多伦多'; - - -#sql92语法(自然连接): - -SELECT last_name , job_id , d.department_id , department_name FROM employees e,departments d,locations l where city='多伦多' and e.department_id=d.department_id and d.location_id=l.location_id ; - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -select * from employees e join departments d join locations l on e.department_id=d.department_id and d.location_id=l.location_id where d.department_name='行政部'; - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select a.last_name,a.employee_id,b.last_name,b.employee_id from employees a inner join employees b on a.employee_id=b.manager_id; - - -# 7.查询哪些部门没有员工 -select d.department_name from employees e right join departments d on e.department_id=d.department_id where employee_id is null; -# 8. 查询哪个城市没有部门 - -select city from departments dep right join locations loc on dep.location_id=loc.location_id where department_id is null; - - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -select * from employees e join departments d on e.department_id=d.department_id where department_name in ('销售部','信息技术部'); - - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - -select job_id,max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees GROUP BY job_id; -#4.选择各个job_id的员工人数 -select job_id,count(job_id) from employees GROUP BY job_id; -# 5.查询员工最高工资和最低工资的差距 -select max(salary)-min(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 -select * from employees where manager_id is not null group by manager_id having min(salary)>=6000; - - - - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name 部门名称,d.location_id 地点编号,count(employee_id) 员工数量,avg(salary) 平均工资 from employees e left join departments d on e.department_id=d.department_id GROUP by d.department_id ORDER BY 平均工资 desc; - - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - -select job_title,department_name,min(salary) from employees emp -left join departments dep on emp.department_id=dep.department_id -left join jobs on emp.job_id=jobs.job_id group by job_title,department_name; - - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -; -select department_id from employees where last_name='兹洛特基'; -select last_name,salary from employees where department_id=(select department_id from employees where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -select avg(salary) from employees; -select employee_id,last_name,salary from employees where salary>(select avg(salary) from employees); - - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select max(salary) from employees left join jobs on employees.job_id=jobs.job_id where jobs.job_id='SA_MAN'; -select employees.last_name, jobs.job_id, employees.salary from employees left join jobs on employees.job_id=jobs.job_id where salary>(select max(salary) from employees left join jobs on employees.job_id=jobs.job_id where jobs.job_id='SA_MAN'); - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -SELECT employee_id,last_name -FROM employees -SELECT department_id FROM employees where last_name like '%u%' or first_name like '%u%'; - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -select d.department_id from employees e right join departments d on e.department_id=d.department_id where location_id=1700 GROUP BY d.department_id; -select employee_id from employees e left join departments d on e.department_id=d.department_id where e.department_id in (select d.department_id from employees e right join departments d on e.department_id=d.department_id where location_id=1700 GROUP BY d.department_id); - - - -#6.查询管理者是 金 的员工姓名和工资 - -select employee_id from employees where last_name='金'; -select last_name,salary from employees where manager_id in (select employee_id from employees where last_name='金'); - - - -#7.查询工资最低的员工信息: last_name, salary -select min(salary) from employees; -select last_name, salary from employees where salary=(select min(salary) from employees); - - - -#8.查询平均工资最低的部门信息 -select * from employees a left join departments b on a.department_id=b.department_id where salary=(select min(salary)from employees); -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - - - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -select b.*,avg(salary) from employees a left join departments b on a.department_id=b.department_id where salary=(select min(salary) from employees) group by department_id; - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 -select jobs.job_id,avg(salary) from employees left join jobs on employees.job_id=jobs.job_id GROUP BY job_id; -select * from employees a left join jobs b on a.job_id=b.job_id group by b.job_id having salary=(select max(salary) from employees) ; - - - -#11.查询平均工资高于公司平均工资的部门有哪些? - -select department_id,avg(salary) from employees group by department_id having avg(salary)>(select avg(salary) from employees) ; - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - -select * from employees a left join employees b on a.employee_id=b.manager_id; -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - - - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - - - -#方式: - -select department_id,min(最高工资) from (select max(salary) 最高工资,department_id from employees group by department_id) as a group by department_id; - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -select avg(salary) 平均工资 from employees group by department_id ; -select last_name,department_id,email,salary from employees group by department_id having avg(salary)=(select max(平均工资)from (select avg(salary) 平均工资 from employees group by department_id) as a); - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - -select department_id from employees where job_id !='ST_CLERK'; - - - -#16. 选择所有没有管理者的员工的last_name - -select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - - -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 -select avg(salary) 平均工资,department_id from employees group by department_id; -select * from employees a left join (select avg(salary) 平均工资,department_id from employees group by department_id) -b on a.department_id=b.department_id where a.salary>b.平均工资; - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -select department_id from employees group by department_id having count(department_id)>5; -select * from departments where department_id in(select department_id from employees group by department_id having count(department_id)>5); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -select country_id,count(department_id) from departments a left join locations b on a.location_id=b.location_id group by country_id -having count(department_id)>2; -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` - diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230920 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230920 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index 715913c9ad9ba0c85d309fcaf134da6059490ecd..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230920 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,161 +0,0 @@ -# 笔记 - -基于角色的权限访问控制RBAC - -RBAC核心是角色 - -3个基础组成部分:分别是:用户、角色和权限 - -sku=stuock keeping unit(库存量单位) - -# 作业 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:32:12 */ -/*==============================================================*/ -create database ultram charset utf8; -use ultram; - -drop table if exists clas; - -drop table if exists clasVSmon; - -drop table if exists monster; - -drop table if exists ult_clas; - -drop table if exists ultraman; - -/*==============================================================*/ -/* Table: clas */ -/*==============================================================*/ -create table clas -( - clas_id int(2) not null auto_increment, - clas_name varchar(10) not null, - primary key (clas_id) -); -insert into clas values -("1", "总指挥"), -("2", "队长"), -("3", "队员"); - -/*==============================================================*/ -/* Table: clasVSmon */ -/*==============================================================*/ -create table clasVSmon -( - monster_id int not null, - clas_id int not null, - primary key (monster_id, clas_id) -); -insert into clasVSmon values -("1", "1"), -("2", "1"), -("3", "1"), -("1" ,"2"), -("2", "2"), -("1" ,"3"); -/*==============================================================*/ -/* Table: monster */ -/*==============================================================*/ -create table monster -( - monster_id int(2) not null auto_increment, - monster_name varchar(10) not null, - monster_address varchar(20) not null, - primary key (monster_id) -); -insert into monster values -("1", "食油超兽 尤多林卡", "太平洋"), -("2", "宇宙阿斯托罗姆斯", "东京湾"), -("3", "吸血植物乔古里斯花 ", "菲律宾"); - -/*==============================================================*/ -/* Table: ult_clas */ -/*==============================================================*/ -create table ult_clas -( - clas_id int not null, - ultraman_id int not null, - primary key (clas_id, ultraman_id) -); -insert into ult_clas values -("1", "1"), -("2" ,"2"), -("3", "3"); - -/*==============================================================*/ -/* Table: ultraman */ -/*==============================================================*/ -create table ultraman -( - ultraman_id int(2) not null auto_increment, - ultraman_name varchar(10) not null, - ultraman_skill varchar(10) not null, - primary key (ultraman_id) -); -insert into ultraman values -("1", "初代", "斯派修姆光线"), -("2", "泰罗" ,"斯特里姆光线"), -("3", "梦比优斯", "梦比姆骑士光剑​"); -alter table clasVSmon add constraint FK_clasVSmon foreign key (monster_id) - references monster (monster_id) on delete restrict on update restrict; - -alter table clasVSmon add constraint FK_clasVSmon2 foreign key (clas_id) - references clas (clas_id) on delete restrict on update restrict; - -alter table ult_clas add constraint FK_ult_clas foreign key (clas_id) - references clas (clas_id) on delete restrict on update restrict; - -alter table ult_clas add constraint FK_ult_clas2 foreign key (ultraman_id) - references ultraman (ultraman_id) on delete restrict on update restrict; - - - - - - - - - - - - - - - - - - - - - - - -select * from ultraman; #奥特曼 -select * from clas; #职称 -select * from monster; #怪兽 - - -SELECT - u.ultraman_name 奥特名称, - u.ultraman_skill 奥特技能, - c.clas_name 奥特职称, - m.monster_name 可以殴打的怪兽, - m.monster_address 怪兽位置 -FROM - ultraman u - JOIN ult_clas uc - JOIN clas c - JOIN clasvsmon cm - JOIN monster m ON - u.ultraman_id=uc.ultraman_id AND - uc.clas_id=c.clas_id and - c.clas_id=cm.clas_id and - cm.monster_id=m.monster_id -where u.ultraman_id=1; -``` - diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230921 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230921 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index c7b4f07021db30c408797b7f2155d2f25259d22f..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230921 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,126 +0,0 @@ -# 笔记 - -sku适用于区别这些不同商品的属性,又称sku属性,因为它决定了sku的绝对数量 - -一个产品只属于一个品类。一个产品有多个高层 - -# 作业 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:37:36 */ -/*==============================================================*/ -CREATE DATABASE computer charset utf8; -use computer; - -drop table if exists goods; - -drop table if exists parameter; - -drop table if exists property; - -drop table if exists spe_attr; - -drop table if exists specification; - -/*==============================================================*/ -/* Table: goods */ -/*==============================================================*/ -create table goods ## 商品表 -( - goods_id int not null auto_increment, - goods_name varchar(50) not null, - goods_indetail text not null, - primary key (goods_id) -); -insert into goods values -(1,'华硕','玩家国度'); -/*==============================================================*/ -/* Table: parameter */ -/*==============================================================*/ -create table parameter ## 参数表 -( - pa_id int not null auto_increment, - pa_attr varchar(10) not null, - primary key (pa_id) -); -insert into parameter values -(1,'银白色'), -(2,'墨绿色'), -(3,'酷黑色'), -(4,'256G'), -(5,'512G'), -(6,'1024G'), -(7,'标准版'), -(8,'豪华版'), -(9,'至臻版'); -/*==============================================================*/ -/* Table: property */ -/*==============================================================*/ -create table property ## 属性表 -( - p_id int not null auto_increment, - p_name varchar(10) not null, - primary key (p_id) -); -insert into property values -(1,'颜色'), -(2,'内存'), -(3,'版本'); -/*==============================================================*/ -/* Table: spe_attr */ -/*==============================================================*/ -create table specification ## 规格表 -( - s_id int not null auto_increment, - goods_id int not null, - s_name varchar(50) not null, - s_price decimal(8,2) not null, - s_inventory int not null, - primary key (s_id) -); -insert into specification values -(1,1,'天选1 银白色 256G 标准版',5599.00,10), -(2,1,'天选2 酷黑色 256G 标准版',6599.00,24), -(3,1,'天选3 墨绿色 512G 豪华版',7999.00,6), -(4,1,'天选3 银白色 512G 豪华版',7999.00,1), -(5,1,'天选3 银白色 1024G 至臻版',8999.00,13), -(6,1,'天选4 银白色 1024G 至臻版',9999.00,5); - - -create table spe_attr ## 归属表 -( - sp_id int not null auto_increment, - s_id int not null, - p_id int not null, - pa_id int not null, - primary key (sp_id) -); -insert into spe_attr values -(1,1,1,1), -(2,2,1,2), -(3,3,2,5), -(4,4,2,5), -(5,5,3,9), -(6,6,3,9); -/*==============================================================*/ -/* Table: specification */ -/*==============================================================*/ - - -alter table spe_attr add constraint FK_Relationship_2 foreign key (s_id) - references specification (s_id) on delete restrict on update restrict; - -alter table spe_attr add constraint FK_Relationship_3 foreign key (p_id) - references property (p_id) on delete restrict on update restrict; - -alter table spe_attr add constraint FK_Relationship_4 foreign key (pa_id) - references parameter (pa_id) on delete restrict on update restrict; - -alter table specification add constraint FK_Relationship_1 foreign key (goods_id) - references goods (goods_id) on delete restrict on update restrict; - - -``` - diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230922 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230922 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index e04b7ca0c380bf30557b13f6bc3fbb9df2f0edc3..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230922 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,163 +0,0 @@ -# 笔记 - -商品管理系统是电商系统中核心系统。商品管理又可以分为商品品类管理模块、SPU与SKU管理、商品资质管理、商品属性管理、商品价格管理、商品库存的管理等等。首先先区分一个商品的概念,spu和sku: - - SPU:标准化产品单元(Standard Product Unit),是商品信息聚合的最小单位,是一组可复用标准化信息的集合,主要也是为了在交易端对一组同类型商品做页面的聚合展示,解决的是一品多型号多规格等等多属性的问题; - -SKU:最小的库存单位(StockKeeping Unit),sku是库存存贮的最小单位,商品的进货、销售、售价、库存等最终都是打在sku身上的,最终的交易都决定在一个sku个体上; - -# 作业 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-22 08:44:25 */ -/*==============================================================*/ -create database marui charset utf8; -use marui; - -drop table if exists category; - -drop table if exists host; - -drop table if exists paramete; - -drop table if exists specify; - -drop table if exists together; - -/*==============================================================*/ -/* Table: category */ -/*==============================================================*/ -create table `host` # 主机 -( - host_id int not null auto_increment, #主机编号 - host_name varchar(10) not null, #主机名称 - host_indetail text not null, #主机详细 - primary key (host_id) -); -insert into `host` values -(1,'联想','联想,连想都不敢想'), -(2,'华硕','华硕品质,坚若磐石 感动世界的科技'), -(3,'华为','遥遥领先!遥遥领先!遥遥领先!'); -/*==============================================================*/ -/* Table: host */ -/*==============================================================*/ -create table specify #规格 -( - sp_id int not null auto_increment, #规格编号 - host_id int not null, #主机编号 - sp_title varchar(50) not null, #规格标题 - sp_price DOUBLE(9,2) not null, #规格价格 - sp_stock int not null, #规格库存 - primary key (sp_id) -); -insert into specify values -(1,1,'拯救者Y9000P i9-13900k 4090猛禽 宏碁16×2 雷神1200W',39823.00,1), -(2,1,'小新十四2023 R5-5500 5600xt 海力士8×2 长城65W',4999.00,5), -(3,2,'玩家国度 i9-13900H 4090猛禽 宏碁16×2 酷冷900W',24993.00,0), -(4,3,'MateBoos i7-1360P 核显 宏碁16×2 长城65W',9900.00,100); -/*==============================================================*/ -/* Table: paramete */ -/*==============================================================*/ -create table category #品类 -( - cat_id int not null auto_increment, - cat_name varchar(10) not null, - primary key (cat_id) -); -insert into category values -(1,'CPU'), -(2,'显卡'), -(3,'内存'), -(4,'电源'); -/*==============================================================*/ -/* Table: specify */ -/*==============================================================*/ -create table paramete #参数 -( - pa_id int not null auto_increment, #参数编号 - pa_name varchar(10) not null, #参数名称 - primary key (pa_id) -); -insert into paramete values -(1,'i9-13900k'), -(2,'R5-5500'), -(3,'i9-13900H'), -(4,'i7-1360P'), -(5,'4090猛禽'), -(6,'5600xt'), -(7,'核显'), -(8,'宏碁16×2'), -(9,'海力士8×2'), -(11,'雷神1200W'), -(12,'长城65W'), -(13,'酷冷900W'); -/*==============================================================*/ -/* Table: together */ -/*==============================================================*/ -create table together #关联 -( - to_id int not null auto_increment, #关联编号 - sp_id int not null, #规格编号 - cat_id int not null, #品类编号 - pa_id int not null, #参数编号 - primary key (to_id) -); -insert into together values -(1,1,1,1), -(2,1,2,5), -(3,1,3,8), -(4,1,4,11), -(5,2,1,2), -(6,2,2,6), -(7,2,3,9), -(8,2,4,12), -(9,3,1,3), -(10,3,2,5), -(11,3,3,8), -(12,3,4,13), -(13,4,1,4), -(14,4,2,7), -(15,4,3,8), -(16,4,4,12); - - - -alter table specify add constraint FK_Relationship_1 foreign key (host_id) - references host (host_id) on delete restrict on update restrict; - -alter table together add constraint FK_Relationship_2 foreign key (sp_id) - references specify (sp_id) on delete restrict on update restrict; - -alter table together add constraint FK_Relationship_3 foreign key (pa_id) - references paramete (pa_id) on delete restrict on update restrict; - -alter table together add constraint FK_Relationship_4 foreign key (cat_id) - references category (cat_id) on delete restrict on update restrict; - - -SELECT -DISTINCT h.host_name 品牌, - h.host_indetail 详细, - s.sp_title 电脑名, - s.sp_price 一般售价 -from - `host` h, - specify s, - together t, - paramete p, - category c -where - h.host_id=s.host_id and - s.sp_id=t.sp_id and - t.pa_id=p.pa_id and - t.cat_id=c.cat_id ; - - - - - - -``` - diff --git "a/09 \346\233\271\346\255\243\346\263\242/20230926 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/09 \346\233\271\346\255\243\346\263\242/20230926 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index 7d17c008aadfe98e6049aae353b028731dd25dba..0000000000000000000000000000000000000000 --- "a/09 \346\233\271\346\255\243\346\263\242/20230926 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,119 +0,0 @@ -# 笔记 - -数据库视图是一种虚拟表,本身是不具备数据的。 关键字(view) - -格式:create view 视图名 as 查询语句 - -view 整合一张或多张表的数据 - - - -修改视图(更新) - -alter view 视图名 as select语句 - -create or replace view 视图名 as 语句 - -视图可看作为一张表 - -# 作业 - -```mysql - -#第14章_视图的课后练习 - -USE dbtest14; -use view_db; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -create view employee_vu(姓名,员工号,部门号) as -select LAST_NAME,EMPLOYEE_ID,DEPARTMENT_ID from employees; - -select * from employee_vu; -#2. 显示视图的结构 -desc employee_vu; - -#3. 查询视图中的全部内容 -select * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -CREATE - OR REPLACE VIEW employee_vu (姓名,员工号,部门号) AS SELECT - LAST_NAME, - EMPLOYEE_ID, - DEPARTMENT_ID -FROM - employees -WHERE - DEPARTMENT_ID BETWEEN 0 - AND 80; - -select * from employee_vu; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -CREATE - OR REPLACE VIEW emp_v1 (姓名,员工号,邮箱) AS SELECT - first_name, - EMPLOYEE_ID, - email -FROM - employees -WHERE - phone_number like '011%'; - -select * from employee_vu; - - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -CREATE - OR REPLACE VIEW emp_v1 (姓名,邮箱,电话号码,工资) AS SELECT - first_name, - email, - phone_number, - salary -FROM - employees -WHERE - phone_number like '011%' and email like '%e%'; - -select * from emp_v1; - - - -#3. 向 emp_v1 插入一条记录,是否可以? - -# 不可以 - - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -update emp_v1 set 工资 =工资+1000; -select * from emp_v1; -#5. 删除emp_v1中姓名为Olsen的员工 -delete from emp_v1 where 姓名='Olsen'; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -CREATE or replace view emp_v2 as -select max(max_salary) 最高工资,department_id 部门 from employees e,jobs j where e.job_id=j.job_id and max_salary>12000 GROUP BY department_id; - -select * from emp_v2; - - -#7. 向 emp_v2 中插入一条记录,是否可以? - -# 不可以 - - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v2; -drop view emp_v1; -``` - diff --git "a/0906\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" "b/0906\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" deleted file mode 100644 index 7de2bddd1fe9a5735d64193b3ba62d0146600516..0000000000000000000000000000000000000000 --- "a/0906\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" +++ /dev/null @@ -1,95 +0,0 @@ -create database school charset utf8; - -use school; - --- 院系 -create table department( - d_id int primary key, - d_name varchar(10), - d_address varchar(10) -); -insert into department values -(1,'软件工程学院','望云楼'); - --- 专业 -create table speciality( - s_id int primary key, - s_name varchar(10), - d_id int, - foreign key (d_id) references department(d_id) -); -insert into speciality values -(100,'软件技术',1); - --- 教室 -create table classroom( -r_id int PRIMARY KEY, -r_name varchar(10) -); -insert into classroom values -(1,'实训四'), -(2,'实训八'); - --- 班级 -create table class( - c_id int primary key, - c_name varchar(10), - s_id int, - foreign key (s_id) references speciality(s_id) -); -insert into class values -(1,'软件技术1班',100), -(2,'软件技术2班',100); - --- 课程 -CREATE TABLE course( - couseId int PRIMARY key, - courseName varchar(10), - c_id int, - r_id int, - foreign key (c_id) references class(c_id), - foreign key (r_id) references classroom(r_id) -); -insert into course VALUES -(1,'Java',1,1), -(2,'MySQL',2,2); - --- 教师 -create table teacher( - t_id int primary key, - t_name varchar(10), - couseId int, - foreign key (couseId) references course(couseId) -); -insert into teacher values -(1,'一一',1), -(2,'阿九',2); - --- 课程表 -create table `select` ( - selectId int primary key, - couseId int, - time varchar(20), - t_id int, - r_id int, - foreign key (couseId) references course(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references classroom(r_id) -); -insert into `select` values -(1,1,'周一8:00-11:40',2,1), -(2,2,'周一14:00-17:40',1,2); - --- 学生 -create table student ( - id int primary key, - name varchar(10), - c_id int, - selectId int, - foreign key (c_id) references class(c_id), - foreign key (selectId) references `select`(selectId) -); -insert into student values -(2201,'张三',1,1), -(2202,'李四',2,2), -(2203,'王五',1,1); \ No newline at end of file diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230905 \347\254\254\344\270\200\350\257\276\347\254\224\350\256\260.md" "b/10 \346\270\251\350\264\265\351\233\257/20230905 \347\254\254\344\270\200\350\257\276\347\254\224\350\256\260.md" deleted file mode 100644 index 5dd6be4df5b9298e6686640ee1edef421023821a..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230905 \347\254\254\344\270\200\350\257\276\347\254\224\350\256\260.md" +++ /dev/null @@ -1,29 +0,0 @@ -# 大二学习路线 - -1. MySQL进阶(存储引擎、索引、SQL优化、存储过程、锁) - -2. JavaScript (Ajax) - -3. MVC框架(Maven,Spring,SpringMVC,MyBatis) - -4. Node.js - -5. Vue.js - -6. SpringBoot (Redis,WebAPI) - - # 实训 - - 1.Linux 服务器 - - #### 2.中间件(项目中可能实现的技术) - - 小程序 ,uniapp移动端开发 - - ### 技术栈: - - ​ 一个项目需要用什么技术实现,可以称为技术栈。** - - ### 技能数: - - ​ 个人具备的技能,称为技能树。 diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230907\350\241\250\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.md" "b/10 \346\270\251\350\264\265\351\233\257/20230907\350\241\250\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.md" deleted file mode 100644 index 0ec6dd257ccddf26f67ec8be1734f7dff1f9ea91..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230907\350\241\250\344\271\213\351\227\264\347\232\204\345\205\263\347\263\273.md" +++ /dev/null @@ -1,144 +0,0 @@ -# 数据库高级 - -## 表之间的关系: - -### 1.一对一的关系: - - 一个学生(学号,编号,身份证寒外键),只有一个身份证(身份证号)将其中任一表中的主键,放到另一个表当外健 - -### 2.一对多的关系(多对一的关系): - -一个班级 (班级编号),有多个学生(学生编号)班级编号将一所在的表的主键,放到多的表当外键 - -### 3.多对多的关系: - - 一个学生可以选修多门课程,一门课程可以被多个学生选修必须第三张表,将前面两个表的主键放进来当外健 - - - -## 作业 - -以我们学院的组织框架,及学习的课程来做系统,院系,专业,班级,学生,教师,课程,课程表,教室 - -```java - -create database student charset utf8; -use student; - -create table college( - co_id int primary key, - co_name varchar(50) not null -); -insert into college values -(1,"软件工程"), -(2,"医疗护理"), -(3,"信息工程"), -(4,"智能制造"); - -create table major( - m_id int primary key, - m_name varchar(20) not null, - co_id int, - foreign key(co_id) references college(co_id) -); - -insert into major values -(1,"前端",1), -(2,"后端",1), -(3,"财务管理",2), -(4,"大数据技术",3), -(5,"电气自动化技术",4); - - -create table class( - c_id int primary key, - c_name varchar(20) not null, - m_id int, - foreign key(m_id) references major(m_id) -); - -insert intoclass values -(1,"软件技术2班",2), -(2,"软件技术7班",1), -(3,"人力财务管理1班",3), -(4,"大数据技术4班",4), -(5,"电气自动化技术3班",5); - - -create table student( - s_id int primary key, - s_name varchar(10) not null, - sex varchar(2) not null, - c_id int, - foreign key(c_id) references class(c_id) -); - -insert into student values -(1,"张三","男",1), -(2,"李四","男",2), -(3,"王","女",3), -(4,"锅","男",4), -(5,"刘","女",5); - - -create table course_inf( - c_id int primary key, - c_name varchar(10) not null -); - -insert into course_inf values -(1,"MySQL"), -(2,"java"), -(3,"财务管理"), -(4,"大数据"), -(5,"电气自动化"); - - -create table classroom( - cr_id int primary key, - address varchar(20) not null -); -# 插入数据 -insert into classroom values -(1,"望云楼实训室8"), -(2,"望云楼阶"), -(3,"岩声楼"), -(4,"辛耕楼"), -(5,"辛耕楼二楼"); - - -create table teacher( - t_id int primary key, - t_name varchar(5) not null, - sex varchar(2) not null, - co_id int, - foreign key(co_id) references college(co_id) -); - -insert into teacher values -(001,"丘老师","男",1), -(002,"丘老师","男",1), -(003,"刘老师","女",2), -(004,"王老师","男",3), -(005,"李老师","女",4); - - -create table course( - c_id int, - cr_id int, - t_id int, - s_id int, - foreign key(c_id) references course_inf(c_id), - foreign key(cr_id) references classroom(cr_id), - foreign key(t_id) references teacher(t_id), - foreign key(s_id) references student(s_id) -); -insert into course values -(1,1,1,1), -(2,2,2,2), -(3,3,3,3), -(4,4,4,4), -(5,5,5,5); - - -``` diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230908 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" "b/10 \346\270\251\350\264\265\351\233\257/20230908 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" deleted file mode 100644 index 9a257f0929054184a78bcd41585076dfa97d5c39..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230908 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" +++ /dev/null @@ -1,19 +0,0 @@ -# 数据库的范式 - -#### 1.第一范式: - -​ 要求字段的内容,不可再分割,为的是保证数据的原子性 - -​ 例:姓名,省份、城市、区具、地址址 - -#### 2.第二范式: - -​ 要求在满足第一范式的基础上,要求非主键字投要完全依赖主健(非主键雪完全依赖整个联合主键,而不只很赖部分) - -​ 例:小明的存在,必须要依靠父亲和母亲的存在 - -#### 3.第三范式: - -​ 满足第二范式的前提下,要求非主键属性要有接依赖于主键 - -​ 例:儿子依赖爸爸,爸爸依赖爷爷。其中儿子与爷爷属于间接依赖,则不属于第三范式,学生表中建议不要写专业,院级系,将他们分开写,否则将很难修改,还占内存 diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230910 \345\233\276\344\271\246\351\246\206\351\207\214\347\263\273\347\273\237.md" "b/10 \346\270\251\350\264\265\351\233\257/20230910 \345\233\276\344\271\246\351\246\206\351\207\214\347\263\273\347\273\237.md" deleted file mode 100644 index a42501270bbfc35c514e4506b950d1fcd42c6338..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230910 \345\233\276\344\271\246\351\246\206\351\207\214\347\263\273\347\273\237.md" +++ /dev/null @@ -1,96 +0,0 @@ -# 笔记 - -## powerdesigner - -1:创建概念模型图(CDM)以用户角度 - -2:转换逻辑模型图(LDM)以计算机角度 - -3:转换物理模型图(PDM)以数据角度 - -4:生成DDL - -数据库范式在实际中不会完全按照范式,根据需求实际操作 - -## 作业:图书管理系统 - -```java -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 23:10:39 */ -/*==============================================================*/ - - -drop table if exists book_borrowing; - -drop table if exists book_retrieval; - -drop table if exists return_books; - -drop table if exists user; - -/*==============================================================*/ -/* Table: book_borrowing */ -/*==============================================================*/ -create table book_borrowing -( - bb_id int not null auto_increment, - b_id int not null, - borrow_date date not null, - expiry_date date not null, - primary key (bb_id) -); - -/*==============================================================*/ -/* Table: book_retrieval */ -/*==============================================================*/ -create table book_retrieval -( - b_id int not null auto_increment, - u_id int not null, - b_name char(20) not null, - author char(20) not null, - quantity int not null, - floor char(5) not null, - price numeric(110,2), - shelf_number int, - primary key (b_id) -); - -/*==============================================================*/ -/* Table: return_books */ -/*==============================================================*/ -create table return_books -( - rb_id int not null auto_increment, - u_id int not null, - b_id int not null, - return_book date, - primary key (rb_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - u_id int not null auto_increment, - u_name char(10) not null, - u_password char(10) not null, - primary key (u_id) -); - -alter table book_borrowing add constraint FK_borrow foreign key (b_id) - references book_retrieval (b_id) on delete restrict on update restrict; - -alter table book_retrieval add constraint FK_check foreign key (u_id) - references user (u_id) on delete restrict on update restrict; - -alter table return_books add constraint FK_return foreign key (u_id) - references user (u_id) on delete restrict on update restrict; - -alter table return_books add constraint FK_return_books foreign key (b_id) - references book_retrieval (b_id) on delete restrict on update restrict; - - -``` diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230912 \347\224\265\345\275\261\347\275\221\347\253\231\350\256\276\350\256\241.md" "b/10 \346\270\251\350\264\265\351\233\257/20230912 \347\224\265\345\275\261\347\275\221\347\253\231\350\256\276\350\256\241.md" deleted file mode 100644 index 747f19983383cb75ae9ad92336a286a265b85ec9..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230912 \347\224\265\345\275\261\347\275\221\347\253\231\350\256\276\350\256\241.md" +++ /dev/null @@ -1,201 +0,0 @@ -# 作业 - -```java -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 11:33:30 */ -/*==============================================================*/ - - -drop table if exists actor; - -drop table if exists director; - -drop table if exists film; - -drop table if exists "film language"; - -drop table if exists "film review"; - -drop table if exists "film types"; - -drop table if exists film_region; - -drop table if exists language; - -drop table if exists protagonist; - -drop table if exists region; - -drop table if exists scriptwriter; - -drop table if exists type; - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - actor_id int not null auto_increment, - actor_name varchar(4) not null, - primary key (actor_id) -); - -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - film_id int not null, - actor_id int not null, - primary key (film_id, actor_id) -); - -/*==============================================================*/ -/* Table: film */ -/*==============================================================*/ -create table film -( - film_id int not null auto_increment, - film_name varchar(10) not null, - film_date date not null, - film_time time not null, - primary key (film_id) -); - -/*==============================================================*/ -/* Table: "film language" */ -/*==============================================================*/ -create table "film language" -( - film_id int not null, - lgg_id char(10) not null, - primary key (film_id, lgg_id) -); - -/*==============================================================*/ -/* Table: "film review" */ -/*==============================================================*/ -create table "film review" -( - fr_id char(10) not null, - film_id int not null, - fr_grade char(1) not null, - fr_title varchar(10), - fr_text text, - primary key (fr_id) -); - -/*==============================================================*/ -/* Table: "film types" */ -/*==============================================================*/ -create table "film types" -( - film_id int not null, - type_id int not null, - primary key (film_id, type_id) -); - -/*==============================================================*/ -/* Table: film_region */ -/*==============================================================*/ -create table film_region -( - film_id int not null, - region_id int not null, - primary key (film_id, region_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - lgg_id char(10) not null, - lgg_name varchar(10) not null, - primary key (lgg_id) -); - -/*==============================================================*/ -/* Table: protagonist */ -/*==============================================================*/ -create table protagonist -( - film_id int not null, - actor_id int not null, - primary key (film_id, actor_id) -); - -/*==============================================================*/ -/* Table: region */ -/*==============================================================*/ -create table region -( - region_id int not null auto_increment, - region_name varchar(10) not null, - primary key (region_id) -); - -/*==============================================================*/ -/* Table: scriptwriter */ -/*==============================================================*/ -create table scriptwriter -( - film_id int not null, - actor_id int not null, - primary key (film_id, actor_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name varchar(2) not null, - primary key (type_id) -); - -alter table director add constraint FK_director foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table director add constraint FK_director2 foreign key (actor_id) - references actor (actor_id) on delete restrict on update restrict; - -alter table "film language" add constraint "FK_film language" foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table "film language" add constraint "FK_film language2" foreign key (lgg_id) - references language (lgg_id) on delete restrict on update restrict; - -alter table "film review" add constraint "FK_movie evaluation" foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table "film types" add constraint "FK_film types" foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table "film types" add constraint "FK_film types2" foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table film_region add constraint FK_film_region foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table film_region add constraint FK_film_region2 foreign key (region_id) - references region (region_id) on delete restrict on update restrict; - -alter table protagonist add constraint FK_protagonist foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table protagonist add constraint FK_protagonist2 foreign key (actor_id) - references actor (actor_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter2 foreign key (actor_id) - references actor (actor_id) on delete restrict on update restrict; - - -``` - -![微信图片_20230913121457](D:\develop\数据库高级\database-advanced\10%20温贵雯\图片\微信图片_20230913121457.png) diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230913 \345\214\273\351\231\242\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" "b/10 \346\270\251\350\264\265\351\233\257/20230913 \345\214\273\351\231\242\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" deleted file mode 100644 index 363543d75892a0602c63fb85cc2d6c81205e77df..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230913 \345\214\273\351\231\242\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" +++ /dev/null @@ -1,87 +0,0 @@ -```java -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 12:37:15 */ -/*==============================================================*/ - - -drop table if exists doctor; - -drop table if exists "get the medicine"; - -drop table if exists medicine; - -drop table if exists patient; - -drop table if exists registration; - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - doctor_name varchar(10) not null, - doctor_age int not null, - doctor_gender char(1) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: "get the medicine" */ -/*==============================================================*/ -create table "get the medicine" -( - medicine_id int not null, - patient_id int not null, - primary key (medicine_id, patient_id) -); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - medicine_id int not null auto_increment, - medicine_name varchar(20) not null, - primary key (medicine_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(10) not null, - patient_gender char(1) not null, - patient_age int not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: registration */ -/*==============================================================*/ -create table registration -( - doctor_id int not null, - patient_id int not null, - primary key (doctor_id, patient_id) -); - -alter table "get the medicine" add constraint "FK_get the medicine" foreign key (medicine_id) - references medicine (medicine_id) on delete restrict on update restrict; - -alter table "get the medicine" add constraint "FK_get the medicine2" foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table registration add constraint FK_registration foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table registration add constraint FK_registration2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - - -``` - -![32e38aa3f50dcd0bac0c70ecfeb41f5](D:\develop\数据库高级\database-advanced\10%20温贵雯\图片\32e38aa3f50dcd0bac0c70ecfeb41f5.png) diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230915 \346\261\275\350\275\246\351\224\200\345\224\256\347\256\241\347\220\206.md" "b/10 \346\270\251\350\264\265\351\233\257/20230915 \346\261\275\350\275\246\351\224\200\345\224\256\347\256\241\347\220\206.md" deleted file mode 100644 index c79a2e98f053184989f39d0dae7161c654549812..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230915 \346\261\275\350\275\246\351\224\200\345\224\256\347\256\241\347\220\206.md" +++ /dev/null @@ -1,136 +0,0 @@ -```java -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/17 23:09:29 */ -/*==============================================================*/ - - -drop table if exists brand; - -drop table if exists customer; - -drop table if exists model_number; - -drop table if exists order_for_goods; - -drop table if exists sell; - -/*==============================================================*/ -/* Table: brand */ -/*==============================================================*/ -create table brand -( - brand_id int not null auto_increment, - brand_name varchar(20) not null, - primary key (brand_id) -); -insert into brand values - (1,"法拉利"), - (2,"宾利"), - (3,"保时捷"), - (4,"兰博基尼"), - (5,"五菱宏光"); -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -/*==============================================================*/ -/* Table: model_number */ -/*==============================================================*/ -create table model_number -( - model_id int not null auto_increment, - brand_id int not null, - model_name varchar(20) not null, - model_color varchar(5) not null, - primary key (model_id) -); -insert into model_number values - (1,1,"SF90","黑色"), - (2,1,"488pista","黄色"), - (3,2,"欧陆GT","白色"), - (4,2,"添越","蓝色"), - (5,3,"911卡雷拉s","黑色"), - (6,3,"帕拉梅拉","白色"), - (7,3,"帕拉梅拉","黑色"), - (8,4,"Aventador SVJ","绿色"), - (9,4,"urus","黄色"), - (10,5,"Mini ev","粉色"), - (11,5,"六座面包","原色"); -create table customer -( - customer_id int not null auto_increment, - customer_name varchar(20) not null, - customer_age int not null, - customer_gender char(1) not null, - primary key (customer_id) -); -insert into customer values - (1,"涛",20,"男"), - (2,"黄",50,"女"), - (3,"温",18,"男"), - (4,"石",25,"男"), - (5,"朱",30,"女"); - -/*==============================================================*/ -/* Table: sell */ -/*==============================================================*/ -create table sell -( - sell_id int not null auto_increment, - sell_name varchar(20) not null, - sell_age int not null, - sell_gender char(1) not null, - primary key (sell_id) -); -insert into sell values - (1,"小刘",28,"女"), - (1,"小陈",19,"女"), - (1,"小石",45,"男"), - (1,"小郭",22,"男"); -/*==============================================================*/ -/* Table: order_for_goods */ -/*==============================================================*/ -create table order_for_goods -( - sell_id int not null, - model_id int not null, - customer_id int not null, - odg_id int not null auto_increment, - odg_money int not null, - primary key (sell_id, model_id, customer_id, odg_id) -); -insert into order_for_goods values - (2,1,2,1,9000000), - (1,2,2,2,4500000), - (1,6,1,3,1200000), - (1,4,1,4,3500000), - (1,10,1,5,55000), - (1,7,1,6,1200000), - (1,5,1,7,3800000), - (1,9,1,8,6000000), - (1,8,1,9,8000000), - (1,11,1,10,12000), - (1,3,1,11,4000000); -alter table model_number add constraint FK_screening foreign key (brand_id) - references brand (brand_id) on delete restrict on update restrict; - -alter table order_for_goods add constraint FK_buy_car foreign key (customer_id) - references customer (customer_id) on delete restrict on update restrict; - -alter table order_for_goods add constraint FK_order_for_goods foreign key (sell_id) - references sell (sell_id) on delete restrict on update restrict; - -alter table order_for_goods add constraint FK_order_for_goods2 foreign key (model_id) - references model_number (model_id) on delete restrict on update restrict; - - delete restrict on update restrict; - -id) - references model_number (model_id) on delete restrict on update restrict; - - -``` - -```java - -``` diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230919 \346\237\245\350\257\242\345\244\215\344\271\240\347\273\203\344\271\240.md" "b/10 \346\270\251\350\264\265\351\233\257/20230919 \346\237\245\350\257\242\345\244\215\344\271\240\347\273\203\344\271\240.md" deleted file mode 100644 index d92084dea32e514efaf85bf975d4dabc9e8b4366..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230919 \346\237\245\350\257\242\345\244\215\344\271\240\347\273\203\344\271\240.md" +++ /dev/null @@ -1,579 +0,0 @@ -```mysql -#第03章_基本的select语句的课后练习 -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -#理解1:计算12月的基本工资 -select - sum( salary * 12 ) 工资总和 -from - employees;#select sum(salary*12) as 工资总和 from employees; -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 -select - ifnull( commission_pct, 0 )* salary * 12 奖金, - salary * 12 基本工资 -from - employees;# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct -select distinct - job_id -from - employees;# 3.查询工资大于12000的员工姓名和工资 -select - last_name 姓名, - salary 工资 -from - employees -where - salary > 12000;# 4.查询员工号为176的员工的姓名和部门号 -select - first_name 姓名, - department_id 部门号 -from - employees -where - employee_id = 176;#; -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -select - * -from - departments;# 第04章_运算符课后练习 -# 1.选择工资不在5000到12000的员工的姓名和工资 -select - last_name 姓名, - salary 工资 -from - employees -where - salary < 5000 or salary > 12000;# 2.选择在20或50号部门工作的员工姓名和部门号 -select - last_name, - department_id -from - employees -where - department_id in ( 20, 50 ); -select - last_name, - department_id -from - employees -where - department_id = 20 - or department_id = 50;# 3.选择公司中没有管理者的员工姓名及job_id -select - last_name, - job_id -from - employees -where - manager_id is null;# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -select - * -from - job_grades; -select - first_name, - salary -from - employees -where - commission_pct is not null;# 5.选择员工姓名的第三个字是 尔 的员工姓名 -select - last_name -from - employees -where - last_name like '__尔%';# 6.选择姓名中有 特 字和 尔 字的员工姓名 -select - * -from - employees -where - last_name like '%特%' - or last_name like '%尔%';# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -select - * -from - employees -where - first_name like '%尔';# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -select - first_name, - job_id -from - employees -where - department_id between 80 - and 100;# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -select - last_name, - salary, - manager_id -from - employees -where - manager_id in ( 100, 101, 110 );#第05章_排序与分页的课后练习 -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select - first_name, - department_id, - salary * 12 nianxin -from - employees -order by - nianxin desc;# -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -select - first_name, - salary -from - employees -where - salary < 8000 or salary > 17000 -order by - salary desc - limit 20, - 20;#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select - * -from - employees -where - email like '%e%' -order by - length( email ) desc, - department_id asc;# 第06章_多表查询的课后练习 -# 1.显示所有员工的姓名,部门号和部门名称。 -select - last_name, - e.department_id, - d.department_name -from - employees e - left join departments d on e.department_id = d.department_id;# 2.查询90号部门员工的job_id和90号部门的location_id -select - * -from - locations; -select - * -from - employees; -select - * -from - departments; -select - job_id, - location_id -from - employees e - join locations l on e.department_id = department_id -where - department_id = 90;# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city -select - last_name, - department_name, - d.location_id, - city -from - employees e, - departments d, - locations l -where - e.department_id = d.department_id - and d.location_id = l.location_id - and commission_pct is not null; -select - last_name, - d.department_name, - l.location_id, - city -from - employees e - left join departments d on e.department_id = d.department_id - left join locations l on d.location_id = l.location_id -where - commission_pct is not null;# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -select - last_name, - job_id, - e.department_id, - city -from - employees e, - departments d, - locations l -where - e.department_id = d.department_id - and city = '多伦多';#sql92语法(自然连接): -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 -select - department_name, - street_address, - last_name, - salary -from - employees e, - departments d, - locations l -where - e.department_id = d.department_id - and d.location_id = l.location_id;# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 -select - e.first_name, - e.department_id, - e.last_name, - e.employee_id -from - employees e - inner join employees s on e.employee_id = s.employee_id;# 7.查询哪些部门没有员工 -select - department_name -from - departments d - left join employees e on e.department_id = e.department_id -where - d.manager_id is null;# 8. 查询哪个城市没有部门 -select - city -from - locations l - left join departments d on l.location_id = d.location_id -where - d.location_id is null;# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -select - * -from - employees e - left join departments d on e.department_id = d.department_id -where - d.department_name = '销售部' - or d.department_name = '信息技术部';# 第08章_聚合函数的课后练习 -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select - max( salary ), - min( salary ), - avg( salary ), - sum( salary ) -from - employees;#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -select - job_id, - max( salary ), - min( salary ), - avg( salary ), - sum( salary ) -from - employees -group by - job_id;#4.选择各个job_id的员工人数 -select - job_id, - count(*) -from - employees -group by - job_id;# 5.查询员工最高工资和最低工资的差距 -select - ( - max( salary )- min( salary )) 最高工资和最低工资的差距 -from - employees;# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 -select - min( salary ) -from - employees -group by - manager_id -having - min( salary ) > 6000 - and manager_id is not null; -select - manager_id, - min( salary ) -from - employees -where - manager_id is not null -group by - manager_id -having - min( salary ) > 6000;# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 -select - department_name, - location_id, - count( employee_id ), - avg( salary ) -from - employees e - right join departments d on e.department_id = d.department_id -group by - department_name, - location_id -order by - avg( salary ) desc;# 8.查询每个工种、每个部门的部门名、工种名和最低工资 -# 第09章_子查询的课后练习 -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -select - last_name, - salary -from - employees -where - department_id = ( select department_id from employees where last_name = '兹洛特基' ) #2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -select - employee_id, - last_name, - salary -from - employees -where - salary > ( select avg( salary ) from employees ) #3.选择工资大于所有job_id = 'sa_man'的员工的工资的员工的last_name, job_id, salary -select - last_name, - salary -from - employees -where - salary > ( select max( salary ) from employees where job_id = 'sa_man' ) #4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 -select - employee_id, - last_name -from - employees -where - department_id = any ( select distinct department_id from employees where last_name like '%u%' ) #5.查询部门的location_id为1700的部门的工作的员工的员工号 -select - employee_id -from - employees -where - department_id in ( select department_id from departments where location_id = 1700 ) #6.查询管理者是 金 的员工姓名和工资 -select - last_name, - salary -from - employees -where - manager_id in ( select employee_id from employees where last_name = '金' ) #7.查询工资最低的员工信息: last_name, salary -select - last_name, - salary -from - employees -where - salary = ( select min( salary ) from employees );#8.查询平均工资最低的部门信息 -#方式1: -# 部门最低工资=全司最低 -select - * -from - departments -where - department_id = ( - select - department_id - from - employees - group by - department_id - having - avg( salary ) = ( select min( dept_avgsal ) from ( select avg( salary ) dept_avgsal from employees group by department_id ) avg_sal ) - );#方式2: -# 部门平均<= 公司所有平均 -select - d.*,( - select - avg( salary ) - from - employees - where - department_id = d.department_id - ) -from - departments d -where - department_id = ( - select - department_id - from - employees - group by - department_id - having - avg( salary ) = ( select min( dept_avgsal ) from ( select avg( salary ) dept_avgsal from employees group by department_id ) avg_sal ) - );#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -select - d.*,( - select - avg( salary ) - from - employees - where - department_id = d.department_id - ) -from - departments d -where - department_id = ( - select - department_id - from - employees - group by - department_id - having - avg( salary ) = ( select min( dept_avgsal ) from ( select avg( salary ) dept_avgsal from employees group by department_id ) avg_sal ) - );#10.查询平均工资最高的 job 信息 -#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 -select - * -from - jobs -where - job_id = ( - select - job_id - from - employees - group by - job_id - having - avg( salary ) = ( select max( avg_sal ) from ( select avg( salary ) avg_sal from employees group by job_id ) job_avgsal ) - );#11.查询平均工资高于公司平均工资的部门有哪些? -select - department_id -from - employees -where - department_id is not null -group by - department_id -having - avg( salary ) > ( select avg( salary ) from employees );#12.查询出公司中所有 manager 的详细信息 -#方式1:自连接 自己连自己 -#方式2:子查询 -#员工编号=(管理员编号有哪些) -select - employee_id, - last_name, - salary -from - employees -where - employee_id in ( select distinct manager_id from employees );#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? -#方式: -select - min( salary ) -from - employees -where - department_id = ( - select - department_id - from - employees - group by - department_id - having - max( salary ) = ( select min( dept_maxsal ) from ( select max( salary ) dept_maxsal from employees group by department_id ) max_sal ) - );#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -select - employee_id, - last_name, - department_id, - email, - salary -from - employees -where - employee_id in ( - select distinct - manager_id - from - employees - where - department_id = ( - select - department_id - from - employees - group by - department_id - having - avg( salary ) = ( select max( avg_sal ) from ( select avg( salary ) avg_sal from employees group by department_id ) dept_sal ) - ) - );#方式二 -select - employee_id, - last_name, - department_id, - email, - salary -from - employees -where - employee_id in ( - select distinct - manager_id - from - employees - where - department_id = ( select department_id from employees e group by department_id having avg( salary )>= all ( select avg( salary ) from employees group by department_id ) ) - );#15. 查询部门的部门号,其中不包括job_id是"st_clerk"的部门号 -#方式1: -#16. 选择所有没有管理者的员工的last_name -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'de haan' -#方式1: -#方式2: -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) -#方式1:使用相关子查询 -#方式2:在from中声明子查询 -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -select - department_name -from - employees e, - departments d -where - d.department_id = e.department_id -group by - department_name -having - count( 1 )> 5;#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) -select - country_id, - count( 1 ) -from - ( - select distinct - country_id, - d.department_id - from - departments d, - employees e, - locations l - where - d.manager_id = e.manager_id - and l.location_id = d.location_id - ) a -group by - country_id; -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` - diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230920 RBAC\347\254\224\350\256\260.md" "b/10 \346\270\251\350\264\265\351\233\257/20230920 RBAC\347\254\224\350\256\260.md" deleted file mode 100644 index 6de50df7e1187a73452d05602a2e5f7b96bd639e..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230920 RBAC\347\254\224\350\256\260.md" +++ /dev/null @@ -1,18 +0,0 @@ -# RABC(Role-Based Access control) - -### 基于角色的权限访问控制(目前权限控制的主流方案) - -### 数据库能存: - -1.业务数据表 2.功能资源表 - -### 权限使用场景: - -1.菜单权限:不同的用户登录系统后,展现的菜单不一样 - -2.按钮权限:查看同一个对象时展现的按钮不一样(不同用户) - -3.数据权限:查看同一个对象时可见的数据不一样(不同用户) - -4.操作权限:能看到但操作不了 - diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230921 sku.md" "b/10 \346\270\251\350\264\265\351\233\257/20230921 sku.md" deleted file mode 100644 index 6185d5be372e973558a09aa15a50dfbfc7f74c92..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230921 sku.md" +++ /dev/null @@ -1,105 +0,0 @@ -建表 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:41:07 */ -/*==============================================================*/ -create database zy charset utf8; -use zy; - -drop table if exists attributes; - -drop table if exists attributes_value; - -drop table if exists relation; - -drop table if exists sku; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_id int not null auto_increment, - attributes_name varchar(50) not null, - primary key (attributes_id) -); - -/*==============================================================*/ -/* Table: attributes_value */ -/*==============================================================*/ -create table attributes_value -( - value_id int not null auto_increment, - value_content varchar(50) not null, - primary key (value_id) -); - -/*==============================================================*/ -/* Table: relation */ -/*==============================================================*/ -create table relation -( - relation_id int not null auto_increment, - sku_id int, - attributes_id int, - value_id int, - primary key (relation_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price decimal(9,2) not null, - sku_kc int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_content varchar(50) not null, - primary key (spu_id) -); - -alter table relation add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table relation add constraint FK_Relationship_3 foreign key (attributes_id) - references attributes (attributes_id) on delete restrict on update restrict; - -alter table relation add constraint FK_Relationship_4 foreign key (value_id) - references attributes_value (value_id) on delete restrict on update restrict; - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - - -``` - - - -查询 - -```mysql -select * from spu,sku,relation re,attributes_value av,attributes ab where spu.spu_id=sku.spu_id and sku.sku_id=re.sku_id and re.value_id=av.value_id and re.attributes_id=ab.attributes_id; - - -select a.sku_id,a.sku_name,a.sku_price,a.value_content,b.value_content from -(select sku.sku_id,sku_name,sku_price,value_content from spu,sku,relation re,attributes_value av,attributes ab where spu.spu_id=sku.spu_id and sku.sku_id=re.sku_id and re.value_id=av.value_id and re.attributes_id=ab.attributes_id and value_content='白色') as a, - -(select sku.sku_id,sku_name,sku_price,value_content from spu,sku,relation re,attributes_value av,attributes ab where spu.spu_id=sku.spu_id and sku.sku_id=re.sku_id and re.value_id=av.value_id and re.attributes_id=ab.attributes_id and value_content='512g') as b where a.sku_id=b.sku_id; -``` - diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230921 \347\254\224\350\256\260.md" "b/10 \346\270\251\350\264\265\351\233\257/20230921 \347\254\224\350\256\260.md" deleted file mode 100644 index e61c154aa5f5bbe03faf40193834f8afd90c98f4..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230921 \347\254\224\350\256\260.md" +++ /dev/null @@ -1,201 +0,0 @@ -## RBAC(基于角色的权限访问控制)——主流设计模型(套路) - - - -#### 用于权限之间产生角色 - -1.数据库能存什么? - -业务数据表:用户商品 - -功能资源表:菜单信息表,页面代码表 - -2.权限的使用情景 - -网页不一样: - -1.菜单权限 - -2.按钮权限 - -3.数据权限 - -4.操作权限 - -RBAC角色是核心,设计权限表 - -sku预习 - -sku(属性) 可由多个属性组成 - -spu 一组属性的组合 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : 1 - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : zy - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 20/09/2023 17:41:43 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for power --- ---------------------------- -DROP TABLE IF EXISTS `power`; -CREATE TABLE `power` ( - `power_id` int NOT NULL AUTO_INCREMENT, - `power_name` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`power_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of power --- ---------------------------- -INSERT INTO `power` VALUES (1, '医生信息'); -INSERT INTO `power` VALUES (2, '护士信息'); -INSERT INTO `power` VALUES (3, '病人信息'); -INSERT INTO `power` VALUES (4, '新增病人'); -INSERT INTO `power` VALUES (5, '保洁信息'); -INSERT INTO `power` VALUES (6, '新增医生'); -INSERT INTO `power` VALUES (7, '新增护士'); -INSERT INTO `power` VALUES (8, '新增保洁'); -INSERT INTO `power` VALUES (9, '医生工资'); -INSERT INTO `power` VALUES (10, '护士工资'); -INSERT INTO `power` VALUES (11, '保洁工资'); - --- ---------------------------- --- Table structure for role --- ---------------------------- -DROP TABLE IF EXISTS `role`; -CREATE TABLE `role` ( - `role_id` int NOT NULL AUTO_INCREMENT, - `role_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`role_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role --- ---------------------------- -INSERT INTO `role` VALUES (1, '院长'); -INSERT INTO `role` VALUES (2, '医生'); -INSERT INTO `role` VALUES (3, '护士'); -INSERT INTO `role` VALUES (4, '病人'); -INSERT INTO `role` VALUES (5, '保洁'); - --- ---------------------------- --- Table structure for role_power --- ---------------------------- -DROP TABLE IF EXISTS `role_power`; -CREATE TABLE `role_power` ( - `power_id` int NOT NULL, - `role_id` int NOT NULL, - PRIMARY KEY (`power_id`, `role_id`) USING BTREE, - INDEX `FK_role_power2`(`role_id` ASC) USING BTREE, - CONSTRAINT `FK_role_power` FOREIGN KEY (`power_id`) REFERENCES `power` (`power_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_role_power2` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role_power --- ---------------------------- -INSERT INTO `role_power` VALUES (1, 1); -INSERT INTO `role_power` VALUES (2, 1); -INSERT INTO `role_power` VALUES (3, 1); -INSERT INTO `role_power` VALUES (4, 1); -INSERT INTO `role_power` VALUES (5, 1); -INSERT INTO `role_power` VALUES (6, 1); -INSERT INTO `role_power` VALUES (7, 1); -INSERT INTO `role_power` VALUES (8, 1); -INSERT INTO `role_power` VALUES (9, 1); -INSERT INTO `role_power` VALUES (10, 1); -INSERT INTO `role_power` VALUES (11, 1); -INSERT INTO `role_power` VALUES (1, 2); -INSERT INTO `role_power` VALUES (2, 2); -INSERT INTO `role_power` VALUES (3, 2); -INSERT INTO `role_power` VALUES (4, 2); -INSERT INTO `role_power` VALUES (2, 3); -INSERT INTO `role_power` VALUES (3, 3); -INSERT INTO `role_power` VALUES (3, 4); -INSERT INTO `role_power` VALUES (5, 5); - --- ---------------------------- --- Table structure for user --- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `user_id` int NOT NULL AUTO_INCREMENT, - `user_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `user_pwd` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`user_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '张三', '123456'); -INSERT INTO `user` VALUES (2, '李四', '666666'); -INSERT INTO `user` VALUES (3, '王五', '888888'); -INSERT INTO `user` VALUES (4, '樊小郭', '147258'); -INSERT INTO `user` VALUES (5, '郭悦迎', '333333'); -INSERT INTO `user` VALUES (6, '陈梦梦', '111111'); -INSERT INTO `user` VALUES (7, '画大饼', '777777'); - --- ---------------------------- --- Table structure for user_role --- ---------------------------- -DROP TABLE IF EXISTS `user_role`; -CREATE TABLE `user_role` ( - `role_id` int NOT NULL, - `user_id` int NOT NULL, - PRIMARY KEY (`role_id`, `user_id`) USING BTREE, - INDEX `FK_user_role2`(`user_id` ASC) USING BTREE, - CONSTRAINT `FK_user_role` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_user_role2` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user_role --- ---------------------------- -INSERT INTO `user_role` VALUES (4, 1); -INSERT INTO `user_role` VALUES (4, 2); -INSERT INTO `user_role` VALUES (4, 3); -INSERT INTO `user_role` VALUES (2, 4); -INSERT INTO `user_role` VALUES (2, 5); -INSERT INTO `user_role` VALUES (1, 6); -INSERT INTO `user_role` VALUES (5, 7); - -SET FOREIGN_KEY_CHECKS = 1; - -``` - -```mysql -select -user_name,role_name,power_name -from - `user` u, - user_role ur, - role r, - role_power rp, - power p - where - u.user_id=ur.user_id - and - ur.role_id=r.role_id - and - r.role_id=rp.role_id - and - rp.power_id=p.power_id; -``` - diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230924 \347\254\224\350\256\260.md" "b/10 \346\270\251\350\264\265\351\233\257/20230924 \347\254\224\350\256\260.md" deleted file mode 100644 index 474021e2b7e8b510dd05f9cc656a148d819d0067..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230924 \347\254\224\350\256\260.md" +++ /dev/null @@ -1,256 +0,0 @@ -## 数据库高级部分预习 - -## 一、函数 - -### 1.创建自定义函数 - - (1)DELIMITER $$ 定义结束符。MySQL默认的结束符是分号,但是函数体中可能用到分号。为了避免冲突,需要另外定义结束符。 - - (2)DROP FUNCTION IF EXISTS genPerson$$ 如果函数genPerson已经存在了,就删除掉。 - - (3)CREATE FUNCTION 创建函数genPerson,函数的参数是name,返回值是varchar(50)。 - - (4)函数体放在BEGIN 与 END之间。 - - (5)DECLARE 声明变量,str类型是varchar(50),默认值是空。 - - (6)CONCAT连接多个字符串。 - - (7)RETURN 返回拼接后的字符串str。 - - - - -### 2.执行 - -select 函数名('字段名') - - - -## 二、视图 - -## 视图是虚拟表,本身不存储数据,而是按照指定的方式进行查询 - -创建视图 - -```mysql -CREATE VIEW 视图名(列1,列2...) AS SELECT (列1,列2...) FROM ...; -``` - -使用视图 - -```mysql -当成表使用就好 -``` - - - -修改视图 - -```mysql -CREATE OR REPLACE VIEW 视图名 AS SELECT [...] FROM [...]; -``` - - - -查看数据库已有视图 - -```mysql ->SHOW TABLES [like...];(可以使用模糊查找) -``` - - - -查看视图详情 - -```mysql -DESC 视图名或者SHOW FIELDS FROM 视图名 -``` - - - -视图条件限制 - -```mysql -[WITH CHECK OPTION] -``` - -#### 插入数据 -1. 视图不是表,不直接存储数据,是一张虚拟的表; -2. 一般情况下,在创建有条件限制的视图时,加上“WITH CHECK OPTION”命令*) - -1.通过视图插入数据 - -```mysql ->INSERT INTO v_order(pid,pname,price) VALUES('p010','柴油','34'); -``` - -2.不可以跨表插入数据 - -```mysql -可以通过视图插入数据,但是只能基于一个基础表进行插入,不能跨表更新数据。 -``` - -3.WITH CHECK OPTION -如果在创建视图的时候制定了“WITH CHECK OPTION”,那么更新数据时不能插入或更新不符合视图限制条件的记录。 - -通过视图修改,可能导致数据无故消失,因此: - -> 没有特殊的理由,建议加上“WITH CHECK OPTION”命令。 - -# 百度标准理解 - -#### 1.事务 - -- 原子性:事务包含的这一系列操作,要么全部成功,要么全部失败。(由DBMS的事务管理子系统来实现); -- 一致性:事务完成之后,不会将非法的数据写入数据库。(由DBMS的完整性子系统执行测试任务); -- 隔离性:多个事务可以在一定程度上并发执行。(由DBMS的[并发](https://so.csdn.net/so/search?q=并发&spm=1001.2101.3001.7020)控制子系统实现); - -隔离级别 - -读未提交:一个事务可以读取到另外一个事务尚未提交的数据。该隔离级别可能会产生“脏读”、“不可重复读取”和“幻影读取”问题。 - -读已提交:一个事务只能读取到另外一个事务已经提交的数据。该隔离级别解决了“脏读”问题,但是仍然可能会发生“不可重复读取”和“幻影读取”问题。 - - -可重复读取:在同一个事务当中,多次读取同一份数据,结果一样。该隔离级别解决了“脏读”和“不可重复读取”问题,但是仍然有可能会产生“幻影读取问题”(虚读)。 - -序列化:多个同务只能排队执行,即只有一个事务结束之后,另外一个事务才能开始执行。该隔离级别解决了“脏读”,“不可重复读取”和“幻影读取”问题,但是程序性能会下降。所以只有必要的时候(比如在银行系统里面)才会使用。 - -总结: - - 隔离级别从低到高依次是"读未提交"、“读已提交”、“可重复读取”和“序列化”,隔离级别越高,性能越低。mysql数据库默认隔离级别是“可重复读取”,oracle是“读已提交”。数据库底层使用的“加锁”的机制来实现不同的隔离级别,包括对整个表加锁,对表中的行加锁。 - - mysql数据库开始事务、提交事务、回滚事务 - -```MYSQL -begin; -commit; -rollback; -``` - - mysql数据库必须将数据库引擎设置为"innodb"才能支持事务。 - - - -- 持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上)(由DBMS的恢复管理子系统实现的); - - - -#### 2.视图 - -创建视图 - - create view 视图名 as select(注:可以对单表或者多表进行查询,数据库会将视图的定义保存下来。) - -删除视图 - - drop view 视图名 - -例子 - -```mysql -create table t_emp( - id int primary key auto_increment, - name varchar(50), - salary int, - age int -); - -create view v_emp as select * from t_emp; -create view v_emp2(name,salary) as select name,salary from t_emp; - -insert into v_emp2 values('Jhon',3000); - -create table t_dept( - id int primary key, - name varchar(50), - addr varchar(100) -); -insert into t_dept values(100,'财务部','北京'); -insert into t_dept values(200,'开发部','上海'); - -create table t_staff( - id int primary key auto_increment, - name varchar(30), - age int, - dept_id int -); -insert into t_staff values(null,'张三',33,100); -insert into t_staff values(null,'李四',23,100); -insert into t_staff values(null,'王五',43,200); - -create view v_staff_dept(sname,dname,addr) -as -select s.name sname,d.name dname,d.addr from t_staff s -join t_dept d on s.dept_id = d.id; - -drop view v_emp; - - -``` - -#### 3.索引 - -创建索引 - - create index 索引名 on 表名(字段列表) - -—— 为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - - 注:索引类似于一本书的目录 - -应该将经常作为查询条件的字段加索引,除此以外,还要在分组、过滤、排序及联合查询的字段上加索引 - -删除索引 - - drop index 索引名 on 表名 - -联合索引 - - 所谓联合索引(复合索引),指的是索引字段是多个 - -#### 4.存储过程 - - 存储在数据库端的一组为了完成特定功能的sql语句 - - create procedure 存储过程名([参数]) - - 参数格式 (参数类型 参数名 数据类型) - - 参数类型有三种: - - IN: 输入参数,该参数的值必须在调用该存储过程时指定,在存储过程内部使用, 不能返回。 - - 缺省值是IN。 - - OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - - INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回。 - -#### 5.约束 - -是一种限制,通过对表的行或者列的数据做出限制来确保数据的完整性和一致性。 - - - -主键:相当于唯一性约束 + 非空约束的组合。 - - 注:一张表只能一个主键,数据库会为主键添加主键索引 - - 外键:用于确保两个表之间的参照完整性。 - -插入记录时,要先插入主表中的记录。 -删除记录时,要先删除从表中的记录。 - - 非空: not null - - 唯一性:unique - - 检查(了解): - - 注:检查约束跟数据库版本有关系,mysql8.0.16之后才支持。 - - - -#### 6.Case表达式 \ No newline at end of file diff --git "a/10 \346\270\251\350\264\265\351\233\257/20230926 \350\247\206\345\233\276.md" "b/10 \346\270\251\350\264\265\351\233\257/20230926 \350\247\206\345\233\276.md" deleted file mode 100644 index 0a2ac830e771fd70e4833ee23379d0cd766d2ef5..0000000000000000000000000000000000000000 --- "a/10 \346\270\251\350\264\265\351\233\257/20230926 \350\247\206\345\233\276.md" +++ /dev/null @@ -1,63 +0,0 @@ -# 作业 - -````mysql - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -CREATE VIEW employee_vu as - SELECT last_name 姓名,employee_id 员工号,department_id 部门号 FROM employees; - -#2. 显示视图的结构 -SHOW CREATE VIEW employee_vu; - -#3. 查询视图中的全部内容 -SELECT * FROM employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -SELECT * FROM employee_vu WHERE 部门号 = 80; - -#练习2: - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -CREATE VIEW emp_v1 as -SELECT last_name 员工姓名, salary 工资,email 邮箱 FROM employees WHERE phone_number LIKE "011%"; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - -ALTER VIEW emp_v1 AS -SELECT last_name 员工姓名, salary 工资,email 邮箱 FROM employees WHERE phone_number LIKE "011%" AND email like "%e%"; - -#3. 向 emp_v1 插入一条记录,是否可以? - --- 可以 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE emp_v1 set 工资=工资+1000; - -#5. 删除emp_v1中姓名为Olsen的员工 -DELETE FROM emp_v1 WHERE 员工姓名="Olsen"; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -CREATE VIEW emp_v2 as - SELECT d.department_id 部门,max(e.salary)最高工资 FROM employees e left JOIN departments d on e.department_id=d.department_id WHERE e.salary>12000 GROUP BY d.department_id; - -#7. 向 emp_v2 中插入一条记录,是否可以? - --- 不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 -DROP VIEW emp_v2,emp_v1; -```` - - - - - diff --git "a/10 \346\270\251\350\264\265\351\233\257/\345\233\276\347\211\207/32e38aa3f50dcd0bac0c70ecfeb41f5.png" "b/10 \346\270\251\350\264\265\351\233\257/\345\233\276\347\211\207/32e38aa3f50dcd0bac0c70ecfeb41f5.png" deleted file mode 100644 index aefa9194543e633fd42d602420342de81a458429..0000000000000000000000000000000000000000 Binary files "a/10 \346\270\251\350\264\265\351\233\257/\345\233\276\347\211\207/32e38aa3f50dcd0bac0c70ecfeb41f5.png" and /dev/null differ diff --git "a/10 \346\270\251\350\264\265\351\233\257/\345\233\276\347\211\207/\345\276\256\344\277\241\345\233\276\347\211\207_20230913121457.png" "b/10 \346\270\251\350\264\265\351\233\257/\345\233\276\347\211\207/\345\276\256\344\277\241\345\233\276\347\211\207_20230913121457.png" deleted file mode 100644 index c76a0ea3a317cb7fafb1373d23e65555e0963e6d..0000000000000000000000000000000000000000 Binary files "a/10 \346\270\251\350\264\265\351\233\257/\345\233\276\347\211\207/\345\276\256\344\277\241\345\233\276\347\211\207_20230913121457.png" and /dev/null differ diff --git "a/11 \351\202\271\344\272\250\344\274\237/1.PNG" "b/11 \351\202\271\344\272\250\344\274\237/1.PNG" deleted file mode 100644 index b73784eb4ca367ca096ff64b19d0cff1644027c4..0000000000000000000000000000000000000000 Binary files "a/11 \351\202\271\344\272\250\344\274\237/1.PNG" and /dev/null differ diff --git "a/11 \351\202\271\344\272\250\344\274\237/2.PNG" "b/11 \351\202\271\344\272\250\344\274\237/2.PNG" deleted file mode 100644 index f9e944ea5539c9b5e308c50301efe542084fd0cf..0000000000000000000000000000000000000000 Binary files "a/11 \351\202\271\344\272\250\344\274\237/2.PNG" and /dev/null differ diff --git "a/11 \351\202\271\344\272\250\344\274\237/20239.24.md" "b/11 \351\202\271\344\272\250\344\274\237/20239.24.md" deleted file mode 100644 index aef1554c15a67d39f268868ee4ecf756b7f8d2e8..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/20239.24.md" +++ /dev/null @@ -1,27 +0,0 @@ -# - - - -#### 事务的特性 - - 原子性隔离性持久性 - -#### 2.视图 - - 在已有的表或者视图上创建的虚拟表 - - 创建视图: create view 视图名 asselect - - 删除视图:drop view 视图名 - -#### 3.索引 - - 为了提高查询的速度而在数据库断创建的一种排序的数据结构 - -#### 参数类型有三种 - -IN:输入参数,改参数的值必须在调用该存储过程时指定,在存储过程内部使用,不能返回。缺省值是IN - -OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回 - -INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回 diff --git "a/11 \351\202\271\344\272\250\344\274\237/3.PNG" "b/11 \351\202\271\344\272\250\344\274\237/3.PNG" deleted file mode 100644 index 87359ecc6c92ee6678658bffa1c3bb8a7011d11f..0000000000000000000000000000000000000000 Binary files "a/11 \351\202\271\344\272\250\344\274\237/3.PNG" and /dev/null differ diff --git "a/11 \351\202\271\344\272\250\344\274\237/9.10\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/11 \351\202\271\344\272\250\344\274\237/9.10\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index cb0e9bbaf86b988b3c0f1b216711889f5436fa38..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/9.10\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,184 +0,0 @@ -## 图书馆管理系统 - - - -``` - - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 10:47:30 */ -/*==============================================================*/ - - -drop table if exists Book; - -drop table if exists Bookshelf; - -drop table if exists Floor; - -drop table if exists Librarian; - -drop table if exists Library; - -drop table if exists Return_book; - -drop table if exists borrower; - -drop table if exists type; - -drop table if exists 借书; - -drop table if exists 入库; - -drop table if exists 分类; - -/*==============================================================*/ -/* Table: Book */ -/*==============================================================*/ -create table Book -( - book_id int not null, - Li_num int not null, - book_name char(255) not null, - primary key (book_id) -); - -/*==============================================================*/ -/* Table: Bookshelf */ -/*==============================================================*/ -create table Bookshelf -( - Bo_shelf_id int not null auto_increment, - Fl_num int not null, - Bo_shelf_name char(255) not null, - primary key (Bo_shelf_id) -); - -/*==============================================================*/ -/* Table: Floor */ -/*==============================================================*/ -create table Floor -( - Fl_num int not null auto_increment, - Lib_num int not null, - Fl_belong char(255) not null, - primary key (Fl_num) -); - -/*==============================================================*/ -/* Table: Librarian */ -/*==============================================================*/ -create table Librarian -( - Li_num int not null, - Li_name char(255) not null, - primary key (Li_num) -); - -/*==============================================================*/ -/* Table: Library */ -/*==============================================================*/ -create table Library -( - Lib_num int not null, - Lib_name char(255) not null, - primary key (Lib_num) -); - -/*==============================================================*/ -/* Table: Return_book */ -/*==============================================================*/ -create table Return_book -( - Re_book int not null, - Re_name char(255) not null, - primary key (Re_book) -); - -/*==============================================================*/ -/* Table: borrower */ -/*==============================================================*/ -create table borrower -( - borr_num int not null, - borr_name char(255) not null, - borr_date date not null, - borr_add char(255) not null, - primary key (borr_num) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - Book_type_id int not null, - Bo_shelf_id int not null, - Book_type_name char(255) not null, - primary key (Book_type_id) -); - -/*==============================================================*/ -/* Table: 借书 */ -/*==============================================================*/ -create table 借书 -( - borr_num int not null, - book_id int not null, - primary key (borr_num, book_id) -); - -/*==============================================================*/ -/* Table: 入库 */ -/*==============================================================*/ -create table 入库 -( - Re_book int not null, - Li_num int not null, - primary key (Re_book, Li_num) -); - -/*==============================================================*/ -/* Table: 分类 */ -/*==============================================================*/ -create table 分类 -( - book_id int not null, - Book_type_id int not null, - primary key (book_id, Book_type_id) -); - -alter table Book add constraint FK_管理 foreign key (Li_num) - references Librarian (Li_num) on delete restrict on update restrict; - -alter table Bookshelf add constraint FK_包含 foreign key (Fl_num) - references Floor (Fl_num) on delete restrict on update restrict; - -alter table Floor add constraint FK_包括 foreign key (Lib_num) - references Library (Lib_num) on delete restrict on update restrict; - -alter table type add constraint FK_下级 foreign key (Bo_shelf_id) - references Bookshelf (Bo_shelf_id) on delete restrict on update restrict; - -alter table 借书 add constraint FK_借书 foreign key (borr_num) - references borrower (borr_num) on delete restrict on update restrict; - -alter table 借书 add constraint FK_借书2 foreign key (book_id) - references Book (book_id) on delete restrict on update restrict; - -alter table 入库 add constraint FK_入库 foreign key (Re_book) - references Return_book (Re_book) on delete restrict on update restrict; - -alter table 入库 add constraint FK_入库2 foreign key (Li_num) - references Librarian (Li_num) on delete restrict on update restrict; - -alter table 分类 add constraint FK_分类 foreign key (book_id) - references Book (book_id) on delete restrict on update restrict; - -alter table 分类 add constraint FK_分类2 foreign key (Book_type_id) - references type (Book_type_id) on delete restrict on update restrict; - - -``` \ No newline at end of file diff --git "a/11 \351\202\271\344\272\250\344\274\237/9.10\347\254\224\350\256\260 .md" "b/11 \351\202\271\344\272\250\344\274\237/9.10\347\254\224\350\256\260 .md" deleted file mode 100644 index f56cccd9e32842c51ca413231d0dd00218b48d4e..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/9.10\347\254\224\350\256\260 .md" +++ /dev/null @@ -1,54 +0,0 @@ -## 9.5 - - - -今天学到了表之间的关系 - -1.一对一的关系 类如一个学生(学号,编号,身份证寒外键),只有一个身份证(身份证号) -就可以将其中任一表中的主键,放到另一个表当外健 -2.一对多的关系(多对一的关系)类如一个班级 (班级编号),有多个学生(学生编号)班级编号 -将一所在的表的主键,放到多的表当外键 -3.多对多的关系:一个学生可以选修多门课程,一门课程可以被多个学生选修 -需求分析 - -## 9.6 - -学到了ER图 - -(1)ER图的概念 - -用visio这个软件来创造概念 - -ER图:实体关系图,简记E-R图,是指以实体、关系、属性三个基木概念概括数据的基木结构,从而描 -(2)要素 -3要素:实体(表)、属性(字段)和关系(类似外键 -(3)表示 -实体型 -属性: -用椭圆形或圆角矩形表示,与相应的实体连接起来; -主属性名称下加下划线; -联系(关系): -用菱形表示,姜形框内写明联系的名称 -用线与实体相连,可标上联系的类型 -联系也可以有自己的属性 -用矩形表示,矩形框内写明实体名; - -## 9.8 - -学了数据库的范式 - -第一范式:要求之端的内容 不可在分割为的是保证数据的原子性 - -第二范式:在满足第一是的基础上要求非组建字段要完全依赖主键(非主键要完全依赖整个联合主键)不能依赖部分 - -第三范式 :满足第二范式的前提下 要求非主键属性要求直接依赖于主键 - -建表 - -10.先做需求分析。明确需要的数据 - -## 9.9 - -第一步:创建概念模型(类似ER图),以用户的角度。简称 CDM - -第二步:将转概念模型换成逻辑模型,以计算机的角度。简称 LDM 第三步:将逻辑模型转换成物理模型,以数据库的角度。简称 PDM第四步:生成DDL(生成数据库代码) diff --git "a/11 \351\202\271\344\272\250\344\274\237/9.15\347\254\224\350\256\260.md" "b/11 \351\202\271\344\272\250\344\274\237/9.15\347\254\224\350\256\260.md" deleted file mode 100644 index bc173421e2b21ee1025ff967108498027ba13492..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/9.15\347\254\224\350\256\260.md" +++ /dev/null @@ -1,10 +0,0 @@ -## 9.15 - -#### 数据库的范式 - -##### 1.第一范式:要求字段的内容不可再分割,为的是保证数据的原子性 - -##### 2.第二范式:要求在满足第一范式的基础上,要求非主键字段完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 - -##### 3.第三范式:满足第二范式的前提上,要求非主键属性要直接依赖于主键 - diff --git "a/11 \351\202\271\344\272\250\344\274\237/9.20\345\244\215\344\271\240.md" "b/11 \351\202\271\344\272\250\344\274\237/9.20\345\244\215\344\271\240.md" deleted file mode 100644 index 15d8be80393d62d22efd5a5eac95cdf23beae47a..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/9.20\345\244\215\344\271\240.md" +++ /dev/null @@ -1,768 +0,0 @@ -1. /* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 - */ - CREATE DATABASE ssa CHARSET utf8; - USE ssa; - SET NAMES utf8mb4; - SET FOREIGN_KEY_CHECKS = 0; - - -- ---------------------------- - -- Table structure for countries - -- ---------------------------- - DROP TABLE IF EXISTS `countries`; - CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - - -- ---------------------------- - -- Records of countries - -- ---------------------------- - BEGIN; - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); - INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); - COMMIT; - - -- ---------------------------- - -- Table structure for departments - -- ---------------------------- - DROP TABLE IF EXISTS `departments`; - CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - - -- ---------------------------- - -- Records of departments - -- ---------------------------- - BEGIN; - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); - INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); - COMMIT; - - -- ---------------------------- - -- Table structure for employees - -- ---------------------------- - DROP TABLE IF EXISTS `employees`; - CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - - -- ---------------------------- - -- Records of employees - -- ---------------------------- - BEGIN; - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); - INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); - COMMIT; - - -- ---------------------------- - -- Table structure for job_grades - -- ---------------------------- - DROP TABLE IF EXISTS `job_grades`; - CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - - -- ---------------------------- - -- Records of job_grades - -- ---------------------------- - BEGIN; - INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); - INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); - INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); - INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); - INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); - INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); - COMMIT; - - -- ---------------------------- - -- Table structure for job_history - -- ---------------------------- - DROP TABLE IF EXISTS `job_history`; - CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - - -- ---------------------------- - -- Records of job_history - -- ---------------------------- - BEGIN; - INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); - INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); - INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); - INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); - INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); - INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); - INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); - INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); - INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); - INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); - COMMIT; - - -- ---------------------------- - -- Table structure for jobs - -- ---------------------------- - DROP TABLE IF EXISTS `jobs`; - CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - - -- ---------------------------- - -- Records of jobs - -- ---------------------------- - BEGIN; - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); - INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); - COMMIT; - - -- ---------------------------- - -- Table structure for locations - -- ---------------------------- - DROP TABLE IF EXISTS `locations`; - CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - - -- ---------------------------- - -- Records of locations - -- ---------------------------- - BEGIN; - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); - INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); - COMMIT; - - -- ---------------------------- - -- Table structure for order - -- ---------------------------- - DROP TABLE IF EXISTS `order`; - CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - - -- ---------------------------- - -- Records of order - -- ---------------------------- - BEGIN; - INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); - INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); - INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); - COMMIT; - - -- ---------------------------- - -- Table structure for regions - -- ---------------------------- - DROP TABLE IF EXISTS `regions`; - CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - - -- ---------------------------- - -- Records of regions - -- ---------------------------- - BEGIN; - INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); - INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); - INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); - INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); - COMMIT; - - -- ---------------------------- - -- View structure for emp_details_view - -- ---------------------------- - DROP VIEW IF EXISTS `emp_details_view`; - CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - - SET FOREIGN_KEY_CHECKS = 1; - - - - - - - - - - - - #第03章_基本的SELECT语句的课后练习 - - # 1.查询所有员工12个月的工资总和,并起别名为工资总和 - SELECT sum(salary*12)员工工资总和 FROM employees; - - #理解1:计算12月的基本工资 - - #SELECT sum(salary*12) as 工资总和 FROM employees; - SELECT (sum(salary)+sum(commission_pct*salary))*12 FROM employees; - #理解2:计算12月的基本工资和奖金 - # ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - - # 2.查询employees表中去除重复的job_id以后的数据 - #去除重复 distinct - - SELECT DISTINCT job_id FROM employees; - - # 3.查询工资大于12000的员工姓名和工资 - SELECT * FROM employees WHERE salary>12000; - - # 4.查询员工号为176的员工的姓名和部门号 - SELECT first_name 姓名,job_id 部门号 FROM employees WHERE employee_id =176; - - #; - - # 5.显示表 departments 的结构,并查询其中的全部数据 - DESC departments; - SELECT * FROM departments; - # 第04章_运算符课后练习 - - # 1.选择工资不在5000到12000的员工的姓名和工资 - SELECT *FROM employees WHERE salary BETWEEN 5000 AND 12000; - - - # 2.选择在20或50号部门工作的员工姓名和部门号 - SELECT * FROM employees WHERE department_id IN(20,50); - - # 3.选择公司中没有管理者的员工姓名及job_id - - SELECT first_name,job_id from employees where manager_id is null; - - - - # 4.选择公司中有奖金的员工姓名,工资和奖金级别 - - - - - # 5.选择员工姓名的第三个字是 尔 的员工姓名 - - SELECT * FROM employees WHERE first_name LIKE '%尔'; - - - # 6.选择姓名中有 特 字和 尔 字的员工姓名 - -- SELECT * FROM employees WHERE first_name LIKE '%尔%' AND first_name '%特%'; - SELECT * from employees WHERE last_name like '%特%' and last_name like '%尔%'; - - # 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - - SELECT * FROM employees where first_name like '%尔'; - - # 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - - SELECT first_name 姓名, j.job_title 工种 FROM employees e LEFT JOIN jobs j on e.job_id=j.job_id where e.department_id BETWEEN 80 and 100; - # 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - - SELECT first_name 员工姓名, salary 工资,manager_id 管理者id from employees where manager_id in (100,101,110); - - #第05章_排序与分页的课后练习 - - - #1. 查询员工的姓名和部门号和年薪,按年薪降序显示 - -- order by 年薪 asc/desc - - SELECT first_name 姓名 ,department_id 部门号,salary*12 年薪 from employees ORDER BY 年薪 DESC; - - #2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - - - - #3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - - - SELECT * FROM employees where email like '%e%' ORDER BY LENGTH(email) desc , department_id asc; - - - # 第06章_多表查询的课后练习 - - - # 1.显示所有员工的姓名,部门号和部门名称。 - - SELECT e.first_name 姓名,d.department_id 部门号, d.department_name 部门名称 FROM employees e LEFT JOIN departments d on d.department_id=e.department_id - # 2.查询90号部门员工的job_id和90号部门的location_id - # 2.查询90号部门员工的job_id和90号部门的location_id - - SELECT job_id,location_id FROM employees e LEFT JOIN departments d on d.department_id=e.department_id where d.department_id=90; - - - - # 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - - SELECT e.last_name , d.department_name , l.location_id,l.city FROM employees e LEFT JOIN departments d on d.department_id=e.department_id LEFT JOIN locations l on l.location_id=d.location_id where commission_pct is not null; - - - - # 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - - SELECT e.last_name , e.job_id , d.department_id , d.department_name FROM employees e LEFT JOIN departments d on d.department_id=e.department_id LEFT JOIN locations l on l.location_id=d.location_id where l.city='多伦多'; - - #sql92语法(自然连接): - - - - - # 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - - SELECT department_name 部门名称, city 部门地址, e.last_name 姓名, j.job_title 工作, e.salary 工资 FROM employees e,departments d,locations l,jobs j where e.department_id=d.department_id and d.location_id=l.location_id and j.job_id=e.job_id; - - - - - # 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 - -- 员工姓名 员工编号 上级姓名 上级的员工编号 - -- 德哈恩 102 金 100 - - SELECT b.first_name 员工姓名,b.department_id 员工编号,a.last_name 上级姓名,a.manager_id 上级的员工编号 FROM employees a JOIN employees b where a.department_id=b.department_id; - - - # 7.查询哪些部门没有员工 - SELECT * FROM departments d LEFT JOIN employees e on d.department_id=e.department_id where e.department_id is null; - - # 8. 查询哪个城市没有部门 - SELECT * FROM departments d LEFT JOIN locations l on d.location_id=l.location_id where state_province is null ; - - - - # 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - SELECT * FROM employees e JOIN departments d ON e.department_id = d.department_id WHERE d.department_name like '销售部' or d.department_name like '信息技术部'; - - - # 第08章_聚合函数的课后练习 - - - - #2.查询公司员工工资的最大值,最小值,平均值,总和 - - SELECT MAX(salary) 最大值,MIN(salary) 最小值,AVG(salary) 平均值,SUM(salary) 总和 FROM employees; - #3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - SELECT MAX(salary) 最大值,MIN(salary) 最小值,AVG(salary) 平均值,SUM(salary) 总和,job_id FROM employees GROUP BY job_id; - #4.选择各个job_id的员工人数 - - SELECT count(job_id) FROM employees GROUP BY job_id; - - # 5.查询员工最高工资和最低工资的差距 - SELECT MAX(salary) - MIN(salary) 差距 FROM employees; - - # 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - - SELECT MAX(salary) 最大值,MIN(salary) 最小值 FROM employees WHERE salary>6000 and manager_id is not null GROUP BY manager_id; - - - ​ - - - # 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - - - SELECT d.department_name,AVG(salary),count(job_id) FROM employees e JOIN departments d ON e.department_id = d.department_id GROUP BY d.department_name ORDER BY AVG(salary) DESC; - - - # 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - SELECT job_title,department_name,min_salary FROM jobs j JOIN employees e on j.job_id=e.job_id join departments d on e.department_id=d.department_id - - - - - # 第09章_子查询的课后练习 - - - - #1.查询和 兹洛特基 相同部门的员工姓名和工资 - - - SELECT last_name,salary FROM employees WHERE department_id= (SELECT department_id FROM employees WHERE last_name like '兹洛特基'); - - #2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - - - SELECT employee_id,last_name,salary FROM employees WHERE salary>(SELECT AVG(salary) FROM employees); - #3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - SELECT last_name, job_id, salary FROM employees WHERE salary>(SELECT MAX(salary) FROM employees WHERE JOB_ID = 'SA_MAN'); - - - #4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - - SELECT employee_id FROM employees where first_name like "%u%"; - SELECT employee_id 员工号,first_name 姓名 FROM employees where employee_id = (SELECT employee_id FROM employees where first_name like "%u%"); - - - #5.查询部门的location_id为1700的部门的工作的员工的员工号 - - SELECT location_id FROM departments where location_id = 1700; - SELECT first_name,department_id FROM employees where department_id in (SELECT department_id FROM departments where location_id = 1700); - - - #6.查询管理者是 金 的员工姓名和工资 - SELECT last_name FROM employees WHERE last_name='金'; - - SELECT first_name 员工姓名,salary 工资 FROM employees where last_name in (SELECT last_name FROM employees WHERE last_name='金'); - #7.查询工资最低的员工信息: last_name, salary - - SELECT last_name,salary FROM employees WHERE salary =(SELECT MIN(salary) FROM employees); - - - #8.查询平均工资最低的部门信息 - #方式1: - # 部门最低工资=全司最低 - - #方式2 - # 部门平均<= 公司所有平均 - - SELECT department_id FROM employees GROUP BY department_id ORDER BY avg(salary) LIMIT 0,1; - - SELECT DISTINCT d.* FROM employees e LEFT JOIN departments d on e.department_id=d.department_id where d.department_id = (SELECT department_id FROM employees GROUP BY department_id ORDER BY avg(salary) LIMIT 0,1); - - #9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) - #方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - # 连表查 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - # 子查询 - select d.*,a.平均工资 from departments d right join - (select department_id,avg(salary) 平均工资 from employees group by department_id having avg(salary) = - (select avg(salary) 平均工资 from employees group by department_id order by 平均工资 limit 0,1)) a - on d.department_id = a.department_id; - - - #10.查询平均工资最高的 job 信息 - - #方式1:平均工资=最大 - #方式2:平均工资>=所有平均工资 - select j.*,avg(e.salary) 平均工资 - from jobs j right join employees e on j.job_id = e.job_id group by j.job_id order by 平均工资 desc limit 0,1; - - #11.查询平均工资高于公司平均工资的部门有哪些? - select d.department_name 部门名,avg(e.salary) 平均工资 - from departments d right join employees e on d.department_id = e.department_id - group by d.department_id having 平均工资 > (select avg(salary) from employees); - - #12.查询出公司中所有 manager 的详细信息 - - #方式1:自连接 自己连自己 - select * from employees where employee_id in - (select distinct(a.employee_id) from - (select e2.* from employees e1 left join employees e2 on e1.manager_id = e2.employee_id) a); - - #方式2:子查询 - #员工编号=(管理员编号有哪些) - select * from employees where employee_id in - (select distinct manager_id from employees); - - #13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - select min(e.salary) 最低工资 from employees e right join - (select department_id,max(salary) 最高工资 from employees group by department_id order by 最高工资 limit 0,1) a - on e.department_id = a.department_id ; - - #14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary - #方式1: - select last_name, department_id, email, salary from employees where employee_id = - (select employee_id from employees e right join - (select department_id,avg(salary) 平均工资 from employees group by department_id order by 平均工资 desc limit 0,1) a - on e.department_id = a.department_id limit 0,1); - - #15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 - #方式1: - select job_id from jobs where job_id != 'ST_CLERK'; - - #16. 选择所有没有管理者的员工的last_name - select last_name from employees where manager_id is null; - - #17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' - #方式1: - select * from employees where last_name = 'De Haan' - - #方式2: - - select e.employee_id 员工号,e.last_name 姓名,e.salary 工资,a.平均工资 from employees e left join - (select department_id,avg(salary) 平均工资 from employees group by department_id) a - on e.department_id = a.department_id and e.salary > a.平均工资; - #18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - - #方式1:使用相关子查询 - - - #方式2:在FROM中声明子查询 - - - - #19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - - - - #20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - - - /* - 子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - - 如何选择? - ① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 - ② 如果是相关子查询的话,通常都是从外往里写。 - - */ diff --git "a/11 \351\202\271\344\272\250\344\274\237/9.21\344\275\234\344\270\232\347\254\224\350\256\260.md" "b/11 \351\202\271\344\272\250\344\274\237/9.21\344\275\234\344\270\232\347\254\224\350\256\260.md" deleted file mode 100644 index b5261dfcbf8eed4a538e81ea901856467111bd89..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/9.21\344\275\234\344\270\232\347\254\224\350\256\260.md" +++ /dev/null @@ -1,92 +0,0 @@ -今天学到了sku,spu - -sku是库存量单位一个项目可能有多个SKU - -spu: 是商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个产品的特性。通俗点讲,属性值、特性相同的商品就可以称为一个spu - -``` -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:41:07 */ -/*==============================================================*/ -create database zy charset utf8; -use zy; - -drop table if exists attributes; - -drop table if exists attributes_value; - -drop table if exists relation; - -drop table if exists sku; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_id int not null auto_increment, - attributes_name varchar(50) not null, - primary key (attributes_id) -); - -/*==============================================================*/ -/* Table: attributes_value */ -/*==============================================================*/ -create table attributes_value -( - value_id int not null auto_increment, - value_content varchar(50) not null, - primary key (value_id) -); - -/*==============================================================*/ -/* Table: relation */ -/*==============================================================*/ -create table relation -( - relation_id int not null auto_increment, - sku_id int, - attributes_id int, - value_id int, - primary key (relation_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price decimal(9,2) not null, - sku_kc int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_content varchar(50) not null, - primary key (spu_id) -); - -alter table relation add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table relation add constraint FK_Relationship_3 foreign key (attributes_id) - references attributes (attributes_id) on delete restrict on update restrict; - -alter table relation add constraint FK_Relationship_4 foreign key (value_id) - references attributes_value (value_id) on delete restrict on update restrict; - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; -``` diff --git "a/11 \351\202\271\344\272\250\344\274\237/9.21\347\254\224\350\256\260 .md" "b/11 \351\202\271\344\272\250\344\274\237/9.21\347\254\224\350\256\260 .md" deleted file mode 100644 index 8dc3ba5f06c4c56afebbd07229fd4c5463033696..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/9.21\347\254\224\350\256\260 .md" +++ /dev/null @@ -1,9 +0,0 @@ -## 9.21 - - - -``` -RBAC是基于角色的权限访问控制模型。 -RBAC允许您通过分配一组权限来创建和实施高级访问。权限基于特定用户类别执行其职责所需的访问级别。 -RBAC0(Core RBAC):基本模型有三个元素:用户、角色和权限。模型设计基于“多对多”原则,即多个用户可以具有相同的角色,一个用户可以具有多个角色。同样,您可以将同一权限分配给多个角色,也可以将同一角色分配给多个权限 -``` diff --git "a/11 \351\202\271\344\272\250\344\274\237/9.27\344\275\234\344\270\232.txt" "b/11 \351\202\271\344\272\250\344\274\237/9.27\344\275\234\344\270\232.txt" deleted file mode 100644 index 7d7421a97855ff6bbd6c42f8f0e3c3bfa5296caf..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/9.27\344\275\234\344\270\232.txt" +++ /dev/null @@ -1,285 +0,0 @@ - -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -#第14章_视图的课后练习 - -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -CREATE view employee_vu(姓名,员工号,部门号) as SELECT LAST_NAME,EMPLOYEE_ID,DEPARTMENT_ID from employees; - - -#2. 显示视图的结构 - -DESC employee_vu; -#3. 查询视图中的全部内容 -SELECT * FROM employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -SELECT *FROM employee_vu WHERE 部门号 BETWEEN 0 AND 80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -CREATE view emp_v1 AS SELECT * FROM employees; - -SELECT first_name 员工姓名,salary 工资,email 邮箱 FROM emp_v1 WHERE phone_number LIKE '011%'; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - SELECT first_name 姓名,salary 工资,email 邮箱 FROM emp_v1 WHERE phone_number LIKE '011%'AND email like '%e%'; - -#3. 向 emp_v1 插入一条记录,是否可以? -NO - - - - - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE emp_v1 set salary=salary + 1000; -#5. 删除emp_v1中姓名为Olsen的员工 -delete FROM emp_v1 WHERE last_name = 'Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -CREATE VIEW emp_v2 as SELECT max(salary),d.department_id FROM employees e,departments d WHERE e.department_id=d.department_id AND salary>12000 GROUP BY department_id; - - - -#7. 向 emp_v2 中插入一条记录,是否可以? - - - - -#8. 删除刚才的emp_v2 和 emp_v1 -DROP VIEW if EXISTS emp_v1; \ No newline at end of file diff --git "a/11 \351\202\271\344\272\250\344\274\237/9.7\347\254\224\350\256\260.md" "b/11 \351\202\271\344\272\250\344\274\237/9.7\347\254\224\350\256\260.md" deleted file mode 100644 index 2d23f53b496ef30a9b40b78cf2cce0339d925358..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/9.7\347\254\224\350\256\260.md" +++ /dev/null @@ -1,35 +0,0 @@ -## 9.5 - - - -今天学到了表之间的关系 - -1.一对一的关系 类如一个学生(学号,编号,身份证寒外键),只有一个身份证(身份证号) -就可以将其中任一表中的主键,放到另一个表当外健 -2.一对多的关系(多对一的关系)类如一个班级 (班级编号),有多个学生(学生编号)班级编号 -将一所在的表的主键,放到多的表当外键 -3.多对多的关系:一个学生可以选修多门课程,一门课程可以被多个学生选修 -需求分析 - -## 9.6 - -学到了ER图 - -(1)ER图的概念 - -用visio这个软件来创造概念 - -ER图:实体关系图,简记E-R图,是指以实体、关系、属性三个基木概念概括数据的基木结构,从而描 -(2)要素 -3要素:实体(表)、属性(字段)和关系(类似外键 -(3)表示 -实体型 -属性: -用椭圆形或圆角矩形表示,与相应的实体连接起来; -主属性名称下加下划线; -联系(关系): -用菱形表示,姜形框内写明联系的名称 -用线与实体相连,可标上联系的类型 -联系也可以有自己的属性 -用矩形表示,矩形框内写明实体名; - diff --git "a/11 \351\202\271\344\272\250\344\274\237/9.7\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" "b/11 \351\202\271\344\272\250\344\274\237/9.7\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" deleted file mode 100644 index 0c49049ac7d69bb7aea164d63c50e94f18c607fb..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/9.7\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" +++ /dev/null @@ -1,70 +0,0 @@ -``` -CREATE DATABASE student charset utf8; -use student; - - 院系表 -CREATE TABLE faculties( -faculties_id INT PRIMARY KEY, -- 院系编号 -faculties_name VARCHAR(10) -- 院系名称 -); - - 专业表 -CREATE TABLE specialized( -faculties_id INT, -- 院系编号 -specialized_id INT PRIMARY KEY, -- 专业编号 -specialized_name VARCHAR(10), -- 专业名称 -FOREIGN KEY (faculties_id) REFERENCES faculties (faculties_id) -- 外键 -); - - 班级表 -CREATE TABLE class ( -specialized_id INT, -- 专业编号 -class_id INT PRIMARY KEY, -- 班级编号 -class_name VARCHAR(10), -- 班级名称 -class_year int, -- 年段 -FOREIGN KEY (specialized_id) REFERENCES specialized (specialized_id) -- 外键 -); - - 学生表 -CREATE TABLE student ( -class_id INT, -- 班级编号 -student_id INT PRIMARY KEY, -- 学号 -student_name VARCHAR(10), -- 姓名 -student_sex char, -- 性别 -FOREIGN KEY (class_id) REFERENCES class (class_id) -- 外键 -); - - 教师表 -CREATE TABLE teacher( -teacher_id INT PRIMARY KEY, -- 教师编号 -teacher_name VARCHAR(10), -- 姓名 -teacher_sex char -- 性别 -); - - 课表 -CREATE TABLE schedul( -schedul_id INT PRIMARY KEY, -- 课表编号 -schedul_week VARCHAR(10), -- 星期 -schedul_section VARCHAR(10) -- 节次 -); - - 课程表 -CREATE TABLE course( -teacher_id INT, -- 教师工号 -schedul_id INT, -- 课表编号 -course_id INT PRIMARY KEY, -- 课程编号 -course_name VARCHAR(10), -- 课程名称 -course_credits int, -- 学分 -FOREIGN KEY (teacher_id) REFERENCES teacher (teacher_id), -- 外键 -FOREIGN KEY (schedul_id) REFERENCES schedul (schedul_id) -- 外键 -); - - 教室表 -CREATE TABLE classroom( -classroom_id INT PRIMARY KEY, -- 教室编号 -classroom_name VARCHAR(10), -- 名称 -classroom_add VARCHAR(10) -- 地址 -); - - -``` \ No newline at end of file diff --git "a/11 \351\202\271\344\272\250\344\274\237/9.8\347\254\224\350\256\260.md" "b/11 \351\202\271\344\272\250\344\274\237/9.8\347\254\224\350\256\260.md" deleted file mode 100644 index 5679407d792e104d5f03d538f62e8f69b6e6e7be..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/9.8\347\254\224\350\256\260.md" +++ /dev/null @@ -1,48 +0,0 @@ -## 9.5 - - - -今天学到了表之间的关系 - -1.一对一的关系 类如一个学生(学号,编号,身份证寒外键),只有一个身份证(身份证号) -就可以将其中任一表中的主键,放到另一个表当外健 -2.一对多的关系(多对一的关系)类如一个班级 (班级编号),有多个学生(学生编号)班级编号 -将一所在的表的主键,放到多的表当外键 -3.多对多的关系:一个学生可以选修多门课程,一门课程可以被多个学生选修 -需求分析 - -## 9.6 - -学到了ER图 - -(1)ER图的概念 - -用visio这个软件来创造概念 - -ER图:实体关系图,简记E-R图,是指以实体、关系、属性三个基木概念概括数据的基木结构,从而描 -(2)要素 -3要素:实体(表)、属性(字段)和关系(类似外键 -(3)表示 -实体型 -属性: -用椭圆形或圆角矩形表示,与相应的实体连接起来; -主属性名称下加下划线; -联系(关系): -用菱形表示,姜形框内写明联系的名称 -用线与实体相连,可标上联系的类型 -联系也可以有自己的属性 -用矩形表示,矩形框内写明实体名; - -## 9.8 - -学了数据库的范式 - -第一范式:要求之端的内容 不可在分割为的是保证数据的原子性 - -第二范式:在满足第一是的基础上要求非组建字段要完全依赖主键(非主键要完全依赖整个联合主键)不能依赖部分 - -第三范式 :满足第二范式的前提下 要求非主键属性要求直接依赖于主键 - -建表 - -10.先做需求分析。明确需要的数据 diff --git "a/11 \351\202\271\344\272\250\344\274\237/\345\214\273\351\231\242.md" "b/11 \351\202\271\344\272\250\344\274\237/\345\214\273\351\231\242.md" deleted file mode 100644 index 03453fdd6fc286e5ed549a20ca505c0780aea2c6..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/\345\214\273\351\231\242.md" +++ /dev/null @@ -1,157 +0,0 @@ -## 医院 - - - -``` - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 21:56:43 */ -/*==============================================================*/ - - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists hospital; - -drop table if exists pharmacy; - -drop table if exists subject; - -drop table if exists 拿药; - -drop table if exists 病人; - -drop table if exists 诊断; - -drop table if exists 诊断表; - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - ho_id int not null, - ho_name char(255) not null, - Attribute_9 char(10), - primary key (ho_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_names char(255) not null, - dug_id int not null, - phar_id int, - primary key (dug_id) -); - -/*==============================================================*/ -/* Table: hospital */ -/*==============================================================*/ -create table hospital -( - hos_name char(255) not null, - hos_id char(255) not null, - sub_id int not null, - primary key (hos_id) -); - -/*==============================================================*/ -/* Table: pharmacy */ -/*==============================================================*/ -create table pharmacy -( - phar_id int not null, - hos_id char(255) not null, - phar_name char(255) not null, - primary key (phar_id) -); - -/*==============================================================*/ -/* Table: subject */ -/*==============================================================*/ -create table subject -( - sub_id int not null, - ho_id int not null, - sub_name char(255) not null, - primary key (sub_id) -); - -/*==============================================================*/ -/* Table: 拿药 */ -/*==============================================================*/ -create table 拿药 -( - diagnostic_list int not null, - pat_id int not null, - primary key (diagnostic_list, pat_id) -); - -/*==============================================================*/ -/* Table: 病人 */ -/*==============================================================*/ -create table 病人 -( - pat_id int not null, - pat_name char(255) not null, - pat_sex char(10) not null, - primary key (pat_id) -); - -/*==============================================================*/ -/* Table: 诊断 */ -/*==============================================================*/ -create table 诊断 -( - pat_id int not null, - ho_id int not null, - primary key (pat_id, ho_id) -); - -/*==============================================================*/ -/* Table: 诊断表 */ -/*==============================================================*/ -create table 诊断表 -( - diagnostic_list int not null, - dug_id int not null, - "Diagnostic table_content" char(255) not null, - primary key (diagnostic_list) -); - -alter table drug add constraint FK_Relationship_5 foreign key (phar_id) - references pharmacy (phar_id) on delete restrict on update restrict; - -alter table hospital add constraint FK_Relationship_10 foreign key (sub_id) - references subject (sub_id) on delete restrict on update restrict; - -alter table pharmacy add constraint FK_Relationship_4 foreign key (hos_id) - references hospital (hos_id) on delete restrict on update restrict; - -alter table subject add constraint FK_Relationship_9 foreign key (ho_id) - references doctor (ho_id) on delete restrict on update restrict; - -alter table 拿药 add constraint FK_拿药 foreign key (diagnostic_list) - references 诊断表 (diagnostic_list) on delete restrict on update restrict; - -alter table 拿药 add constraint FK_拿药2 foreign key (pat_id) - references 病人 (pat_id) on delete restrict on update restrict; - -alter table 诊断 add constraint FK_诊断 foreign key (pat_id) - references 病人 (pat_id) on delete restrict on update restrict; - -alter table 诊断 add constraint FK_诊断2 foreign key (ho_id) - references doctor (ho_id) on delete restrict on update restrict; - -alter table 诊断表 add constraint FK_Relationship_7 foreign key (dug_id) - references drug (dug_id) on delete restrict on update restrict; - - - -``` \ No newline at end of file diff --git "a/11 \351\202\271\344\272\250\344\274\237/\346\261\275\350\275\246\346\237\245\350\257\242.md" "b/11 \351\202\271\344\272\250\344\274\237/\346\261\275\350\275\246\346\237\245\350\257\242.md" deleted file mode 100644 index b3da26d70612c0c91c8ce6a6931bcb0ab316db93..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/\346\261\275\350\275\246\346\237\245\350\257\242.md" +++ /dev/null @@ -1,89 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:48:14 */ -/*==============================================================*/ - - -drop table if exists automobile; - -drop table if exists client; - -drop table if exists sale; - -drop table if exists salesman; - -/*==============================================================*/ -/* Table: automobile */ -/*==============================================================*/ -create table automobile -( - auto_type char(20) not null, - auto_id int not null, - auto_price int not null, - primary key (auto_id) -); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - client_name char(20) not null, - client_id int not null auto_increment, - client_sex char(10) not null, - client_number int not null, - primary key (client_id) -); - -/*==============================================================*/ -/* Table: sale */ -/*==============================================================*/ -create table sale -( - salec_id int not null, - auto_id int, - client_id int, - sale_id int, - salec_date char(10) not null, - primary key (salec_id) -); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - sale_id int not null auto_increment, - sale_name char(20) not null, - sale_sex char(5) not null, - sale_number int not null, - primary key (sale_id) -); - -alter table sale add constraint FK_Relationship_2 foreign key (sale_id) - references salesman (sale_id) on delete restrict on update restrict; - -alter table sale add constraint FK_Relationship_3 foreign key (client_id) - references client (client_id) on delete restrict on update restrict; - -alter table sale add constraint FK_Relationship_4 foreign key (auto_id) - references automobile (auto_id) on delete restrict on update restrict; --- 1.ѯضԱۼ¼ -SELECT * from contract a LEFT JOIN salesman b on a.salesman_id=b.salesman_id WHERE salesman_name=""; - -- 2.ۼ¼ۼ۸ߵ - SELECT car_type , contract_money FROM contract a LEFT JOIN car b on a.car_id = b.car_id WHERE contract_money in( SELECT max(contract_money) FROM contract ) ; - - -- 3.ͳijԱܶ -SELECT salesman_name Ա,sum(contract_money) ܶ from contract a LEFT JOIN salesman b on a.salesman_id=b.salesman_id WHERE salesman_name in (SELECT salesman_name FROM salesman WHERE salesman_name = ""); - - -- 4.ݿͻϢѯ乺 - SELECT client_name,car_type FROM client a LEFT JOIN contract b on a.client_id = b.client_id LEFT JOIN car c on b.car_id = c.car_id; - -- 5.ضƷͳÿƷƵ۶ - SELECT car_type Ʒ,sum(contract_money) ܶ,count(c.car_id) FROM contract b LEFT JOIN car c on b.car_id = c.car_id GROUP BY car_type; - -- 6.ضڷΧڵЩ - SELECT * FROM contract a LEFT JOIN car c on a.car_id = c.car_id WHERE contract_date between "2022-10-1" and "2022-12-30"; - -- 7.ij͵ʷ - SELECT car_type,contract_date FROM contract a LEFT JOIN car c on a.car_id = c.car_id WHERE car_type = "µ" ; - -- 8.ͳÿԱ - SELECT salesman_name Ա, count(b.salesman_id) from contract a LEFT JOIN salesman b on a.salesman_id = b.salesman_id GROUP BY salesman_name; - diff --git "a/11 \351\202\271\344\272\250\344\274\237/\347\224\265\345\275\261.PNG" "b/11 \351\202\271\344\272\250\344\274\237/\347\224\265\345\275\261.PNG" deleted file mode 100644 index a96fdae316f7bdf1e42524e5c47e97dd0dd3abcf..0000000000000000000000000000000000000000 Binary files "a/11 \351\202\271\344\272\250\344\274\237/\347\224\265\345\275\261.PNG" and /dev/null differ diff --git "a/11 \351\202\271\344\272\250\344\274\237/\347\224\265\345\275\261.md" "b/11 \351\202\271\344\272\250\344\274\237/\347\224\265\345\275\261.md" deleted file mode 100644 index 1ced5ff58b5eca7126b8f46399dc108503baf4aa..0000000000000000000000000000000000000000 --- "a/11 \351\202\271\344\272\250\344\274\237/\347\224\265\345\275\261.md" +++ /dev/null @@ -1,159 +0,0 @@ -## 电影 - - - -``` - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 9:16:46 */ -/*==============================================================*/ - - -drop table if exists Relationship_6; - -drop table if exists film; - -drop table if exists message; - -drop table if exists 主演; - -drop table if exists 客户端; - -drop table if exists 导演; - -drop table if exists 用户; - -drop table if exists 短评; - -drop table if exists 编剧; - -/*==============================================================*/ -/* Table: Relationship_6 */ -/*==============================================================*/ -create table Relationship_6 -( - dl_id int not null, - kuhu_id int not null, - primary key (dl_id, kuhu_id) -); - -/*==============================================================*/ -/* Table: film */ -/*==============================================================*/ -create table film -( - dl_id int not null, - series int not null, - fl_name char(255) not null, - flduration int not null, - fl_type char(255) not null, - primary key (dl_id) -); - -/*==============================================================*/ -/* Table: message */ -/*==============================================================*/ -create table message -( - mess_name char(255) not null, - mess_id int not null, - name char(255) not null, - sex char(255) not null, - primary key (mess_name) -); - -/*==============================================================*/ -/* Table: 主演 */ -/*==============================================================*/ -create table 主演 -( - dl_id int not null, - mess_name char(255) not null, - primary key (dl_id, mess_name) -); - -/*==============================================================*/ -/* Table: 客户端 */ -/*==============================================================*/ -create table 客户端 -( - kuhu_id int not null, - kuhu_name char(255) not null, - primary key (kuhu_id) -); - -/*==============================================================*/ -/* Table: 导演 */ -/*==============================================================*/ -create table 导演 -( - dl_id int not null, - mess_name char(255) not null, - primary key (dl_id, mess_name) -); - -/*==============================================================*/ -/* Table: 用户 */ -/*==============================================================*/ -create table 用户 -( - user int not null, - oassword char(255) not null, - primary key (user) -); - -/*==============================================================*/ -/* Table: 短评 */ -/*==============================================================*/ -create table 短评 -( - series int not null, - user int not null, - content char(255) not null, - primary key (series) -); - -/*==============================================================*/ -/* Table: 编剧 */ -/*==============================================================*/ -create table 编剧 -( - dl_id int not null, - mess_name char(255) not null, - primary key (dl_id, mess_name) -); - -alter table Relationship_6 add constraint FK_Relationship_6 foreign key (dl_id) - references film (dl_id) on delete restrict on update restrict; - -alter table Relationship_6 add constraint FK_Relationship_7 foreign key (kuhu_id) - references 客户端 (kuhu_id) on delete restrict on update restrict; - -alter table film add constraint FK_Relationship_5 foreign key (series) - references 短评 (series) on delete restrict on update restrict; - -alter table 主演 add constraint FK_主演 foreign key (dl_id) - references film (dl_id) on delete restrict on update restrict; - -alter table 主演 add constraint FK_主演2 foreign key (mess_name) - references message (mess_name) on delete restrict on update restrict; - -alter table 导演 add constraint FK_导演 foreign key (dl_id) - references film (dl_id) on delete restrict on update restrict; - -alter table 导演 add constraint FK_导演2 foreign key (mess_name) - references message (mess_name) on delete restrict on update restrict; - -alter table 短评 add constraint FK_评论 foreign key (user) - references 用户 (user) on delete restrict on update restrict; - -alter table 编剧 add constraint FK_编剧 foreign key (dl_id) - references film (dl_id) on delete restrict on update restrict; - -alter table 编剧 add constraint FK_编剧2 foreign key (mess_name) - references message (mess_name) on delete restrict on update restrict; - - - -``` \ No newline at end of file diff --git "a/12\346\236\227\344\277\212\344\274\237/0905\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" "b/12\346\236\227\344\277\212\344\274\237/0905\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" deleted file mode 100644 index fae05c4def5acf2eef996074ca1e2fd8f41c4b46..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0905\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" +++ /dev/null @@ -1,5 +0,0 @@ -分析大二如何规划时间和学习,多余时间应该怎么用。 - -多关注招聘网和计算机网络 - -加强学习 \ No newline at end of file diff --git "a/12\346\236\227\344\277\212\344\274\237/0906\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" "b/12\346\236\227\344\277\212\344\274\237/0906\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" deleted file mode 100644 index 3abdb38b09a7d807006925e4aa09d32542314684..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0906\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" +++ /dev/null @@ -1,47 +0,0 @@ -大二学习思路 - -1首先是打牢基础。 - -2明确自己的发展方向。 - -3进阶学习。 - -4实践项目。 - - - -学习了数据库设计的一些思路。 - - - -表之间的关系: - -一对一:将其中一个表放到另一个表当主键。 - -一对多:将一所在的主键放到多的表当外键。 - -多对多:需要引入第三张表,将前面两个表的主键放进来当外键。 - - - -用ER图来创建演示各个主键之间的关系。 - -ER图=实体关系图 分为实体(表)、属性(字段)、关系(类似外键)三种。 - - - -数据库设计步骤 - -设计阶段~~~~设计描述 - -需求分析~~~~充分了解开发系统的应用需求,明确存储那些数据和格式 - -概念结构设计~~~~将需求分析得到用户需求为信息结构(即概念模型)的过程。将ER图转化。 - -逻辑结构设计 - -物理结构设计 - -数据库实施 - -数据库维护 \ No newline at end of file diff --git "a/12\346\236\227\344\277\212\344\274\237/0907\347\254\254\344\270\211\346\254\241\347\254\224\350\256\260.md" "b/12\346\236\227\344\277\212\344\274\237/0907\347\254\254\344\270\211\346\254\241\347\254\224\350\256\260.md" deleted file mode 100644 index b2997878964b9a6b581fec6838b9f790dcf53d03..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0907\347\254\254\344\270\211\346\254\241\347\254\224\350\256\260.md" +++ /dev/null @@ -1,7 +0,0 @@ -数据库的表示: - -第一示范:要求字段的内容,不可在分割,为的是保证数据的原字性。 - -第二示范:要求在满足第一示范的基础上,要求非主键要完全依赖主键而不能只依赖部分。 - -第三示范:满足第二示范的基础上,要求非主键属性直接依赖主键。 \ No newline at end of file diff --git "a/12\346\236\227\344\277\212\344\274\237/0908\344\275\234\344\270\232.md" "b/12\346\236\227\344\277\212\344\274\237/0908\344\275\234\344\270\232.md" deleted file mode 100644 index dee9775f27cf02aa5aea1f7ca85c3af42a361e1f..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0908\344\275\234\344\270\232.md" +++ /dev/null @@ -1,69 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 19:42:25 */ -/*==============================================================*/ - - -drop table if exists book; - -drop table if exists borrow; - -drop table if exists manager; - -drop table if exists student; - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - book_id int(11) not null auto_increment, - teacher_id int not null, - book_name varchar(11) not null, - book_borth varchar(11) not null, - book_zz varchar(11) not null, - primary key (book_id) -); - -/*==============================================================*/ -/* Table: borrow */ -/*==============================================================*/ -create table borrow -( - student_number int not null, - book_id int not null, - primary key (student_number, book_id) -); - -/*==============================================================*/ -/* Table: manager */ -/*==============================================================*/ -create table manager -( - teacher_name varchar(11) not null, - teacher_age int not null, - teacher_sex varchar(1) not null, - teacher_id int(11) not null auto_increment, - primary key (teacher_id) -); - -/*==============================================================*/ -/* Table: student */ -/*==============================================================*/ -create table student -( - student_number int(11) not null auto_increment, - student_quantity int not null, - student_time time not null, - primary key (student_number) -); - -alter table book add constraint FK_manage foreign key (teacher_id) - references manager (teacher_id) on delete restrict on update restrict; - -alter table borrow add constraint FK_borrow foreign key (student_number) - references student (student_number) on delete restrict on update restrict; - -alter table borrow add constraint FK_borrow2 foreign key (book_id) - references book (book_id) on delete restrict on update restrict; - diff --git "a/12\346\236\227\344\277\212\344\274\237/0912\347\224\265\345\275\261\344\275\234\344\270\232.md" "b/12\346\236\227\344\277\212\344\274\237/0912\347\224\265\345\275\261\344\275\234\344\270\232.md" deleted file mode 100644 index efeb9cf2972124c025415cc686f7c7ac77a53dac..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0912\347\224\265\345\275\261\344\275\234\344\270\232.md" +++ /dev/null @@ -1,213 +0,0 @@ -. - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 19:57:54 */ -/*==============================================================*/ - - -drop table if exists actor; - -drop table if exists castprofile; - -drop table if exists cj; - -drop table if exists freely; - -drop table if exists movie; - -drop table if exists moviereviews; - -drop table if exists official; - -drop table if exists people; - -drop table if exists recommend; - -drop table if exists shortcomment; - -drop table if exists window; - -drop table if exists 倾向于演员的评价; - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - yy_bj varchar(11) not null, - yy_zy varchar(11) not null, - yy_dy varchar(11) not null, - yy_cydy varchar(11) not null, - movie_idd varchar(11) not null, - primary key (yy_cydy) -); - -/*==============================================================*/ -/* Table: castprofile */ -/*==============================================================*/ -create table castprofile -( - actor_name varchar(11) not null, - people_sex varchar(11) not null, - imdb_id varchar(11) not null, - yy_cydy varchar(11) not null, - borth varchar(222) not null, - primary key (imdb_id) -); - -/*==============================================================*/ -/* Table: cj */ -/*==============================================================*/ -create table cj -( - window_id varchar(11) not null, - yy_cydy varchar(11) not null, - primary key (window_id, yy_cydy) -); - -/*==============================================================*/ -/* Table: freely */ -/*==============================================================*/ -create table freely -( - short_id int not null, - people_name varchar(11) not null, - primary key (short_id, people_name) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_type int not null, - movie_time time not null, - movie_country varchar(20) not null, - movie_language varchar(20) not null, - movie_datetime datetime not null, - movie_name varchar(10) not null, - movie_idd varchar(11) not null, - primary key (movie_idd) -); - -/*==============================================================*/ -/* Table: moviereviews */ -/*==============================================================*/ -create table moviereviews -( - yp_yp varchar(255) not null, - yp_xj varchar(5) not null, - y[_ybh varchar(11) not null, - yp_jl varchar(255) not null, - primary key (y[_ybh) -); - -/*==============================================================*/ -/* Table: official */ -/*==============================================================*/ -create table official -( - gf_name varchar(11) not null, - gf_level varchar(11) not null, - gf_id varchar(11) not null, - movie_idd varchar(11) not null, - primary key (gf_id) -); - -/*==============================================================*/ -/* Table: people */ -/*==============================================================*/ -create table people -( - people_age int not null, - people_name varchar(11) not null, - window_id varchar(11) not null, - 性别 varchar(11) not null, - primary key (people_name) -); - -/*==============================================================*/ -/* Table: recommend */ -/*==============================================================*/ -create table recommend -( - people_name varchar(11) not null, - y[_ybh varchar(11) not null, - primary key (people_name, y[_ybh) -); - -/*==============================================================*/ -/* Table: shortcomment */ -/*==============================================================*/ -create table shortcomment -( - short_hot varchar(11) not null, - short_new varchar(11) not null, - short_id int not null, - short_good varchar(11) not null, - short_tl varchar(255) not null, - primary key (short_id) -); - -/*==============================================================*/ -/* Table: window */ -/*==============================================================*/ -create table window -( - window_actor varchar(11) not null, - window_people varchar(11) not null, - window_id varchar(11) not null, - movie_idd varchar(11) not null, - primary key (window_id) -); - -/*==============================================================*/ -/* Table: 倾向于演员的评价 */ -/*==============================================================*/ -create table 倾向于演员的评价 -( - short_id int not null, - yy_cydy varchar(11) not null, - primary key (short_id, yy_cydy) -); - -alter table actor add constraint FK_cyry foreign key (movie_idd) - references movie (movie_idd) on delete restrict on update restrict; - -alter table castprofile add constraint FK_introduce foreign key (yy_cydy) - references actor (yy_cydy) on delete restrict on update restrict; - -alter table cj add constraint FK_cj foreign key (window_id) - references window (window_id) on delete restrict on update restrict; - -alter table cj add constraint FK_cj2 foreign key (yy_cydy) - references actor (yy_cydy) on delete restrict on update restrict; - -alter table freely add constraint FK_freely foreign key (short_id) - references shortcomment (short_id) on delete restrict on update restrict; - -alter table freely add constraint FK_freely2 foreign key (people_name) - references people (people_name) on delete restrict on update restrict; - -alter table official add constraint FK_gfpj foreign key (movie_idd) - references movie (movie_idd) on delete restrict on update restrict; - -alter table people add constraint FK_jr foreign key (window_id) - references window (window_id) on delete restrict on update restrict; - -alter table recommend add constraint FK_recommend foreign key (people_name) - references people (people_name) on delete restrict on update restrict; - -alter table recommend add constraint FK_recommend2 foreign key (y[_ybh) - references moviereviews (y[_ybh) on delete restrict on update restrict; - -alter table window add constraint FK_hot foreign key (movie_idd) - references movie (movie_idd) on delete restrict on update restrict; - -alter table 倾向于演员的评价 add constraint FK_倾向于演员的评价 foreign key (short_id) - references shortcomment (short_id) on delete restrict on update restrict; - -alter table 倾向于演员的评价 add constraint FK_倾向于演员的评价2 foreign key (yy_cydy) - references actor (yy_cydy) on delete restrict on update restrict; - diff --git "a/12\346\236\227\344\277\212\344\274\237/0913\345\274\200\350\215\257.md" "b/12\346\236\227\344\277\212\344\274\237/0913\345\274\200\350\215\257.md" deleted file mode 100644 index 87acce0e60dfd8db10969dd5dd3ce583ff7b70da..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0913\345\274\200\350\215\257.md" +++ /dev/null @@ -1,128 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 22:31:16 */ -/*==============================================================*/ - - -drop table if exists departement; - -drop table if exists doctor; - -drop table if exists kf; - -drop table if exists medicine; - -drop table if exists patient; - -drop table if exists prescription; - -drop table if exists window; - -/*==============================================================*/ -/* Table: departement */ -/*==============================================================*/ -create table departement -( - departement_id int(11) not null auto_increment, - departement_name varchar(11) not null, - departement varchar(11) not null, - departement_number int not null, - primary key (departement_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int(11) not null auto_increment, - departement_id int not null, - doctor_name varchar(11) not null, - doctor_sex char(1) not null, - doctor_age int not null, - doctor_type varchar(11) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: kf */ -/*==============================================================*/ -create table kf -( - prescription_id int not null, - medicine_id int not null, - primary key (prescription_id, medicine_id) -); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - medicine_id int(11) not null auto_increment, - doctor_id int not null, - patient_id int not null, - medicine_type varchar(11) not null, - medicine_no varchar(11) not null, - medicine_rules varchar(11) not null, - primary key (medicine_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_name varchar(11) not null, - patient_age int not null, - patient_sex char(1) not null, - patient_id int(111) not null auto_increment, - window_id int not null, - doctor_id int not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - prescription_id int(11) not null auto_increment, - prescription_idd int not null, - prescription_time datetime not null, - primary key (prescription_id) -); - -/*==============================================================*/ -/* Table: window */ -/*==============================================================*/ -create table window -( - window_num int not null, - window_money int not null, - window_record int not null, - window_id int(11) not null auto_increment, - primary key (window_id) -); - -alter table doctor add constraint FK_bm foreign key (departement_id) - references departement (departement_id) on delete restrict on update restrict; - -alter table kf add constraint FK_kf foreign key (prescription_id) - references prescription (prescription_id) on delete restrict on update restrict; - -alter table kf add constraint FK_kf2 foreign key (medicine_id) - references medicine (medicine_id) on delete restrict on update restrict; - -alter table medicine add constraint FK_gz foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table medicine add constraint FK_ny foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table patient add constraint FK_jq foreign key (window_id) - references window (window_id) on delete restrict on update restrict; - -alter table patient add constraint FK_zd foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - diff --git "a/12\346\236\227\344\277\212\344\274\237/0914\345\214\273\351\231\242.md" "b/12\346\236\227\344\277\212\344\274\237/0914\345\214\273\351\231\242.md" deleted file mode 100644 index 6f22b5a277d576c476cd6eee6262c74464fa6487..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0914\345\214\273\351\231\242.md" +++ /dev/null @@ -1,96 +0,0 @@ -医院管理系统 - -医院:科室,患者,门诊药房,病房 - -科室:医生,护士 - -患者:挂号,住院 - -门诊药房:药品,处方单,缴费方式 - -``` -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-14 21:15:35 */ -/*==============================================================*/ - -create database hospital charset utf8; -use hospital; - -drop table if exists cure; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists grab; - -drop table if exists patient; - -/*==============================================================*/ -/* Table: cure */ -/*==============================================================*/ - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - d_id int(2) not null auto_increment, - d_name varchar(5) not null, - d_type varchar(10) not null, - d_sex varchar(2) not null, - d_age varchar(2) not null, - primary key (d_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - dr_id int(2) not null auto_increment, - dr_name varchar(5) not null, - primary key (dr_id) -); - -/*==============================================================*/ -/* Table: grab */ -/*==============================================================*/ - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - c_id int(2) not null auto_increment, - c_name varchar(5) not null, - c_symptom varchar(10) not null, - c_sex varchar(2) not null, - c_age varchar(2) not null, - primary key (c_id) -); -create table cure -( - c_id int not null, - d_id int not null, - primary key (c_id, d_id) -); -create table grab -( - c_id int not null, - dr_id int not null, - primary key (c_id, dr_id) -); -alter table cure add constraint FK_cure foreign key (p_id) - references patient (p_id) on delete restrict on update restrict; - -alter table cure add constraint FK_cure2 foreign key (d_id) - references doctor (d_id) on delete restrict on update restrict; - -alter table grab add constraint FK_grab foreign key (p_id) - references patient (p_id) on delete restrict on update restrict; - -alter table grab add constraint FK_grab2 foreign key (dr_id) - references drug (dr_id) on delete restrict on update restrict; -``` \ No newline at end of file diff --git "a/12\346\236\227\344\277\212\344\274\237/0915\344\271\260\350\275\246.md" "b/12\346\236\227\344\277\212\344\274\237/0915\344\271\260\350\275\246.md" deleted file mode 100644 index 636d0e53b9cff6a1e059881559420fc416f1e3d1..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0915\344\271\260\350\275\246.md" +++ /dev/null @@ -1,111 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/17 20:31:59 */ -/*==============================================================*/ - - - - -drop table if exists car; - -drop table if exists customer; - -drop table if exists salasman; - -drop table if exists traded; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ - -CREATE DATABASE buycar charset utf8; - -use buycar; - -create table car -( - car_id int(11) not null auto_increment, - car_type varchar(11) not null, - car_borth datetime not null, - primary key (car_id) -); - -INSERT into car VALUES -(1,"跑车","2002-1-2"), -(2,"机车","2012-5-6"), -(3,"坦克","2022-7-3"); -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - customer_id int(11) not null auto_increment, - customer_name varchar(11) not null, - customer_sex char(1) not null, - customer_age int not null, - primary key (customer_id) -); - -INSERT into customer VALUES -(1,"曹博","男",19), -(2,"瑞带","男",19), -(3,"马达","男",19), -(4,"林伟","男",19), -(5,"陈炜","男",19), -(6,"陈翔","男",19); -/*==============================================================*/ -/* Table: salasman */ -/*==============================================================*/ -create table salasman -( - salasman_id int(11) not null auto_increment, - salasman_sex char(1) not null, - salasman_name varchar(11) not null, - primary key (salasman_id) -); - -INSERT into salasman VALUES -(1,"男","销售一号"), -(2,"女","销售一号"), -(3,"男","销售一号"); -/*==============================================================*/ -/* Table: traded */ -/*==============================================================*/ -create table traded -( - traded_money int not null, - traded_day datetime not null, - traded_id int(11) not null auto_increment, - car_id int not null, - salasman_id int not null, - customer_id int not null, - primary key (traded_id) -); - -INSERT into traded VALUES -(1000000,"2025-5-3",1,3,2,1), -(500000,"2026-4-3",2,2,1,2), -(900000,"2025-8-3",3,3,1,3), -(1000000,"2023-3-3",4,3,3,4), -(1000000,"2024-1-3",5,2,3,5), -(700000,"2025-9-3",6,1,2,6); - -alter table traded add constraint FK_Relationship_1 foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table traded add constraint FK_Relationship_2 foreign key (salasman_id) - references salasman (salasman_id) on delete restrict on update restrict; - -alter table traded add constraint FK_Relationship_3 foreign key (customer_id) - references customer (customer_id) on delete restrict on update restrict; - - -# 应用场景: - -- 1.查询特定销售员的销售记录 - -- 2.查找销售记录中销售价格最高的汽车 - -- 3.统计某个销售员的销售总额 - -- 4.根据客户信息查询其购买过的汽车 - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - -- 8.统计每个销售员的销售数量 \ No newline at end of file diff --git "a/12\346\236\227\344\277\212\344\274\237/0919\344\275\234\344\270\232.md" "b/12\346\236\227\344\277\212\344\274\237/0919\344\275\234\344\270\232.md" deleted file mode 100644 index 2481580491725ae1c476ca175600ba925c2e3567..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0919\344\275\234\344\270\232.md" +++ /dev/null @@ -1,432 +0,0 @@ -1.查询所有员工12个月的工资总和,并起别名为工资总和 - -``` -SELECT sum(salary*12) as 工资总和 FROM employees; -``` - -#理解2:计算12月的基本工资和奖金 - -###### ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - SELECT sum( salary * 12 ), sum(ifnull( salary * 12 * commission_pct, 0 )) FROM employees; -###### 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - -``` -SELECT DISTINCT job_id FROM employees; -``` - -###### 3.查询工资大于12000的员工姓名和工资 -SELECT - last_name, - salary -FROM - employees -WHERE - salary > 12000; -###### 4.查询员工号为176的员工的姓名和部门号 -SELECT - last_name, - department_id -FROM - employees -WHERE - employee_id = 176; - -#;5.显示表 departments 的结构,并查询其中的全部数据 -DESC departments; -SELECT - -FROM -departments; - - * 第04章_运算符课后练习 - -###### 1.选择工资不在5000到12000的员工的姓名和工资 -SELECT - last_name, - salary -FROM - employees -WHERE - salary NOT BETWEEN 5000 - AND 12000; - -###### 2.选择在20或50号部门工作的员工姓名和部门号 -SELECT - last_name, - department_id -FROM - employees -WHERE - department_id = 20 - OR department_id = 50; - -###### 3.选择公司中没有管理者的员工姓名及job_id -SELECT - last_name, - job_id -FROM - employees -WHERE - manager_id IS NULL; - -###### 4.选择公司中有奖金的员工姓名,工资和奖金级别 -SELECT - last_name, - salary, - salary * commission_pct, - g.grade_level -FROM - employees e - JOIN job_grades g ON e.salary * commission_pct BETWEEN g.lowest_sal - AND g.highest_sal -WHERE - commission_pct IS NOT NULL; - -###### 5.选择员工姓名的第三个字是 尔 的员工姓名 -SELECT * - -FROM -employees -WHERE -last_name LIKE '__尔'; - -###### 6.选择姓名中有 特 字和 尔 字的员工姓名 -SELECT * - -FROM -employees -WHERE -last_name LIKE '%尔%特%' -OR last_name LIKE '%特%尔%'; - -* ###### 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - SELECT - -* FROM - employees - WHERE - first_name LIKE '%尔'; - -* ###### 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - SELECT * FROM - employees - WHERE - department_id BETWEEN 80 - AND 100; - - 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - - SELECT - -* FROM - employees - WHERE - manager_id IN ( 100, 101, 110 ); - -* #第05章_排序与分页的课后练习 - #1. 查询员工的姓名和部门号和年薪,按年薪降序显示 - -``` -SELECT -salary * 12 -FROM -employees -ORDER BY -salary * 12 DESC; -``` # - -``` -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -SELECT * FROM -employees -WHERE -salary NOT BETWEEN 8000 -AND 17000 -ORDER BY -salary DESC -LIMIT 2,20; - -``` #3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -``` -SELECT -* -FROM -employees -WHERE -email LIKE '%e%' -ORDER BY -length( email ) DESC, -department_id ASC; -``` ##### 第06章_多表查询的课后练习 -###### 1.显示所有员工的姓名,部门号和部门名称。 -SELECT - e.last_name, - d.department_id, - d.department_name -FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id; - ###### 2.查询90号部门员工的job_id和90号部门的location_id -SELECT - * -FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id -WHERE - d.department_id = 90; - ###### 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city -SELECT - e.last_name, - d.department_name, - l.location_id, - l.city -FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - LEFT JOIN locations l ON d.location_id = l.location_id -WHERE - e.commission_pct IS NOT NULL; - ###### 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -SELECT - e.last_name, - e.job_id, - d.department_id, - d.department_name -FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - LEFT JOIN locations l ON d.location_id = l.location_id -WHERE - l.city = '多伦多';#sql92语法(自然连接): -###### 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 -SELECT - * -FROM - departments d - LEFT JOIN employees e ON d.department_id = e.department_id -WHERE - d.department_name = '行政部'; -SELECT - * -FROM - departments d, - employees e -WHERE - d.department_id = e.department_id - AND d.department_name = '行政部'; - ###### 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 -``` -SELECT -e.first_name 员工姓名, -e.employee_id 员工号, -s.last_name 上级姓名, -s.employee_id 上级员工号 -FROM -employees e -INNER JOIN employees s ON e.employee_id = s.employee_id; -``` ###### 7.查询哪些部门没有员工 -SELECT - * -FROM - departments d - LEFT JOIN employees e ON d.department_id = e.department_id -WHERE - d.manager_id IS NULL; - ###### 8. 查询哪个城市没有部门 -SELECT - * -FROM - locations l - LEFT JOIN departments d ON l.location_id = d.location_id -WHERE - d.department_id IS NULL; - ###### 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -SELECT - * -FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id -WHERE - d.department_name = '销售部' - OR d.department_name = '信息技术部'; - ###### 第08章_聚合函数的课后练习 -``` -``` -#2.查询公司员工工资的最大值,最小值,平均值,总和 -SELECT max( salary ),min( salary ),avg( salary ),sum( salary ) -FROM -employees; -``` -\#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - -SELECT max( salary ),min( salary ),avg( salary ),sum( salary ), -job_id -FROM -employees -GROUP BY -job_id; - -\#4.选择各个job_id的员工人数 - -SELECT -count( job_id ) -FROM -employees; -``` -SELECT - max( salary )- min( salary ) differnce -FROM - employees;###### 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 -SELECT - min( salary ) 最低工资, - manager_id -FROM - employees -GROUP BY - manager_id -HAVING - 最低工资 >= 6000 - AND manager_id IS NOT NULL;###### 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 -SELECT - department_id, - count( employee_id ), - avg( salary ) -FROM - employees -GROUP BY - department_id -ORDER BY - avg( salary ) DESC;###### 8.查询每个工种、每个部门的部门名、工种名和最低工资 -SELECT - min( salary ), - d.department_id, - d.department_name, - e.job_id -FROM - employees e - INNER JOIN departments d ON e.department_id = d.department_id -GROUP BY - department_id, - job_id;###### 第09章_子查询的课后练习 -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -``` -\###### 5.查询员工最高工资和最低工资的差距 - -SELECT -last_name, -salary -FROM -employees -WHERE -department_id =( -SELECT -department_id -FROM -employees -WHERE -last_name = '兹洛特基' -); - -\#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - -SELECT -* -FROM -employees -WHERE -salary >( -SELECT -avg( salary ) -FROM -employees -); - -\#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -SELECT -last_name, -job_id, -salary -FROM -employees -WHERE -salary > ALL ( SELECT salary FROM employees WHERE job_id = 'SA_MAN' ); - -\#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -SELECT -employee_id, -last_name -FROM -employees -WHERE -department_id = ANY ( SELECT department_id FROM employees WHERE email LIKE '%u%' ); - -\#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -SELECT -department_id -FROM -employees -WHERE -department_id IN ( SELECT department_id FROM departments WHERE location_id = 1700 ); - -\#6.查询管理者是 金 的员工姓名和工资 - -SELECT -last_name, -salary -FROM -employees -WHERE -manager_id IN ( SELECT employee_id FROM employees WHERE last_name = '金' ); - -\#7.查询工资最低的员工信息: last_name, salary - -SELECT -last_name, -salary -FROM -employees -WHERE -salary = ( SELECT min( salary ) FROM employees ) - -\#8.查询平均工资最低的部门信息 - -SELECT -* -FROM -departments -WHERE -department_id = ( SELECT department_id FROM employees GROUP BY department_id HAVING AVG( salary ) <= ALL ( SELECT AVG( salary ) FROM employees GROUP BY department_id ) ); -``` ###### 部门最低工资=全司最低 -#方式2: -###### 部门平均<= 公司所有平均 -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -#10.查询平均工资最高的 job 信息 -``` -SELECT -* -FROM -jobs -WHERE -job_id = ( SELECT job_id FROM employees GROUP BY job_id HAVING AVG( salary ) >= ALL ( SELECT AVG( salary ) FROM employees GROUP BY job_id ) ); -``` #方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 -#11.查询平均工资高于公司平均工资的部门有哪些? -``` -SELECT -department_id -FROM -employees -WHERE -department_id IS NOT NULL -GROUP BY -department_id -HAVING -AVG( salary ) > ( SELECT AVG( salary ) FROM employees ); diff --git "a/12\346\236\227\344\277\212\344\274\237/0920\346\235\203\351\231\220.md" "b/12\346\236\227\344\277\212\344\274\237/0920\346\235\203\351\231\220.md" deleted file mode 100644 index aa6948455a84a0ddaa319f456b73b4f5b248d5f7..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0920\346\235\203\351\231\220.md" +++ /dev/null @@ -1,112 +0,0 @@ -数据库能存什么: - -1业务数据表:用户,商品 - -2功能资源表:菜单信息表,页面代码 - -权限的使用: - -1菜单权限:不同用户登入系统后展示的菜单不同。 - -2按钮权限:不同用户查看同一个对象时展示按钮不一样。 - -3数据权限:可见数据不同 - -4操作权限:可以看未必能用 - -RBAC组成部分:用户,角色,权限。 (角色最重要) - -RBAC跟加便捷了权限对用户的使用。 - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 16:10:02 */ -/*==============================================================*/ - -CREATE DATABASE quanxian charset utf8; - -use quanxian; - -SELECT * FROM `user` WHERE user_id=3; - -SELECT * FROM meun ,rold,`user` WHERE user_id = rold_id and user_id = meun_id; - -drop table if exists meun; - -drop table if exists rold; - -drop table if exists rold_meun; - -drop table if exists user; - -drop table if exists user_rold; - -/*==============================================================*/ -/* Table: meun */ -/*==============================================================*/ -create table meun -( - meun_sy varchar(11) not null, - meun_pt varchar(11) not null, - meun_vip varchar(11) not null, - meun_sw varchar(11) not null, - meun_id int not null auto_increment, - primary key (meun_id) -); - - -/*==============================================================*/ -/* Table: rold */ -/*==============================================================*/ -create table rold -( - rold_ordynary varchar(11) not null, - rold_try varchar(11) not null, - rold_vip varchar(11) not null, - rold_id int not null auto_increment, - primary key (rold_id) -); - -/*==============================================================*/ -/* Table: rold_meun */ -/*==============================================================*/ -create table rold_meun -( - meun_id int not null, - rold_id int not null, - primary key (meun_id, rold_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_permissions varchar(11) not null, - user_name varchar(11) not null, - primary key (user_id) -); - -/*==============================================================*/ -/* Table: user_rold */ -/*==============================================================*/ -create table user_rold -( - rold_id int not null, - user_id int not null, - primary key (rold_id, user_id) -); - -alter table rold_meun add constraint FK_rold_meun foreign key (meun_id) - references meun (meun_id) on delete restrict on update restrict; - -alter table rold_meun add constraint FK_rold_meun2 foreign key (rold_id) - references rold (rold_id) on delete restrict on update restrict; - -alter table user_rold add constraint FK_user_rold foreign key (rold_id) - references rold (rold_id) on delete restrict on update restrict; - -alter table user_rold add constraint FK_user_rold2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - diff --git "a/12\346\236\227\344\277\212\344\274\237/0921\345\225\206\345\223\201.md" "b/12\346\236\227\344\277\212\344\274\237/0921\345\225\206\345\223\201.md" deleted file mode 100644 index a563ee50deece416e8c94892a56111a07cb05ff3..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0921\345\225\206\345\223\201.md" +++ /dev/null @@ -1,90 +0,0 @@ -spu:标准产品单元,属性值、特性相同的商品就可以称为一个spu。 - -sku:最小库存单元,即一件衣服的尺码、衣服的颜色、衣服的价格都是一个sku - -### spu和sku的区别: - -SPU 是一个相对抽象的概念,而SKU 是具象化的 SPU,也就是在 SPU 基础上添加了一个可售卖完整的规格信息,从而能够让顾客明确知道拿到手的商品是什么样。以服装为例,服装的一个款式是一个 SPU,只有加上了尺码、颜色后才能成为一个 SKU。 - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/21 23:09:59 */ -/*==============================================================*/ - - -drop table if exists attribute; - -drop table if exists commodity; - -drop table if exists goods; - -drop table if exists products; - -drop table if exists value; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table attribute -( - attribute_id int not null auto_increment, - goods_id int not null, - primary key (attribute_id) -); - -/*==============================================================*/ -/* Table: commodity */ -/*==============================================================*/ -create table commodity -( - commodity_id int not null auto_increment, - products_id int not null, - commodity_name varchar(11) not null, - primary key (commodity_id) -); - -/*==============================================================*/ -/* Table: goods */ -/*==============================================================*/ -create table goods -( - goods_id int not null auto_increment, - commodity_id int not null, - goods_name varchar(11) not null, - goods_num int not null, - primary key (goods_id) -); - -/*==============================================================*/ -/* Table: products */ -/*==============================================================*/ -create table products -( - products_id int not null auto_increment, - products_type varchar(11) not null, - products_pinpai varchar(11) not null, - primary key (products_id) -); - -/*==============================================================*/ -/* Table: value */ -/*==============================================================*/ -create table value -( - value_id int not null auto_increment, - goods_id int not null, - primary key (value_id) -); - -alter table attribute add constraint FK_Relationship_3 foreign key (goods_id) - references goods (goods_id) on delete restrict on update restrict; - -alter table commodity add constraint FK_Relationship_1 foreign key (products_id) - references products (products_id) on delete restrict on update restrict; - -alter table goods add constraint FK_Relationship_2 foreign key (commodity_id) - references commodity (commodity_id) on delete restrict on update restrict; - -alter table value add constraint FK_Relationship_4 foreign key (goods_id) - references goods (goods_id) on delete restrict on update restrict; - diff --git "a/12\346\236\227\344\277\212\344\274\237/0922\351\242\204\344\271\240\347\254\224\350\256\260.md" "b/12\346\236\227\344\277\212\344\274\237/0922\351\242\204\344\271\240\347\254\224\350\256\260.md" deleted file mode 100644 index 91016c6cea96dd505c3811a517930d76c1ab16d9..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0922\351\242\204\344\271\240\347\254\224\350\256\260.md" +++ /dev/null @@ -1,32 +0,0 @@ -1.事务 - - 为了完成某个业务而对数据库进行一系列操作,这些操作要么成功,要么失败。 - -四个特性: - -原子性:事务包含的这一系列操作,要么全部成功,要么全部失败。 -一致性:事务完成之后,不会将非法的数据写入数据库。 -隔离性:多个事务可以在一定程度上并发执行。 -持久性:事务完成之后,数据要永久保存。 - -2.视图 - - 在已有的表或者视图上创建的虚拟表。 - -创建视图 - - create view 视图名 as select - -可以对(单表)视图进行一些增删改查操作,这些操作会影响到原始的表。 - -(3)删除视图 - - drop view 视图名 - -3.索引 - - 为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - -如何创建索引: - - create index 索引名 on 表名(字段列表) \ No newline at end of file diff --git "a/12\346\236\227\344\277\212\344\274\237/0926\350\247\206\345\233\276\344\275\234\344\270\232.md" "b/12\346\236\227\344\277\212\344\274\237/0926\350\247\206\345\233\276\344\275\234\344\270\232.md" deleted file mode 100644 index d1004f7e3b2a42cc31576a455c359f5a4778f6f4..0000000000000000000000000000000000000000 --- "a/12\346\236\227\344\277\212\344\274\237/0926\350\247\206\345\233\276\344\275\234\344\270\232.md" +++ /dev/null @@ -1,78 +0,0 @@ -笔记 - -check 约束 检查字段是否符合要求,一般指值的范围。 - -语法 check (表达式) - -创建视图 - -create view 视图名称 as 查询语句 - -删除视图 - -drop view 视图名称; - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE view employee_vu as -SELECT LAST_NAME,EMPLOYEE_ID,DEPARTMENT_ID FROM employees; - - -#2. 显示视图的结构 - -DESC employee_vu; - - -#3. 查询视图中的全部内容 - -SELECT * FROM employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 - -SELECT * FROM employee_vu WHERE DEPARTMENT_ID<=80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -CREATE VIEW emp_v1 as -SELECT last_name,salary,email,phone_number FROM employees WHERE phone_number LIKE "011%"; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - -ALTER VIEW emp_v1 as -SELECT last_name,salary,email,phone_number FROM employees WHERE phone_number LIKE "011%" and email like "%e%"; - - -#3. 向 emp_v1 插入一条记录,是否可以? - -不能 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE emp_v1 set salary = salary + 1000; -SELECT * FROM emp_v1; - - -#5. 删除emp_v1中姓名为Olsen的员工 -DELETE FROM emp_v1 where last_name= 'Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -CREATE VIEW emp_v2 AS -SELECT max(salary) 最高工资,DEPARTMENT_ID 部门id FROM employees -GROUP BY DEPARTMENT_ID -HAVING max(salary)>12000; - - -#7. 向 emp_v2 中插入一条记录,是否可以? - -不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 -DROP VIEW emp_v1; -DROP VIEW emp_v2; \ No newline at end of file diff --git "a/13 \350\224\241\345\230\211\344\271\220/0914\347\254\224\350\256\260\345\212\240\344\275\234\344\270\232.md" "b/13 \350\224\241\345\230\211\344\271\220/0914\347\254\224\350\256\260\345\212\240\344\275\234\344\270\232.md" deleted file mode 100644 index 7f42f5c9e71de2043ea981734f9c9a86fce4dfd4..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/0914\347\254\224\350\256\260\345\212\240\344\275\234\344\270\232.md" +++ /dev/null @@ -1,171 +0,0 @@ -如果一个主体的属性有多个值,那这个属性就可以拆成一个新主体 - -```mysql -create database hospital charset utf8; - -use hospital; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 21:45:56 */ -/*==============================================================*/ - - -drop table if exists department; - -drop table if exists doctor; - -drop table if exists doctor_patient_diagnosis; - -drop table if exists doctor_patient_registered; - -drop table if exists medicine; - -drop table if exists patient; - -drop table if exists pharmacy; - -drop table if exists ward; - -/*==============================================================*/ -/* Table: department */ -/*==============================================================*/ -create table department -( - department_id int not null auto_increment, - department_name varchar(7) not null, - department_tel char(11) not null, - department_address varchar(10) not null, - primary key (department_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - department_id int not null, - doctor_name varchar(4) not null, - doctor_sex char(1) not null, - doctor_title varchar(5) not null, - doctor_age int not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: doctor_patient_diagnosis */ -/*==============================================================*/ -create table doctor_patient_diagnosis -( - diagnosis_id int not null auto_increment, - patient_id int not null, - doctor_id int not null, - medicine_jd int not null, - diagnosis_price numeric(7,2) not null, - primary key (diagnosis_id) -); - -/*==============================================================*/ -/* Table: doctor_patient_registered */ -/*==============================================================*/ -create table doctor_patient_registered -( - registered_id int not null auto_increment, - patient_id int not null, - doctor_id int not null, - registered_date datetime not null, - registered_price numeric(2,0) not null, - primary key (registered_id) -); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - medicine_jd int not null auto_increment, - pharmacy_id int not null, - medicine_name varchar(10) not null, - medicine_price numeric(5,2) not null, - medicine_function varchar(50) not null, - medicine_ingredients varchar(50) not null, - medicine_num int not null, - primary key (medicine_jd) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(4) not null, - patient_age int not null, - patient_sex char(1) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: pharmacy */ -/*==============================================================*/ -create table pharmacy -( - pharmacy_id int not null auto_increment, - pharmacy_name varchar(7) not null, - primary key (pharmacy_id) -); - -/*==============================================================*/ -/* Table: ward */ -/*==============================================================*/ -create table ward -( - ward_id int not null auto_increment, - department_id int not null, - bed_id char(3) not null, - primary key (ward_id) -); - -alter table doctor add constraint FK_department_doctor_belong foreign key (department_id) - references department (department_id) on delete restrict on update restrict; - -alter table doctor_patient_diagnosis add constraint FK_doctor_patient_diagnosis foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table doctor_patient_diagnosis add constraint FK_doctor_patient_diagnosis2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table doctor_patient_diagnosis add constraint FK_mediciner_patient_diagnosis foreign key (medicine_jd) - references medicine (medicine_jd) on delete restrict on update restrict; - -alter table doctor_patient_registered add constraint FK_doctor_patient_registered foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table doctor_patient_registered add constraint FK_doctor_patient_registered2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table medicine add constraint FK_medicine_pharmacy_storage foreign key (pharmacy_id) - references pharmacy (pharmacy_id) on delete restrict on update restrict; - -alter table ward add constraint FK_department_ward_belong foreign key (department_id) - references department (department_id) on delete restrict on update restrict; - - -INSERT INTO `department` VALUES (5, '皮肤科', '08756934127', '门诊楼5层'); - -INSERT INTO `doctor` VALUES (3, 5, 'Kim', '女', '主治医师', 45); - -INSERT INTO `pharmacy` VALUES (7, '7房'); - -INSERT INTO `medicine` VALUES (8, 7, '氯雷他定', 60.00, '接触性皮炎', '氯', 1); - -INSERT INTO `ward` VALUES (1, 5, '#01'); - -INSERT INTO `patient` VALUES (1, 'isa', 21, '女'); - -INSERT INTO `doctor_patient_registered` VALUES (1, 1, 3, '2020-11-12 10:52:16', 50); - -INSERT INTO `doctor_patient_diagnosis` VALUES (1, 1, 3, 8, 110.00); -``` - diff --git "a/13 \350\224\241\345\230\211\344\271\220/0920\347\254\224\350\256\260.md" "b/13 \350\224\241\345\230\211\344\271\220/0920\347\254\224\350\256\260.md" deleted file mode 100644 index 283f03d7ce32562c9618bdde1b99139a11c8a009..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/0920\347\254\224\350\256\260.md" +++ /dev/null @@ -1,130 +0,0 @@ -### 笔记 - -RBAC : 基于角色访问控制权限 - -一个控制模型 - -**角色**是RBAC是的核心 - -RBAC是主流设计模式 - -#### 数据库能存什么 - -1. 业务数据表:用户、商品 -2. 功能资源表:菜单信息表、页面代码表 - -#### 权限使用背景 - -菜单权限: 不同用户登录系统后,展示菜单不同 - -按钮权限:不同用户查看同一个对象时,展示按钮不一样 - -数据权限:可见数据不同 - -操作权限:看得到点不着 例如:腾讯视频VIP你可以看到视频但是不可以播放 - -#### RBAC由三个部分组成 - -1. 用户 -2. 角色 -3. 权限 - -- User(用户):每个用户都有唯一的UID识别,并被授予不同的角色 -- Role(角色):不同角色具有不同的权限 -- Permission(权限):访问权限 -- 用户-角色映射:用户和角色之间的映射关系 -- 角色-权限映射:角色和权限之间的映射 - -权限关联实现授权,给用户分配应当有的对应权限 - -##### RBAC的优点: - -简化了用户和权限的关系 - -易扩展,易维护 - -##### 缺点: - -RBAC模型没有提供操作顺序的控制机制,这一缺陷得RBAC模型很难适应那些对操作次序有严格要求的系统 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:24:17 */ -/*==============================================================*/ - - -drop table if exists jurisdiction; - -drop table if exists personal; - -drop table if exists personal_role; - -drop table if exists role; - -drop table if exists role_jurisdiction; - -/*==============================================================*/ -/* Table: jurisdiction */ -/*==============================================================*/ -create table jurisdiction -( - jurisdiction_id int not null auto_increment, - jurisdiction_name varchar(50) not null, - primary key (jurisdiction_id) -); - -/*==============================================================*/ -/* Table: personal */ -/*==============================================================*/ -create table personal -( - personal_id int not null auto_increment, - personal_name varchar(11) not null, - personal_pwd varchar(11) not null, - primary key (personal_id) -); - -/*==============================================================*/ -/* Table: personal_role */ -/*==============================================================*/ -create table personal_role -( - role_id int not null, - personal_id int not null, - primary key (role_id, personal_id) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name varchar(50) not null, - primary key (role_id) -); - -/*==============================================================*/ -/* Table: role_jurisdiction */ -/*==============================================================*/ -create table role_jurisdiction -( - jurisdiction_id int not null, - role_id int not null, - primary key (jurisdiction_id, role_id) -); - -alter table personal_role add constraint FK_personal_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table personal_role add constraint FK_personal_role2 foreign key (personal_id) - references personal (personal_id) on delete restrict on update restrict; - -alter table role_jurisdiction add constraint FK_role_jurisdiction foreign key (jurisdiction_id) - references jurisdiction (jurisdiction_id) on delete restrict on update restrict; - -alter table role_jurisdiction add constraint FK_role_jurisdiction2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; -``` - diff --git "a/13 \350\224\241\345\230\211\344\271\220/0922\347\254\224\350\256\260.md" "b/13 \350\224\241\345\230\211\344\271\220/0922\347\254\224\350\256\260.md" deleted file mode 100644 index 6bf074776af32e781057cdeeaad62189927d7a64..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/0922\347\254\224\350\256\260.md" +++ /dev/null @@ -1,132 +0,0 @@ -### 笔记 - -- ## 笔记: - -- SPU(Standard Product Unit ):指的是标准商品单位,商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个商品的特性; - -- SKU(Stock Keeping Unit):库存量单位,是物理上不可分割的最小存货单元。 - -~~~mysql -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-22 09:09:19 */ -/*==============================================================*/ -create database tt character set utf8; -use tt; - -drop table if exists attributes; - -drop table if exists attributes_values; - -drop table if exists rele; - -drop table if exists sku; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_id int not null auto_increment, - attributes_name varchar(10) not null, - primary key (attributes_id) -); - -/*==============================================================*/ -/* Table: attributes_values */ -/*==============================================================*/ -create table attributes_values -( - values_id int not null auto_increment, - values_test varchar(20) not null, - primary key (values_id) -); - -/*==============================================================*/ -/* Table: rele */ -/*==============================================================*/ -create table rele -( - rele_id int not null auto_increment, - sku_id int, - attributes_id int, - values_id int, - primary key (rele_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price decimal(6,2) not null, - sku_add varchar(20) not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(20) not null, - spu_text varchar(255) not null, - primary key (spu_id) -); - -alter table rele add constraint FK_attributes_rele foreign key (attributes_id) - references attributes (attributes_id) on delete restrict on update restrict; - -alter table rele add constraint FK_sku_rele foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table rele add constraint FK_values_rele foreign key (values_id) - references attributes_values (values_id) on delete restrict on update restrict; - -alter table sku add constraint FK_spu_sku foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -# 查询1 -select a.spu_id,b.sku_id,b.sku_name,b.sku_price,b.sku_add - from spu a,sku b,attributes c,attributes_values d,rele e -where - a.spu_id = b.spu_id - and b.sku_id = e.sku_id - and c.attributes_id = e.attributes_id - and d.values_id = e.values_id ; - -# 查询2 -select a.spu_id,b.sku_id,b.sku_name,b.sku_price,b.sku_add -from spu a,sku b,attributes c,attributes_values d,rele e -where - a.spu_id = b.spu_id - and b.sku_id = e.sku_id - and c.attributes_id = e.attributes_id - and d.values_id = e.values_id -and b.sku_id = -( -select aa.sku_id from -(select sku_id from attributes, attributes_values , rele where attributes.attributes_id =rele.attributes_id and attributes_values.values_id = rele.values_id and values_test = "黑猪" ) aa -, -(select sku_id from attributes, attributes_values , rele where attributes.attributes_id =rele.attributes_id and attributes_values.values_id = rele.values_id and values_test = "200g" ) bb -, -(select sku_id from attributes, attributes_values , rele where attributes.attributes_id =rele.attributes_id and attributes_values.values_id = rele.values_id and values_test = "1包" ) cc -where aa.sku_id = bb.sku_id -and bb.sku_id = cc.sku_id -); - -``` - -![image-20230924163547326](https://s2.loli.net/2023/09/24/Z2dPCAgzaEhxJ9D.png) - -![image-20230924163617602](https://s2.loli.net/2023/09/24/skBJgn37QxUcXWV.png) - -![image-20230924163634393](https://s2.loli.net/2023/09/24/YIxF2dmAqj751Zl.png) -~~~ \ No newline at end of file diff --git "a/13 \350\224\241\345\230\211\344\271\220/0927\347\254\224\350\256\260.md" "b/13 \350\224\241\345\230\211\344\271\220/0927\347\254\224\350\256\260.md" deleted file mode 100644 index a046694b68a65e2a8289285f8820a17888ba29b1..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/0927\347\254\224\350\256\260.md" +++ /dev/null @@ -1,351 +0,0 @@ -### 笔记 - -#### 检查约束check - -意义:保证列中的值符合指定的条件 - -check(sex=“男”or sex=“女”) - -check(sex in (“男”,“女”)) - -check(age>=0 and age<=100) - -check(length(name)>=0 and length(name)<=6) - -注意:在utf8中,一个汉字就是一个字符,一个字符是3个字节 - -1Btye=8bit - -### 修改表 - -- 修改字段 - ALTER TABLE test.student MODIFY id_card varchar(30) 【约束】 - -- 修改表结构 - -- 添加字段 - -- 新增一个叫做id_card的字段,它的类型是可变字符串且非空。 - ALTER TABLE test.student ADD id_card varchar(18) NOT NULL; - -- 修改字段 - ALTER TABLE test.student MODIFY id_card varchar(30) - -- 修改字段名 - ALTER TABLE test.student CHANGE id_card id_card1 char(10) not null; - -- 删除字段 - ALTER TABLE test.student DROP id_card1; - -- 修改表名 - ALTER TABLE test.student RENAME test.stu; - - ### 视图 - - --视图是一种虚拟表,本身不具有数据,占用内存空间很少 - - --视图建立在已有表的基础上,视图赖以建立的这些表称为基表 - - --视图的优点:1.操作简单 2.减少数据冗余 3.数据安全 4.适应灵活多变的需求 - - ``` - -- 创建视图 - create view 视图名称 as - create view 名称(1,2,3,4) as (小括号内字段个数与select中字段个数相同) - -- 查看视图 - show create view 视图名称; - -- 修改视图 - 1. create or replace view 名称 as (有就更新,没有就创建) - 2. alter view 名称 as (要存在才能修改) - -- 删除视图 - drop view (if exists) 视图名称 - ``` - - - -```mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -create view employee_vu as -select last_name 姓名,employee_id 员工号,department_id 部门号 from employees; - - -#2. 显示视图的结构 -show create view employee_vu; - -#3. 查询视图中的全部内容 -select * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -select * from employee_vu where 部门号 = 80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -create view emp_v1(员工姓名,工资,邮箱) as -select last_name,salary,email from employees where phone_number like "011%"; - - -select * from emp_v1; -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - -alter view emp_v1 as -select last_name 姓名,email 邮箱,phone_number 电话号码,salary 工资 from employees where phone_number like "011%" and email like "%e%"; - -select * from emp_v1; -#3. 向 emp_v1 插入一条记录,是否可以? - --- 可以 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 - -update emp_v1 set 工资 = 工资 + 1000; - -#5. 删除emp_v1中姓名为Olsen的员工 - -delete from emp_v1 where 姓名 = "Olsen"; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -create view emp_v2 as -select b.department_id 部门id,max(a.salary) 最高工资 from employees a,departments b where a.department_id = b.department_id and salary > 12000 group BY b.department_id; - -select * from emp_v2; -#7. 向 emp_v2 中插入一条记录,是否可以? - -insert into emp_v2 values (60,66666); - --- 不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 - -drop view emp_v2,emp_v1; -``` \ No newline at end of file diff --git "a/13 \350\224\241\345\230\211\344\271\220/20230907\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\224\350\256\260.md" "b/13 \350\224\241\345\230\211\344\271\220/20230907\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\224\350\256\260.md" deleted file mode 100644 index 151fced5eaea60df6e7488421aa27135975bfb58..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/20230907\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\224\350\256\260.md" +++ /dev/null @@ -1,9 +0,0 @@ -### 数据库高级笔记0907 - -数据库的范式 - -1.第一范式 要求字段内容,不可再分割,为保证数据的原子性(定死不麻烦) - -2.第二范式 要求在满足第一范式的基础上,要求非主键要完成依赖主键(非主键,要依赖整个联合主键),而不能依赖部分。 - -3.第三范式 要求满足第二范式的前提上,要iu非主键要直接依赖主键 \ No newline at end of file diff --git "a/13 \350\224\241\345\230\211\344\271\220/20230908\347\254\224\350\256\260\344\275\234\344\270\232.md" "b/13 \350\224\241\345\230\211\344\271\220/20230908\347\254\224\350\256\260\344\275\234\344\270\232.md" deleted file mode 100644 index 37f55b059e3bd65feb7e4b8d953190e8734f691d..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/20230908\347\254\224\350\256\260\344\275\234\344\270\232.md" +++ /dev/null @@ -1,101 +0,0 @@ -### 数据库高级 - -## 笔记 - -## 操作步骤 - -1.创建概念模型(E-R图) CDM - -2.转换成逻辑模型 LDM - -3.转换成物理模型 PDM - -4.生成DDL - -### 作业 - -```mysql -CREATE DATABASE test22 charset utf8; -use test22; - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 10:13:52 */ -/*==============================================================*/ - - -drop table if exists bookrent; - -drop table if exists bookreturn; - -drop table if exists bookse; - -drop table if exists uesr; - -/*==============================================================*/ -/* Table: bookrent */ -/*==============================================================*/ -create table bookrent -( - rent_id numeric(10,0) not null, - book_id int, - rent_date date not null, - book_odate date not null, - primary key (rent_id) -); - -/*==============================================================*/ -/* Table: bookreturn */ -/*==============================================================*/ -create table bookreturn -( - re_id numeric(10,0) not null, - book_id int, - re_date date not null, - primary key (re_id) -); - -/*==============================================================*/ -/* Table: "bookse-+" */ -/*==============================================================*/ -create table bookse -( - book_id int not null auto_increment, - user_id numeric(10,0) not null, - book_name char(5) not null, - book_bname char(10) not null, - book_number numeric(30,0) not null, - floor numeric(10,0) not null, - price int not null, - book_bid char(65) not null, - primary key (book_id) -); - -/*==============================================================*/ -/* Table: uesr */ -/*==============================================================*/ -create table uesr -( - user_id numeric(10,0) not null, - re_id numeric(30,0), - user_name char(10) not null, - password numeric(10,0) not null, - primary key (user_id) -); - -alter table bookrent add constraint FK_Relationship_2 foreign key (book_id) - references bookse (book_id) on delete restrict on update restrict; - -alter table bookreturn add constraint FK_Relationship_5 foreign key (book_id) - references bookse (book_id) on delete restrict on update restrict; - -alter table bookse add constraint FK_rent foreign key (user_id) - references uesr (user_id) on delete restrict on update restrict; - -alter table uesr add constraint FK_Relationship_4 foreign key (re_id) - references bookreturn (re_id) on delete restrict on update restrict; -``` - - - diff --git "a/13 \350\224\241\345\230\211\344\271\220/9.21\347\254\224\350\256\260.md" "b/13 \350\224\241\345\230\211\344\271\220/9.21\347\254\224\350\256\260.md" deleted file mode 100644 index d6d0247243f3894741823993781798575512340e..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/9.21\347\254\224\350\256\260.md" +++ /dev/null @@ -1,174 +0,0 @@ -### 笔记 - -SKU: 英文全称为Stock Keeping Unit,简称SKU,是产品入库后一种编码归类方法,也是库存控制的最小单位。库存进出计量的单位, 可以是以件、盒、托盘等为单位。在服装、鞋类商品中使用最多最普遍。 例如纺织品中一个SKU通常表示:规格、颜色、款式。 - -SPU: 是商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个产品的特性。通俗点讲,属性值、特性相同的商品就可以称为一个SPU。 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : fad - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : db7 - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 21/09/2023 17:17:12 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for attribute --- ---------------------------- -DROP TABLE IF EXISTS `attribute`; -CREATE TABLE `attribute` ( - `attribute_id` int NOT NULL AUTO_INCREMENT, - `attribute_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`attribute_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of attribute --- ---------------------------- -INSERT INTO `attribute` VALUES (1, '颜色'); -INSERT INTO `attribute` VALUES (2, '内存'); - --- ---------------------------- --- Table structure for attribute_value --- ---------------------------- -DROP TABLE IF EXISTS `attribute_value`; -CREATE TABLE `attribute_value` ( - `relve` int NOT NULL AUTO_INCREMENT, - `sku_id` int NOT NULL, - `attribute_id` int NOT NULL, - `value_id` int NOT NULL, - PRIMARY KEY (`relve`) USING BTREE, - INDEX `FK_Relationship_2`(`sku_id` ASC) USING BTREE, - INDEX `FK_Relationship_3`(`attribute_id` ASC) USING BTREE, - INDEX `FK_Relationship_4`(`value_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`sku_id`) REFERENCES `sku` (`sku_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`attribute_id`) REFERENCES `attribute` (`attribute_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`value_id`) REFERENCES `value` (`value_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of attribute_value --- ---------------------------- -INSERT INTO `attribute_value` VALUES (1, 1, 1, 1); -INSERT INTO `attribute_value` VALUES (2, 1, 2, 5); -INSERT INTO `attribute_value` VALUES (3, 2, 1, 2); -INSERT INTO `attribute_value` VALUES (4, 2, 2, 5); -INSERT INTO `attribute_value` VALUES (6, 3, 1, 4); -INSERT INTO `attribute_value` VALUES (7, 3, 2, 5); -INSERT INTO `attribute_value` VALUES (8, 4, 1, 3); -INSERT INTO `attribute_value` VALUES (9, 4, 2, 5); -INSERT INTO `attribute_value` VALUES (10, 5, 1, 1); -INSERT INTO `attribute_value` VALUES (11, 5, 2, 6); -INSERT INTO `attribute_value` VALUES (12, 6, 1, 2); -INSERT INTO `attribute_value` VALUES (13, 6, 2, 6); -INSERT INTO `attribute_value` VALUES (14, 7, 1, 4); -INSERT INTO `attribute_value` VALUES (15, 7, 2, 6); -INSERT INTO `attribute_value` VALUES (16, 8, 1, 3); -INSERT INTO `attribute_value` VALUES (19, 8, 2, 6); - --- ---------------------------- --- Table structure for sku --- ---------------------------- -DROP TABLE IF EXISTS `sku`; -CREATE TABLE `sku` ( - `sku_id` int NOT NULL AUTO_INCREMENT, - `stu_id` int NOT NULL, - `sku_tlite` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `sku_price` decimal(7, 2) NOT NULL, - `sku_inventory` int NOT NULL, - PRIMARY KEY (`sku_id`) USING BTREE, - INDEX `FK_stu_sku`(`stu_id` ASC) USING BTREE, - CONSTRAINT `FK_stu_sku` FOREIGN KEY (`stu_id`) REFERENCES `stu` (`stu_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of sku --- ---------------------------- -INSERT INTO `sku` VALUES (1, 1, '华为mate60pro 雅丹黑 256G', 6499.00, 10); -INSERT INTO `sku` VALUES (2, 1, '华为Mate 60 pro 青 256G ', 6499.00, 5); -INSERT INTO `sku` VALUES (3, 1, '华为Mate 60 pro 白沙银 256G', 6499.00, 9); -INSERT INTO `sku` VALUES (4, 1, '华为 Mate 60 pro 紫 256G', 6499.00, 10); -INSERT INTO `sku` VALUES (5, 1, '华为 Mate 60 pro 雅丹黑 512G', 7499.00, 0); -INSERT INTO `sku` VALUES (6, 1, '华为 Mate 60 pro 青 512G', 7499.00, 5); -INSERT INTO `sku` VALUES (7, 1, '华为 Mate 60 pro 白沙银 512G', 7499.00, 6); -INSERT INTO `sku` VALUES (8, 1, '华为 Mate 60 pro 紫 512G', 7499.00, 8); - --- ---------------------------- --- Table structure for stu --- ---------------------------- -DROP TABLE IF EXISTS `stu`; -CREATE TABLE `stu` ( - `stu_id` int NOT NULL AUTO_INCREMENT, - `stu_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `stu_details` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`stu_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of stu --- ---------------------------- -INSERT INTO `stu` VALUES (1, '华为mete60pro', '遥遥领先'); -INSERT INTO `stu` VALUES (2, '小米MIXFold X3', '小米龙骨转轴创新结构,'); - --- ---------------------------- --- Table structure for value --- ---------------------------- -DROP TABLE IF EXISTS `value`; -CREATE TABLE `value` ( - `value_id` int NOT NULL AUTO_INCREMENT, - `value_v` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`value_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of value --- ---------------------------- -INSERT INTO `value` VALUES (1, '雅丹黑'); -INSERT INTO `value` VALUES (2, '青'); -INSERT INTO `value` VALUES (3, '紫'); -INSERT INTO `value` VALUES (4, '流沙银'); -INSERT INTO `value` VALUES (5, '256G'); -INSERT INTO `value` VALUES (6, '512G'); -INSERT INTO `value` VALUES (7, '1TB'); - -SET FOREIGN_KEY_CHECKS = 1; - -~~~ - -~~~mysql -SELECT - s.sku_id,s.sku_tlite,s.sku_price,attribute_name,value_v,st.stu_details -FROM -sku s, -stu st, -`value` v, -attribute att, -attribute_value attr -WHERE -s.sku_id=st.stu_id -AND -attr.attribute_id=att.attribute_id -AND -attr.sku_id = s.sku_id -AND -attr.value_id = v.value_id -AND -s.sku_id=(SELECT attr.sku_id FROM (SELECT sku_id,value_v FROM attribute_value av,`value` v WHERE av.value_id=v.value_id AND value_v='雅丹黑') AS a, -(SELECT sku_id,value_v FROM attribute_value av,`value` v WHERE av.value_id=v.value_id -AND v.value_v ='256G') as b -WHERE -a.sku_id = b.sku_id); -``` - diff --git "a/13 \350\224\241\345\230\211\344\271\220/9.5\347\254\254\344\270\200\350\212\202\350\257\276md.md" "b/13 \350\224\241\345\230\211\344\271\220/9.5\347\254\254\344\270\200\350\212\202\350\257\276md.md" deleted file mode 100644 index 89ef0075aa129a884947e91cbfc9300b4c4b9449..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/9.5\347\254\254\344\270\200\350\212\202\350\257\276md.md" +++ /dev/null @@ -1,6 +0,0 @@ -通过第一节课我发现虽然课程上了但不敢马虎 以为明年就要出去找工作了 在发现自己的技术根本在外面找不到工作。 - -在上课时间有时候应为走神导致上半那学期成绩飘忽不定, - -上完第一节课侯已经知道自己的不足 现在已经在及时补救 - diff --git "a/13 \350\224\241\345\230\211\344\271\220/9.6\347\254\254\344\272\214\350\212\202\350\257\276.md" "b/13 \350\224\241\345\230\211\344\271\220/9.6\347\254\254\344\272\214\350\212\202\350\257\276.md" deleted file mode 100644 index 7dfa19ef50be01434c886a0bd4e444adacfa22d1..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/9.6\347\254\254\344\272\214\350\212\202\350\257\276.md" +++ /dev/null @@ -1,14 +0,0 @@ -### 数据库高级 - -1 表与表之间的关系有 1对多 多对多 1对1 (三个) - -一对一:就是将其所在表的主键,放到另一个表但外键 - -多对多:必须有第三张表,将前面两个表的主键放进来当外键 - -1对多:将所在表的主键,放到另一个表当外键 - -#### E-R图 - -要素分为 实体(表),属性(字段),关系(外键约束) - diff --git "a/13 \350\224\241\345\230\211\344\271\220/9\346\234\21019\344\275\234\344\270\232.md" "b/13 \350\224\241\345\230\211\344\271\220/9\346\234\21019\344\275\234\344\270\232.md" deleted file mode 100644 index 5a028751190e9a034d945a28ca3d41f543cea253..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/9\346\234\21019\344\275\234\344\270\232.md" +++ /dev/null @@ -1,816 +0,0 @@ -### 笔记 - -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不是null,就保持原值 - -limit 起始数,显示数 - -desc 库名:显示表结构 - -length(email):email的字节长度 - -#### 自然连接 - -表,表 where 字段=字段 and 字段=字段 - -#### 联表区间 - -表 left join 表 on 表.字段 between 表.字段 and 表.字段(不支持别名) - -#### 自连接 - -inner join - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ -create database company_information character set utf8; -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -select sum(salary* 12) 工资总和 from employees; - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -select sum(salary*(1+IFNULL(commission_pct,0))*12) 工资和奖金和 from employees; -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct -select distinct job_id from employees; - - -# 3.查询工资大于12000的员工姓名和工资 -select first_name,salary from employees where salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 - -select first_name, department_id from employees where employee_id=176; -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -select first_name,salary from employees where salary not between 5000 and 12000; - - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select * from employees where department_id between 20 and 50; -# 3.选择公司中没有管理者的员工姓名及job_id -select * from employees where ISNULL(manager_id); - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -select first_name ,salary*commission_pct , grade_level from employees -join job_grades -where salary*commission_pct between lowest_sal and highest_sal and commission_pct IS not NULL; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 -select last_name from employees where last_name like '__尔' -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -select last_name from employees where last_name like '%特%' and last_name like '%尔%' - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -select * from employees where first_name like '%尔' - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -select last_name , job_id from employees where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -select last_name,salary,manager_id from employees where manager_id in (100,101,110); - - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 -select last_name,department_id,salary*12 from employees ORDER BY salary desc; --- order by 年薪 asc/desc - -# - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select last_name,salary from employees where salary not between 8000 and 17000 ORDER BY salary desc LIMIT 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select * from employees where email like '%e%' ORDER BY length(email) desc ,department_id ; - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -select last_name,e1.department_id ,department_name from employees e1 join departments d1 on e1.department_id=d1.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id -select e1.job_id,location_id from employees e1 -join departments d1 on e1.department_id=e1.department_id -where d1.department_id=90 GROUP BY job_id; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select last_name , d1.department_name , l1.location_id , city from employees e1 -join departments d1 on e1.department_id=d1.department_id -join locations l1 on l1.location_id=d1.location_id -where commission_pct is not null ; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -select last_name , job_id , d1.department_id , department_name -from employees e1 -join departments d1 on e1.department_id=d1.department_id -join locations l1 on l1.location_id=d1.location_id -where city ='多伦多' ; - - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 -select department_name,street_address,last_name,job_title ,salary from departments d1 , employees e1 ,locations l1 ,jobs j1 where d1.department_id=e1.department_id and d1.location_id=l1.location_id and j1.job_id=e1.job_id and department_name='行政部' - - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select e1.last_name,e1.employee_id,e2.last_name,e2.manager_id from employees e1 join employees e2 on e1.employee_id=e2.manager_id; - -select e1.last_name,e1.employee_id,e2.last_name,e2.manager_id from employees e1 ,employees e2 where e1.employee_id=e2.manager_id; - -# 7.查询哪些部门没有员工 - -select department_name from employees e1 right join departments d1 on e1.department_id=d1.department_id where employee_id is null ; -# 8. 查询哪个城市没有部门 -select city from departments d1 right join locations l1 on d1.location_id=l1.location_id where department_name is null; -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -select * from departments d1 join employees e1 on d1.department_id=e1.department_id where department_name='销售部' or department_name='信息技术部' - - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary),min(salary),avg(salary),sum(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -select job_id, max(salary),min(salary),avg(salary),sum(salary) from employees GROUP BY job_id; - -#4.选择各个job_id的员工人数 -select job_id ,count(employee_id)from employees GROUP BY job_id; -# 5.查询员工最高工资和最低工资的差距 -select max(salary)-min(salary) from employees; - - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - - select manager_id,min(salary) from employees where salary>6000 and manager_id is not null group by manager_id - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 -select department_name,location_id ,COUNT(employee_id),avg(salary)from departments d1 , employees e1 where d1.department_id=e1.department_id group by department_name,location_id order by avg(salary) desc; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select department_name, job_title,min_salary from departments d1 -join employees e1 on d1.department_id=e1.department_id -join jobs j1 on j1.job_id=e1.job_id ; -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -select last_name , salary from employees where department_id = -(select e1.department_id from employees e1 join departments d1 on e1.department_id=d1.department_id where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -select employee_id ,last_name,salary from employees where salary >(select avg(salary) from employees ); - - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name, job_id, salary from employees where employee_id in -(select employee_id from employees where salary = -(select max(salary) from employees where job_id='sa_man')); - - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - - -select employee_id,last_name from employees where department_id in (select DISTINCT department_id from employees where email like '%u%') ORDER BY department_id; - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -select employee_id from employees where department_id in (select department_id from departments where location_id=1700); - -#6.查询管理者是 金 的员工姓名和工资 -SELECT last_name, salaryFROM employees WHERE manager_id IN (SELECT employee_id FROM employees WHERE last_name = '金'); - -#7.查询工资最低的员工信息: last_name, salary -select last_name,salary from employees where salary =(select min(salary) from employees ) -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 - --- A: -SELECT d.department_id, d.department_name, AVG(e.salary) AS average_salary -FROM departments d -JOIN employees e ON d.department_id = e.department_id -GROUP BY d.department_id, d.department_name -ORDER BY average_salary -LIMIT 1; - - - --- B: -select * from departments d1 where d1.department_id=( -SELECT d.department_id -FROM departments d -JOIN employees e ON d.department_id = e.department_id -GROUP BY d.department_id -HAVING AVG(e.salary) = (SELECT MIN(avg_salary) -FROM (SELECT AVG(salary) AS avg_salary -FROM employees -GROUP BY department_id) AS temp)); - -#方式2: -# 部门平均<= 公司所有平均 - - - - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -SELECT * -FROM departments d1 -JOIN ( - SELECT AVG(salary) avg_salary, department_id - FROM employees - WHERE department_id IS NOT NULL - GROUP BY department_id -) a ON d1.department_id = a.department_id -WHERE a.department_id = ( - SELECT department_id - FROM ( - SELECT AVG(salary) avg_salary, department_id - FROM employees - WHERE department_id IS NOT NULL - GROUP BY department_id - ) b - WHERE avg_salary = ( - SELECT MIN(avg_salary) min_avg - FROM ( - SELECT AVG(salary) avg_salary, department_id - FROM employees - WHERE department_id IS NOT NULL - GROUP BY department_id - ) AS c - ) -); - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - - - - -#11.查询平均工资高于公司平均工资的部门有哪些? - - - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 -select * from employees e1 join employees e2 on e1.employee_id=e2.manager_id; - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - - - -#方式: - - - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - - - - - -#16. 选择所有没有管理者的员工的last_name -select last_name from employees where manager_id is null; - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: -SELECT e1.employee_id, e1.first_name, e1.hire_date, e1.salary -FROM departments d1 -JOIN employees e1 ON d1.department_id = e1.department_id -WHERE e1.manager_id IN (SELECT employee_id FROM employees e2 WHERE e2.last_name = '格林伯格'); -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 -``` - - - diff --git "a/13 \350\224\241\345\230\211\344\271\220/b9f15c44a08aadf90bd62e92666ccdd.png" "b/13 \350\224\241\345\230\211\344\271\220/b9f15c44a08aadf90bd62e92666ccdd.png" deleted file mode 100644 index a6e4f558b0374bb6f0ca66bf1d2df34b2b52b72e..0000000000000000000000000000000000000000 Binary files "a/13 \350\224\241\345\230\211\344\271\220/b9f15c44a08aadf90bd62e92666ccdd.png" and /dev/null differ diff --git "a/13 \350\224\241\345\230\211\344\271\220/crebas.sql" "b/13 \350\224\241\345\230\211\344\271\220/crebas.sql" deleted file mode 100644 index 5df4bd8bcc9ff80fd8dfedadda72d027a9cd55f4..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/crebas.sql" +++ /dev/null @@ -1,143 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 21:48:22 */ -/*==============================================================*/ - - -drop table if exists actor; - -drop table if exists actor2; - -drop table if exists comment; - -drop table if exists director; - -drop table if exists movie; - -drop table if exists score; - -drop table if exists scriptwriter; - -drop table if exists user; - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create database movie charset utf8; -use movie; -create table actor -( - actor_id int not null, - actor_name varchar(10) not null, - actor_english varchar(10) not null, - actor_sex varchar(100) not null, - "actor_head portrait" longblob not null, - primary key (actor_id) -); - -/*==============================================================*/ -/* Table: actor2 */ -/*==============================================================*/ -create table actor2 -( - actor_id int not null, - movie_id int not null, - primary key (actor_id, movie_id) -); - -/*==============================================================*/ -/* Table: comment */ -/*==============================================================*/ -create table comment -( - user_id int not null, - movie_id int not null, - primary key (user_id, movie_id) -); - -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - actor_id int not null, - movie_id int not null, - primary key (actor_id, movie_id) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_id int not null auto_increment, - movie_name varchar(100) not null, - "release" date not null, - alias varchar(100) not null, - introduction varchar(100) not null, - primary key (movie_id) -); - -/*==============================================================*/ -/* Table: score */ -/*==============================================================*/ -create table score -( - movie_id int not null, - user_id int not null, - primary key (movie_id, user_id) -); - -/*==============================================================*/ -/* Table: scriptwriter */ -/*==============================================================*/ -create table scriptwriter -( - actor_id int not null, - movie_id int not null, - primary key (actor_id, movie_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null, - user_account int not null, - user_power int not null, - "actor_head portrait" longblob not null, - user_sex varchar(100) not null, - primary key (user_id) -); - -alter table actor2 add constraint FK_actor foreign key (actor_id) - references actor (actor_id) on delete restrict on update restrict; - -alter table actor2 add constraint FK_actor2 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table comment add constraint FK_comment foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table comment add constraint FK_comment2 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table director add constraint FK_director foreign key (actor_id) - references actor (actor_id) on delete restrict on update restrict; - -alter table director add constraint FK_director2 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table score add constraint FK_score foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table score add constraint FK_score2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter foreign key (actor_id) - references actor (actor_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter2 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - diff --git "a/13 \350\224\241\345\230\211\344\271\220/hosp.sql" "b/13 \350\224\241\345\230\211\344\271\220/hosp.sql" deleted file mode 100644 index 6a0305cede5c45663c3f7d426783fd4fa7f27145..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/hosp.sql" +++ /dev/null @@ -1,76 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 11:18:54 */ -/*==============================================================*/ - -create database hospital charset utf8; - -use hospital; -drop table if exists Doctor; - -drop table if exists "administrative office"; - -drop table if exists "inpatient ward"; - -drop table if exists sick; - -/*==============================================================*/ -/* Table: Doctor */ -/*==============================================================*/ -create table Doctor -( - Doctor_id int not null auto_increment, - "administrative office_id" int not null, - Doctor_name varchar(10) not null, - Doctor_age int not null, - primary key (Doctor_id) -); - -/*==============================================================*/ -/* Table: "administrative office" */ -/*==============================================================*/ -create table "administrative office" -( - "administrative office_id" int not null auto_increment, - "administrative office_name" varchar(10) not null, - "administrative office_address" varchar(20) not null, - "administrative office_number" int not null, - primary key ("administrative office_id") -); - -/*==============================================================*/ -/* Table: "inpatient ward" */ -/*==============================================================*/ -create table "inpatient ward" -( - "inpatient ward_id" int not null auto_increment, - "administrative office_id" int not null, - "inpatient ward_name" varchar(10) not null, - primary key ("inpatient ward_id") -); - -/*==============================================================*/ -/* Table: sick */ -/*==============================================================*/ -create table sick -( - sick_id int not null auto_increment, - "inpatient ward_id" int not null, - Doctor_id int not null, - sick_name varchar(10) not null, - sick_sex varchar(5) not null, - primary key (sick_id) -); - -alter table Doctor add constraint FK_subordination foreign key ("administrative office_id") - references "administrative office" ("administrative office_id") on delete restrict on update restrict; - -alter table "inpatient ward" add constraint FK_Composition foreign key ("administrative office_id") - references "administrative office" ("administrative office_id") on delete restrict on update restrict; - -alter table sick add constraint FK_Check foreign key ("inpatient ward_id") - references "inpatient ward" ("inpatient ward_id") on delete restrict on update restrict; - -alter table sick add constraint FK_cure foreign key (Doctor_id) - references Doctor (Doctor_id) on delete restrict on update restrict; - diff --git "a/13 \350\224\241\345\230\211\344\271\220/\346\261\275\350\275\246\351\224\200\345\224\256\347\263\273\347\273\237.md" "b/13 \350\224\241\345\230\211\344\271\220/\346\261\275\350\275\246\351\224\200\345\224\256\347\263\273\347\273\237.md" deleted file mode 100644 index 4fc119521050006a08c9132d96b9e9fbce8f108d..0000000000000000000000000000000000000000 --- "a/13 \350\224\241\345\230\211\344\271\220/\346\261\275\350\275\246\351\224\200\345\224\256\347\263\273\347\273\237.md" +++ /dev/null @@ -1,116 +0,0 @@ -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/17 18:54:22 */ -/*==============================================================*/ -create database car01 charset utf8; -use car01; - -drop table if exists car; - -drop table if exists customer; - -drop table if exists salesman; - -drop table if exists salesman_car_sale; - -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - customer_id varchar(5) not null, - customer_name varchar(4) not null, - customer_gender varchar(2) not null, - customer_tel varchar(11) not null, - customer_buy varchar(11) , - primary key (customer_id) -); - -insert into customer values - ('Cus01','小红','女','19023','买过一辆凯迪拉克'), - ('Cus02','小花','女','15436','买过一辆雷克萨斯'), - ('Cus03','小草','男','14457','买过两辆大众'), - ('Cus04','小树','男','19755','买过一辆BMW'); - - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id varchar(5) not null, - customer_id varchar(5), - car_name varchar(5) not null, - car_model varchar(5) not null, - car_price varchar(10) not null, - primary key (car_id) -); - -insert into car values - ('Car01','Cus01','奔驰','大G','99w'), - ('Car02','Cus02','保时捷','帕拉梅拉','90w'), - ('Car03','Cus03','丰田','AE86','40w'), - ('Car04','Cus04','奥迪','A6','10w'); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id varchar(5) not null, - salesman_name varchar(4) not null, - salesman_gender char(2) not null, - salesman_tel varchar(11) not null, - primary key (salesman_id) -); -insert into salesman values - ('Sal01','张三','男','128943'), - ('Sal02','李四','女','128393'), - ('Sal03','王五','男','190894'), - ('Sal04','李杰','男','199283'); - -/*==============================================================*/ -/* Table: salesman_car_sale */ -/*==============================================================*/ -create table salesman_car_sale -( - car_id varchar(5) not null, - salesman_id varchar(5) not null, - sale_date date not null, - sale_price varchar(10) not null, - sale_number varchar(10) not null, - primary key (car_id, salesman_id) -); -insert into salesman_car_sale values - ('Car01','Sal01','2023-08-11','80w','3辆'), - ('Car02','Sal02','2022-10-28','60w','2辆'), - ('Car03','Sal03','2022-09-01','20w','8辆'), - ('Car04','Sal04','2023-11-03','20w','5辆'); - -alter table car add constraint FK_customer_car_buy foreign key (customer_id) - references customer (customer_id) on delete restrict on update restrict; - -alter table salesman_car_sale add constraint FK_salesman_car_sale foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table salesman_car_sale add constraint FK_salesman_car_sale2 foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - --- 1.查询特定销售员的销售记录 -select salesman_name,sale_number from salesman_car_sale a left join salesman s on a.salesman_id = s.salesman_id; --- 2.查找销售记录中销售价格最高的汽车 -select max(sale_price) from salesman_car_sale; --- 3.统计某个销售员的销售总额 -select sum(sale_number) from salesman_car_sale a left join salesman s on a.salesman_id = s.salesman_id where salesman_name = '李杰'; --- 4.根据客户信息查询其购买过的汽车 -select customer_name,customer_buy from customer; --- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 --- 6.检索特定日期范围内的销售了哪些汽车 -select car_name from salesman_car_sale a left join car c on a.salesman_id = c.car_id where sale_date between 2022-09-01 and 2023-08-11; --- 7.查找某车型的销售历史。 --- 8.统计每个销售员的销售数量 -select salesman_name,sale_number from salesman s left join salesman_car_sale a on s.salesman_id = a.salesman_id; -``` - -] \ No newline at end of file diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230905 \345\244\247\344\272\214\345\255\246\344\271\240\347\233\256\346\240\207.md" "b/14 \346\235\216\344\277\212\345\205\264/20230905 \345\244\247\344\272\214\345\255\246\344\271\240\347\233\256\346\240\207.md" deleted file mode 100644 index 21d1fba8ff65fc151d5eef9cbf3def8f017114e8..0000000000000000000000000000000000000000 --- "a/14 \346\235\216\344\277\212\345\205\264/20230905 \345\244\247\344\272\214\345\255\246\344\271\240\347\233\256\346\240\207.md" +++ /dev/null @@ -1,32 +0,0 @@ -### 大二学习目标 - -大二更加讲究实际应用也就是实操,难度会比大一更加困难 - -大一更多的是理论 - -##### 大二上学期 学习目标 - -1. 数据库高级 (MySQL) -2. JavaScript (Ajax) -3. MVC 框架 (Maven,spring,springMvc,Mybatis)java经典框架 俗称SSM - -##### 大二下学期 学习目标 - -1. node.js -2. vue.js 简化开发 有UI框架配合 -3. springboot (Redis,webAPI) - -node.js 和 vue.js 属于前端 - -##### 实训 - -1. Linux 服务器: Nginx,MongoDB -2. 项目中可能实现的技术: 中间件、鉴别权限 -3. 如果时间允许 小程序 - -**技术栈:** - 一个项目具体要求用什么技术实现,可以称为技术选型 也就是选方案 - -**技能树** - 我们所拥有的技能,可以称之为技能树 - diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230906 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\200\350\212\202\350\257\276 E-R\345\233\276.md" "b/14 \346\235\216\344\277\212\345\205\264/20230906 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\200\350\212\202\350\257\276 E-R\345\233\276.md" deleted file mode 100644 index 63bf7585695ed0d80ffbadd6e715b0dfdfc3c0c2..0000000000000000000000000000000000000000 --- "a/14 \346\235\216\344\277\212\345\205\264/20230906 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\200\350\212\202\350\257\276 E-R\345\233\276.md" +++ /dev/null @@ -1,148 +0,0 @@ -### 数据库高级(0907) - -主要讲了数据库设计的前菜的前菜 数据库设计 - -**数据库设计** - -又分为六个阶段 - -1. 需求分析 -2. 概念结构设计 -3. 逻辑结构设计 -4. 物理结构设计 -5. 数据库实施 -6. 数据库运行和维护 - -需求分析和概念结构设计独立于任何数据库管理系统,逻辑结构设计和物理结构设计与选用的数据库管理系统密切相关。 - -#### E-R模型 - -描述概念模型的工具:E-R模型 - -**实体之间的联系** - -(1)两个实体型之间的联系 - -1. 一对一 - 将其中任一表主键,放到另一表当外键 - 如果对于实体集 A 中的每一个实体,实体集 B 中至多有一个(也可以没有)实体与之联系,反之亦然,则称实体集 A 与实体集 B 具有一对一联系,记为 1:1。 - 如:学校里一个班级只有一个正班长,而一个班长只在一个班中任职,则班级与班长之间具有一对一联系。 -2. 一对多 - 将一所在表的主键,放到多的表当外键 - 如果对于实体集 A 中的每一个实体,实体集 B 中有 n 个实体( n⩾0 )与之联系,反之,对于实体集 B 中的每一个实体,实体集 A 中至多只有一个实体与之联系,则称实体集 A 与实体集 B 有一对多联系,记为 1:n。 - 如: 一个班级中有若干名学生,而每个学生只在一个班级中学习,则班级与学生之间具有一对多联系。 -3. 多对多 - 必须有第三张表,作中转表,将前面两个表主键放进来当外键 - 如果对于实体集 A 中的每一个实体,实体集 B 中有 n 个实体(n⩾0 )与之联系,反之,对于实体集 B 中的每一个实体,实体集 A 中也有 m 个实体(m⩾0 )与之联系,则称实体集 A 与实体集 B 具有多对多联系,记为 m:n。 - 如:一门课程同时有若干个学生选修,而一个学生可以同时选修多门课程,则课程与学生之间具有多对多联系。 - -(2)两个及以上实体之间的关系 - -一般的来说,两个以上的实体之间也存在着一对一、一对多、多对多的联系 - -##### E-R图 - -​ E-R图 有三大要素:**实体、属性、关系** - -(1). 实体型:用矩形表示,矩形框内写明实体名 也可以通俗点理解MySQL当中的表 - -(2). 属性:用椭圆形表示,并用无向变将其与相应的实体型连接起来 可以理解成MySQL表当中的字段 - -(3). 联系用菱形表示,菱形框内写明联系名,用无向边分别与有关实体型连接起来,同时在无向边旁标上联系的类型(1:1、1:n 或 m:n)。 类似于外键约束 - -E-R图 : - -​ ![image-20230907093523576](D:\库\数据库高级\database-advanced\14 李俊兴\image-20230907093523576.png) - -~~~MySQL -CREATE DATABASE school CHARSET utf8; -use school; --- 院系表 -CREATE TABLE faculty( - d_id INT PRIMARY KEY, - d_name VARCHAR(255) -); -INSERT INTO faculty VALUES - (1,'软件工程学院'); --- 专业表 -CREATE TABLE specialty( - S_id int PRIMARY KEY, - S_name VARCHAR(255), - d_id int, - FOREIGN KEY (d_id) REFERENCES faculty(d_id) -); -INSERT INTO specialty VALUES - (1,'软件技术',1); --- 班级表 -CREATE TABLE class( - C_id INT PRIMARY KEY, - C_name VARCHAR(20), - grade VARCHAR(5), - s_id INT, - FOREIGN KEY (s_id) REFERENCES specialty(s_id) -); -INSERT INTO class VALUES - (1,'软件技术1班','22级',1), - (2,'软件技术2班','22级',1), - (3,'软件技术7班','22级',1), - (4,'软件技术9班','22级',1); --- 课程 -CREATE TABLE course( - couseId int PRIMARY key, - courseName varchar(10), - c_id int, - r_id int, - foreign key (c_id) references class(C_id), - foreign key (r_id) references classroom(r_id) -); -insert into course VALUES - (1,'Java',1,1), - (2,'MySQL',2,2); --- 教室 -create table classroom( - r_id int PRIMARY KEY, - r_name varchar(10) -); - insert into classroom values -(1,'实训一'), -(2,'实训二'); --- 课程表 -create table `select` ( - selectId int primary key, - couseId int, - time varchar(20), - t_id int, - r_id int, - foreign key (couseId) references course(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references classroom(r_id) -); -insert into `select` values -(1,1,'周一8:00-11:40',2,1), -(2,2,'周一14:00-17:40',1,2); --- 教师 -create table teacher( - t_id int primary key, - t_name varchar(10), - couseId int, - foreign key (couseId) references course(couseId) -); -insert into teacher values -(1,'丘丘',1), -(2,'黑马pink',2); --- 学生 -CREATE TABLE student ( - stu_name VARCHAR(25), - stu_id INT PRIMARY KEY, - C_id INT, - select_id INT, - foreign key (C_id) references class(C_id), - FOREIGN KEY (select_id) REFERENCES `select`(selectId) -); -INSERT INTO student VALUES - ('王影',17,1,1), - ('程舜',52,2,2), - ('李陈毅',49,3,1), - ('李文璐',22,4,1); -~~~ - diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" "b/14 \346\235\216\344\277\212\345\205\264/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" deleted file mode 100644 index b27ee4ac09d555e544aa637f1bff5c63848b8d05..0000000000000000000000000000000000000000 --- "a/14 \346\235\216\344\277\212\345\205\264/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" +++ /dev/null @@ -1,10 +0,0 @@ -### 数据库范式 - - 范式也是一种规则 - -1. 要求字段内容,不可再分割,为了保证数字原子性 -2. 在满足范式1 的要求基础上,要求非主键字段要完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 -3. 满足范式2 的基础上,非关键属性要直接依赖于主键不能出现传递依赖。 - -但是实际开发当中不会完全按照范式来设计,因为需求不同,所以有时会故意反范式 - diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230908 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/14 \346\235\216\344\277\212\345\205\264/20230908 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index 47ef49ac9522cace2d7270aa2b5300da9b45a507..0000000000000000000000000000000000000000 --- "a/14 \346\235\216\344\277\212\345\205\264/20230908 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,122 +0,0 @@ -### 结构 - -结构图分为: - -1. E-R图 -2. powerDesigner - -powerDesigner使用 - -1. 创建概念模型 类似于E-R图 以人的角度 -2. 转成逻辑模型 以计算机的角度 -3. 转换成物理模型 以数据库的角度 -4. 生成DDL语句 - -### 图书管理系统代码 - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 9:34:50 */ -/*==============================================================*/ -CREATE DATABASE take CHARSET utf8; -use take; -drop table if exists Admin; - -drop table if exists Borrowinfo; - -drop table if exists Readerinfo; - -drop table if exists book; - -drop table if exists limits; - -/*==============================================================*/ -/* Table: Admin */ -/*==============================================================*/ -create table Admin -( - A_id char(5) not null, - book_id char(10) not null, - Boor_id int not null, - A_name char(15) not null, - A_paw char(16), - A_tel char(11) not null, - primary key (A_id) -); - -/*==============================================================*/ -/* Table: Borrowinfo */ -/*==============================================================*/ -create table Borrowinfo -( - Boor_id int not null, - Reade_id char(10) not null, - book_id char(10) not null, - Rea_id char(10) not null, - Book_number char(10) not null, - Boor_time datetime not null, - due_time datetime not null, - return_time datetime not null, - state int not null, - admin_id char(10) not null, - primary key (Boor_id) -); - -/*==============================================================*/ -/* Table: Readerinfo */ -/*==============================================================*/ -create table Readerinfo -( - Reade_id char(10) not null, - Level char(10) not null, - name char(15) not null, - Reade_faculty char(10) not null, - Readejjtime timestamp not null, - primary key (Reade_id) -); - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - book_id char(10) not null, - title char(25) not null, - quantity int not null, - address varchar(25) not null, - author char(30) not null, - press char(30) not null, - time timestamp not null, - primary key (book_id) -); - -/*==============================================================*/ -/* Table: limits */ -/*==============================================================*/ -create table limits -( - Level char(10) not null, - MaxBookNum char(10) not null, - MaxDays char(10) not null, - primary key (Level) -); - -alter table Admin add constraint FK_admin foreign key (book_id) - references book (book_id) on delete restrict on update restrict; - -alter table Admin add constraint FK_regulate foreign key (Boor_id) - references Borrowinfo (Boor_id) on delete restrict on update restrict; - -alter table Borrowinfo add constraint FK_Borrowinfo foreign key (Reade_id) - references Readerinfo (Reade_id) on delete restrict on update restrict; - -alter table Borrowinfo add constraint FK_borrow foreign key (book_id) - references book (book_id) on delete restrict on update restrict; - -alter table Readerinfo add constraint FK_astrict foreign key (Level) - references limits (Level) on delete restrict on update restrict; - - -~~~ - diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230912 \347\224\265\345\275\261\346\236\266\346\236\204\345\233\276.md" "b/14 \346\235\216\344\277\212\345\205\264/20230912 \347\224\265\345\275\261\346\236\266\346\236\204\345\233\276.md" deleted file mode 100644 index a99c150257ff0274d11a7f728a1a0fad860cca35..0000000000000000000000000000000000000000 --- "a/14 \346\235\216\344\277\212\345\205\264/20230912 \347\224\265\345\275\261\346\236\266\346\236\204\345\233\276.md" +++ /dev/null @@ -1,191 +0,0 @@ -### 电影架构图 - -![图片1](https://s2.loli.net/2023/09/12/lA7GCrDE1m54pbo.png) - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 18:32:00 */ -/*==============================================================*/ -CREATE DATABASE movie_db CHARSET utf8; -use movie_db; - -drop table if exists director; - -drop table if exists film; - -drop table if exists language; - -drop table if exists movieInfo; - -drop table if exists participants; - -drop table if exists protagonist; - -drop table if exists region; - -drop table if exists score; - -drop table if exists scriptwriter; - -drop table if exists user; - -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - part_id char(10) not null, - movie_id char(8) not null, - primary key (part_id, movie_id) -); - -/*==============================================================*/ -/* Table: film */ -/*==============================================================*/ -create table film -( - film_id char(10) not null, - user_id char(10) not null, - film_name char(10) not null, - film_title char(10) not null, - text char(10) not null, - appraise char(10), - primary key (film_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - lang_id char(10) not null, - lang_name varchar(5), - primary key (lang_id) -); - -/*==============================================================*/ -/* Table: movieInfo */ -/*==============================================================*/ -create table movieInfo -( - movie_id char(8) not null, - film_id char(10) not null, - sc_id char(10) not null, - lang_id char(10) not null, - movie_name varchar(20) not null, - movie_time int not null, - type_id char(5) not null, - release_date datetime not null, - alias varchar(20) not null, - primary key (movie_id) -); - -/*==============================================================*/ -/* Table: participants */ -/*==============================================================*/ -create table participants -( - part_id char(10) not null, - name char(10) not null, - age int, - primary key (part_id) -); - -/*==============================================================*/ -/* Table: protagonist */ -/*==============================================================*/ -create table protagonist -( - part_id char(10) not null, - movie_id char(8) not null, - sex char(1) not null, - birthday varchar(15) not null, - `else` varchar(10), - profession char(30) not null, - address varchar(15), - primary key (part_id, movie_id) -); - -/*==============================================================*/ -/* Table: region */ -/*==============================================================*/ -create table region -( - reg_id char(10) not null, - movie_id char(8), - reg_name char(25) not null, - primary key (reg_id) -); - -/*==============================================================*/ -/* Table: score */ -/*==============================================================*/ -create table score -( - sc_id char(10) not null, - user_id char(10) not null, - grade char(10) not null, - primary key (sc_id) -); - -/*==============================================================*/ -/* Table: scriptwriter */ -/*==============================================================*/ -create table scriptwriter -( - part_id char(10) not null, - movie_id char(8) not null, - primary key (part_id, movie_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id char(10) not null, - user_name varchar(20) not null, - user_sex char(1) not null, - primary key (user_id) -); - -alter table director add constraint FK_director foreign key (part_id) - references participants (part_id) on delete restrict on update restrict; - -alter table director add constraint FK_director2 foreign key (movie_id) - references movieInfo (movie_id) on delete restrict on update restrict; - -alter table film add constraint FK_write foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table movieInfo add constraint FK_evaluate foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table movieInfo add constraint FK_mark foreign key (sc_id) - references score (sc_id) on delete restrict on update restrict; - -alter table movieInfo add constraint FK_select foreign key (lang_id) - references language (lang_id) on delete restrict on update restrict; - -alter table protagonist add constraint FK_protagonist foreign key (part_id) - references participants (part_id) on delete restrict on update restrict; - -alter table protagonist add constraint FK_protagonist2 foreign key (movie_id) - references movieInfo (movie_id) on delete restrict on update restrict; - -alter table region add constraint FK_publish foreign key (movie_id) - references movieInfo (movie_id) on delete restrict on update restrict; - -alter table score add constraint FK_comment foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter foreign key (part_id) - references participants (part_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter2 foreign key (movie_id) - references movieInfo (movie_id) on delete restrict on update restrict; - - -~~~ - diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230913 \345\214\273\351\231\242\347\256\241\347\220\206.md" "b/14 \346\235\216\344\277\212\345\205\264/20230913 \345\214\273\351\231\242\347\256\241\347\220\206.md" deleted file mode 100644 index e82f1c0a354391e75f6fa98c55ade39972db67e6..0000000000000000000000000000000000000000 --- "a/14 \346\235\216\344\277\212\345\205\264/20230913 \345\214\273\351\231\242\347\256\241\347\220\206.md" +++ /dev/null @@ -1,209 +0,0 @@ -### 分析 - -1医生:医生编号、姓名 、 地址、 联系、科室、年龄 、职位 - -处方:处方号、病人年龄、处方内容、主治医师、病人姓名、病人性别 - -科室:科室编号 、 科室名称 - -护士:护士编号、姓名、联系电话、 - -患者:姓名、年龄、联系电话、性别、医保号、家庭住址、职业 - -检查项目:检查序号、检查工序、检验内容、检查结果、检查收费情况、检查医师 - -病例单: 病历号、病人姓名、病例内容、诊断时间、主治医师 - -收费项目:收费项目编号、项目类型、收费金额、收费人员、病人姓名 - -药品:药品编号、药品名称,药品介绍、分类 - -#### 概念模型 - -![image-20230914084659961](https://s2.loli.net/2023/09/14/PVUsy5CbW6OY8Bp.png) - -#### 逻辑模型 - -![](https://s2.loli.net/2023/09/14/KYc4sSX1Wp38V6w.png) - -### DDL语句 - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 8:53:39 */ -/*==============================================================*/ - -CREATE DATABASE hospital CHARSET utf8; -use hospital; -drop table if exists detailed; - -drop table if exists doctor; - -drop table if exists dossier; - -drop table if exists medicine; - -drop table if exists nurse; - -drop table if exists patient; - -drop table if exists prescription; - -drop table if exists section; - -drop table if exists tariff; - -/*==============================================================*/ -/* Table: detailed */ -/*==============================================================*/ -create table detailed -( - detailed_id char(10) not null, - tariff_id char(11) not null, - pre_id char(10) not null, - detailed_deta char(10) not null, - primary key (detailed_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id char(10) not null, - doctor_name varchar(20) not null, - doctor_age int not null, - doctor_sex char(1) not null, - doctor_tel char(11) not null, - doctor_post varchar(10) not null, - doctor_address varchar(15), - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: dossier */ -/*==============================================================*/ -create table dossier -( - dossier_id char(12) not null, - doctor_id char(10) not null, - dossier_name varchar(8) not null, - dossier_content varchar(25) not null, - dossier_time varchar(15) not null, - dossier_doctor char(10) not null, - primary key (dossier_id) -); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - medicine_id char(10) not null, - pre_id char(10) not null, - medicine_name char(10) not null, - medicine_type char(10) not null, - medicine_introduce char(10) not null, - primary key (medicine_id) -); - -/*==============================================================*/ -/* Table: nurse */ -/*==============================================================*/ -create table nurse -( - nurse_id char(10) not null, - section_id char(10) not null, - nurse_name char(10) not null, - nurse_tel char(10) not null, - primary key (nurse_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id char(10) not null, - dossier_id char(12) not null, - patient_name varchar(10) not null, - patient_age int not null, - patient_sex char(1) not null, - patient_address varchar(12) not null, - patient_idnumber char(18) not null, - patient_post varchar(10), - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - pre_id char(10) not null, - doctor_id char(10) not null, - patient_id char(10) not null, - pra_content varchar(15) not null, - patient_name varchar(10) not null, - patient_sex char(1) not null, - patient_age int not null, - attending_doctor char(8) not null, - primary key (pre_id) -); - -/*==============================================================*/ -/* Table: section */ -/*==============================================================*/ -create table section -( - section_id char(10) not null, - doctor_id char(10), - section_name varchar(10) not null, - primary key (section_id) -); - -/*==============================================================*/ -/* Table: tariff */ -/*==============================================================*/ -create table tariff -( - tariff_id char(11) not null, - tariff_name varchar(5) not null, - tariff_project varchar(5) not null, - project_type varchar(10) not null, - tariff_money decimal(5,1) not null, - tariff_staff varchar(5) not null, - primary key (tariff_id) -); - -alter table detailed add constraint FK_detailed_tariff foreign key (tariff_id) - references tariff (tariff_id) on delete restrict on update restrict; - -alter table detailed add constraint FK_pay foreign key (pre_id) - references prescription (pre_id) on delete restrict on update restrict; - -alter table dossier add constraint FK_write foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table medicine add constraint FK_reason foreign key (pre_id) - references prescription (pre_id) on delete restrict on update restrict; - -alter table nurse add constraint FK_section_nurse foreign key (section_id) - references section (section_id) on delete restrict on update restrict; - -alter table patient add constraint FK_pertain foreign key (dossier_id) - references dossier (dossier_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_doctor_pre foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_possess foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table section add constraint FK_doctor_section foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - - -~~~ - diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230914 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" "b/14 \346\235\216\344\277\212\345\205\264/20230914 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" deleted file mode 100644 index ecb4629eecd14c5bf1b89b707cb07a64b1f325cd..0000000000000000000000000000000000000000 --- "a/14 \346\235\216\344\277\212\345\205\264/20230914 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" +++ /dev/null @@ -1,109 +0,0 @@ -复习了联表查询 - -~~~MySQL -select * from a left join b on a... = b... where -~~~ - -自学了一部分js - -# JavaScript - -### 变量 - -#### 什么是变量 - -白话 :就是一个装东西的盒子 - -通俗: 变量是用于数据存放的容器。我们通过变量名获取数据,甚至数据可以修改 - -本质:变量是程序中内存申请的一块用来存放数据的一块空间 - -类似酒店房间一个房间就是一个变量 - -#### 变量的使用 - -分为两步 - -1.声明变量 - -2.赋值 - -```javascript -//1.声明变量 - var age ; -// 声明一个名称为age 的变量 -``` - -var是JavaScript的一个关键字,用来声明变量(variable变量的意思)。使用该关键字声明后,计算机会自动为变量分配内存空间,不需要程序员接管 - -age 是程序员定义的变量名,我们要通过变量名来访问内存中分配的空间 - -```javascript -//2.赋值 - age = 18; -``` - -```javascript -//3.输出结果 - console.log(age); - //网页控制台输出 -``` - -```javascript -//声明变量并赋值为18 - var age = 18; - console.log(age) -//声明一个变量并赋值,我们称之为变量初始化。 -``` - -数字不用加引号 - -字符使用单引号 - -### 变量的使用 - -```javascript -//用户输入姓名 存储到一个myname的变量里面 - var myname = promt('请输入您的姓名'); - // 输出这个用户名 - alert(myname); -``` - -### 更改变量 - -```javascript -//先定义了一个变量 -var myname = 'p老师'; -//输出p老师 -console.log(myname); -//更改变量值 -myname = '李' -//在输出一遍 更改后的值 -console.log(myname); -``` - -#### 同时声明多个变量 - -```javascript -var age = 18, - address = '火影村', - gz = 2000; -``` - -#### 声明变量特殊情况 - -##### .1 只声明不赋值 - -```javascript -var sex; -console.log(sex); -//输出结果为 undefined 未定义的 -``` - -##### .2未定义 未赋值 直接使用会报错 - -```javascript -console.log(tel); -``` - -##### .3 不声明 直接赋值 (可以使用)不提倡 \ No newline at end of file diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230916 \346\261\275\350\275\246\345\224\256\345\215\226\347\263\273\347\273\237.md" "b/14 \346\235\216\344\277\212\345\205\264/20230916 \346\261\275\350\275\246\345\224\256\345\215\226\347\263\273\347\273\237.md" deleted file mode 100644 index 1979a89c69fbc92df34992ebfd7d1f85f3ca8373..0000000000000000000000000000000000000000 --- "a/14 \346\235\216\344\277\212\345\205\264/20230916 \346\261\275\350\275\246\345\224\256\345\215\226\347\263\273\347\273\237.md" +++ /dev/null @@ -1,154 +0,0 @@ -![](https://s2.loli.net/2023/09/16/bYhJlVZ3SKnGOH7.png) - -~~~ mysql -create database buy_car charset utf8; -use buy_car; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/16 16:12:55 */ -/*==============================================================*/ - - -drop table if exists car; - -drop table if exists car_brand; - -drop table if exists customer; - -drop table if exists sales_record; - -drop table if exists salesperson; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - cb_id int, - car_name varchar(10) not null, - car_price decimal(4,2) not null, - primary key (car_id) -); -insert into car values -(null,1,'奥迪A6L',42.79), -(null,1,'奥迪A8L',82.98), -(null,1,'奥迪A4L',32.18), -(null,2,'奔驰S400L',86.26), -(null,2,'奔驰GLA',28.78), -(null,2,'奔驰E级',50.25), -(null,3,'宝马X3',63.69), -(null,3,'宝马2系',41.98), -(null,3,'宝马X5',71.99); - -/*==============================================================*/ -/* Table: car_brand */ -/*==============================================================*/ -create table car_brand -( - cb_id int not null auto_increment, - cb_name varchar(10) not null, - primary key (cb_id) -); -insert into car_brand values -(null,'奥迪'), -(null,'奔驰'), -(null,'宝马'); - -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - customer_id int not null auto_increment, - customer_name varchar(5) not null, - customer_sex char(1) not null, - customer_tel varchar(11) not null, - customer_address varchar(20) not null, - primary key (customer_id) -); -insert into customer values -(null,'张三','男','18850625585','福建省南平市'), -(null,'李四','女','16845766554','福建省龙岩市'), -(null,'王五','男','14950028523','福建省泉州市'), -(null,'赵六','女','15650258573','福建省漳州市'), -(null,'田七','女','14589562573','福建省漳州市'); - -/*==============================================================*/ -/* Table: 销售记录 */ -/*==============================================================*/ -create table sales_record -( - sr_id int not null auto_increment, - car_id int, - sp_id int, - customer_id int, - sr_time date not null, - primary key (sr_id) -); -insert into sales_record values -(null,2,1,1,'2023-02-13'), -(null,1,3,1,'2023-05-23'), -(null,3,1,3,'2023-03-19'), -(null,5,2,2,'2023-07-21'), -(null,4,4,5,'2023-06-14'), -(null,6,2,4,'2023-08-15'), -(null,9,3,2,'2023-07-21'); - -/*==============================================================*/ -/* Table: 销售员 */ -/*==============================================================*/ -create table salesperson -( - sp_id int not null auto_increment, - sp_name varchar(5) not null, - sp_sex char(1) not null, - sp_tel varchar(11) not null, - sp_address varchar(20) not null, - primary key (sp_id) -); -insert into salesperson values -(null,'小李','男','14648515156','福建省南平市'), -(null,'小敏','女','18956764856','福建省漳州市'), -(null,'小莉','女','15989525856','福建省龙岩市'), -(null,'小黄','男','15954879156','福建省龙岩市'); - -alter table car add constraint FK_belong_to foreign key (cb_id) - references car_brand (cb_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_buy foreign key (customer_id) - references customer (customer_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_sell_a foreign key (sp_id) - references salesperson (sp_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_sell_b foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - - - - -- 1.查询特定销售员的销售记录(小李) - select * from salesperson s,sales_record sr where s.sp_id = sr.sp_id and sp_name = '小李'; - -- 2.查找销售记录中销售价格最高的汽车 - select * from car where car_price = - (select max(car_price) from car c,sales_record sr where c.car_id = sr.car_id); - -- 3.统计某个销售员的销售总额(小敏) - select sum(car_price) 万元 from car c,sales_record sr where c.car_id = sr.car_id and sp_id =(select sp_id from salesperson where sp_name = '小敏'); - -- 4.根据客户信息查询其购买过的汽车(李四) - select * from car where car_id in - (select car_id from sales_record where customer_id = (select customer_id from customer where customer_name = '李四')); - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额(奔驰) - select cb.cb_name 品牌,count(cb.cb_id) 销售数量,sum(car_price) 总销售额万元 - from car_brand cb,car c,sales_record sr where cb.cb_id = c.cb_id and c.car_id = sr.car_id group by cb.cb_id; - -- 6.检索特定日期范围内的销售了哪些汽车(2023-07-21) - select * from car where car_id in - (select car_id from sales_record where sr_time = '2023-07-21'); - -- 7.查找某车型的销售历史(宝马X3)。 - select * from sales_record where car_id = - (select car_id from car where car_name = '奔驰S400L'); - -- 8.统计每个销售员的销售数量 - select sp_name 销售员,count(sp.sp_id) 销售数量 from salesperson sp , sales_record sr where sp.sp_id = sr.sp_id group by sp.sp_id; - -~~~ - diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230926 \350\247\206\345\233\276.md" "b/14 \346\235\216\344\277\212\345\205\264/20230926 \350\247\206\345\233\276.md" deleted file mode 100644 index 87a180e1623445d1daf35a64176835b22227eede..0000000000000000000000000000000000000000 --- "a/14 \346\235\216\344\277\212\345\205\264/20230926 \350\247\206\345\233\276.md" +++ /dev/null @@ -1,349 +0,0 @@ -## 视图 - -##### check 检查约束 - -​ 检查某个字段的值是否符合XX 需求,一般指的值的范围 - -~~~mysql -字段名 数据类型 check(字段名 in(值1,值2)); -~~~ - -utf8 中 一个汉字是一个字符等于三字节 (3字节长度) - -CONCAT(拼接) - -##### 视图:也是一张虚拟表 - -​ 视图本身不具有数据,占用很少的内存空间 建立在已有表基础上,视图赖以这些表叫做基表 - -基表更新视图自动更新 - -​ 视图与基表一对一关系才可以 - -##### 视图的优点 - -1. 数据安全性 -2. 操作简单 -3. 减少数据冗余 -4. 灵活多变 - -##### 创建视图 - -~~~mysql -create view 视图名 as - 查询语句 -~~~ - -##### 修改视图 - -~~~mysql -create OR REPLACE view 视图名 as 查询语句 -~~~ - -修改的视图需要存在 - -##### 删除表格 - -~~~mysql -drop view 视图名 -~~~ - -##### 查询视图 - -~~~mysql -select * from 视图名称 -~~~ - -#### 练习 - -~~~mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ -USE dbtest14; - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - - - - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -create view employee_vu(姓名,员工号,部门号) as -select last_name,employee_id,department_id from employees; - -select * from employees; - -#2. 显示视图的结构 -show create table employee_vu; - -#3. 查询视图中的全部内容 - -select * from employee_vu; -#4. 将视图中的数据限定在部门号是80的范围内 -select * from employee_vu where 部门号>=0 and 部门号<=80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -create view emp_v1(员工姓名,工资,邮箱) as -select last_name,salary,email from employees where phone_number like '011%'; - -select * from emp_v1; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -create or replace view emp_v1(员工姓名,工资,邮箱,电话号码) as -select last_name,salary,email,phone_number from employees where phone_number like '011%' and email like '%e%'; - -select * from emp_v1; - -#3. 向 emp_v1 插入一条记录,是否可以? --- INSERT INTO employees VALUES (208, '文诚', '官小丑', 'EMASES', '011.515.235.568945', '2023-09-27', 'AD_PRES', 0.20, NULL, 106, 30); --- 不可以,有的情况可以插,有的情况可以插; -#4. 修改emp_v1中员工的工资,每人涨薪1000 -update emp_v1 set 工资=工资+1000; -#5. 删除emp_v1中姓名为Olsen的员工 -delete from emp_v1 where 员工姓名='Olsen'; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create view emp_v2 as -select department_id,max(salary) from employees where salary>12000 GROUP BY department_id; - - -select * from emp_v2; - -#7. 向 emp_v2 中插入一条记录,是否可以? - --- 不可以,有的情况可以插,有的情况可以插; - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view if exists emp_v1,emp_v2; -~~~ - diff --git "a/14 \346\235\216\344\277\212\345\205\264/image-20230907093523576.png" "b/14 \346\235\216\344\277\212\345\205\264/image-20230907093523576.png" deleted file mode 100644 index 09e39a7b7587056a8ba9bc845b26da9ad911ec36..0000000000000000000000000000000000000000 Binary files "a/14 \346\235\216\344\277\212\345\205\264/image-20230907093523576.png" and /dev/null differ diff --git "a/16 \351\230\231\350\213\217\346\226\207/20230913\345\214\273\351\231\242\347\263\273\347\273\237.md" "b/16 \351\230\231\350\213\217\346\226\207/20230913\345\214\273\351\231\242\347\263\273\347\273\237.md" deleted file mode 100644 index 6860407bb69affb4019a5fa54b57c69ce1704206..0000000000000000000000000000000000000000 --- "a/16 \351\230\231\350\213\217\346\226\207/20230913\345\214\273\351\231\242\347\263\273\347\273\237.md" +++ /dev/null @@ -1,117 +0,0 @@ -![屏幕截图 2023-09-13 234118](https://s2.loli.net/2023/09/13/D1eB7sqilIrubTZ.png) - - - -![屏幕截图 2023-09-13 234045](https://s2.loli.net/2023/09/13/GmKEMjQgX59BT4h.png) - - - -![屏幕截图 2023-09-13 234139](https://s2.loli.net/2023/09/13/T6UiduNM7sohSZg.png) - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 23:37:23 */ -/*==============================================================*/ - -create database hospital charset utf8; -use hospital; - -drop table if exists department; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists lookpatient; - -drop table if exists patient; - -drop table if exists patientEat; - -/*==============================================================*/ -/* Table: department */ -/*==============================================================*/ -create table department -( - doctor_id int not null, - department_id int not null auto_increment, - department_name varchar(10) not null, - department_tel int not null, - primary key (department_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - doctor_name varchar(10) not null, - doctor_age int not null, - doctor_sex char(1) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - drug_name varchar(10) not null, - drug_price int not null, - drug_category varchar(10) not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: lookpatient */ -/*==============================================================*/ -create table lookpatient -( - doctor_id int not null, - patient_id int not null, - primary key (doctor_id, patient_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(10) not null, - patient_age int not null, - patient_sex char(1) not null, - patient_sfz int not null, - patient_tel int not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: patientEat */ -/*==============================================================*/ -create table patientEat -( - drug_id int not null, - patient_id int not null, - primary key (drug_id, patient_id) -); - -alter table department add constraint FK_employ foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table lookpatient add constraint FK_lookpatient foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table lookpatient add constraint FK_lookpatient2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table patientEat add constraint FK_patientEat foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -alter table patientEat add constraint FK_patientEat2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; -``` - diff --git "a/16 \351\230\231\350\213\217\346\226\207/20230922\344\275\234\344\270\232.md" "b/16 \351\230\231\350\213\217\346\226\207/20230922\344\275\234\344\270\232.md" deleted file mode 100644 index 620039f8e86b292cd09576343d9be86d4f19d4fc..0000000000000000000000000000000000000000 --- "a/16 \351\230\231\350\213\217\346\226\207/20230922\344\275\234\344\270\232.md" +++ /dev/null @@ -1,146 +0,0 @@ -```mysql -/* - Navicat Premium Data Transfer - - Source Server : mysql - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : clothing - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 22/09/2023 11:09:09 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for attribute --- ---------------------------- -DROP TABLE IF EXISTS `attribute`; -CREATE TABLE `attribute` ( - `attribute_id` int NOT NULL AUTO_INCREMENT, - `attribute_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`attribute_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of attribute --- ---------------------------- -INSERT INTO `attribute` VALUES (1, '颜色'); -INSERT INTO `attribute` VALUES (2, '码号'); - --- ---------------------------- --- Table structure for attrizhi --- ---------------------------- -DROP TABLE IF EXISTS `attrizhi`; -CREATE TABLE `attrizhi` ( - `attrizhi_id` int NOT NULL AUTO_INCREMENT, - `attrizhi_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`attrizhi_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of attrizhi --- ---------------------------- -INSERT INTO `attrizhi` VALUES (1, '蓝色'); -INSERT INTO `attrizhi` VALUES (2, '红色'); -INSERT INTO `attrizhi` VALUES (3, '金色'); -INSERT INTO `attrizhi` VALUES (4, 'x码'); -INSERT INTO `attrizhi` VALUES (5, 'xl码'); - --- ---------------------------- --- Table structure for commodity --- ---------------------------- -DROP TABLE IF EXISTS `commodity`; -CREATE TABLE `commodity` ( - `commodity_id` int NOT NULL AUTO_INCREMENT, - `commodity_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `commodity_introduce` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`commodity_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of commodity --- ---------------------------- -INSERT INTO `commodity` VALUES (1, '啊帝达斯', '穿了啊帝达斯,让你帅出天际'); - --- ---------------------------- --- Table structure for relevance --- ---------------------------- -DROP TABLE IF EXISTS `relevance`; -CREATE TABLE `relevance` ( - `relevance_id` int NOT NULL AUTO_INCREMENT, - `attrizhi_id` int NOT NULL, - `attribute_id` int NOT NULL, - `sku_id` int NOT NULL, - PRIMARY KEY (`relevance_id`) USING BTREE, - INDEX `FK_Relationship_2`(`attrizhi_id` ASC) USING BTREE, - INDEX `FK_Relationship_3`(`attribute_id` ASC) USING BTREE, - INDEX `FK_Relationship_4`(`sku_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`attrizhi_id`) REFERENCES `attrizhi` (`attrizhi_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`attribute_id`) REFERENCES `attribute` (`attribute_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`sku_id`) REFERENCES `sku` (`sku_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of relevance --- ---------------------------- -INSERT INTO `relevance` VALUES (1, 1, 1, 1); -INSERT INTO `relevance` VALUES (2, 1, 2, 1); -INSERT INTO `relevance` VALUES (3, 2, 1, 2); -INSERT INTO `relevance` VALUES (4, 2, 2, 2); -INSERT INTO `relevance` VALUES (5, 3, 1, 3); -INSERT INTO `relevance` VALUES (6, 3, 2, 3); -INSERT INTO `relevance` VALUES (7, 4, 1, 4); -INSERT INTO `relevance` VALUES (8, 4, 2, 4); -INSERT INTO `relevance` VALUES (9, 5, 1, 5); -INSERT INTO `relevance` VALUES (10, 5, 2, 5); -INSERT INTO `relevance` VALUES (11, 5, 1, 6); -INSERT INTO `relevance` VALUES (12, 5, 2, 6); - --- ---------------------------- --- Table structure for sku --- ---------------------------- -DROP TABLE IF EXISTS `sku`; -CREATE TABLE `sku` ( - `sku_id` int NOT NULL AUTO_INCREMENT, - `commodity_id` int NOT NULL, - `sku_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`sku_id`) USING BTREE, - INDEX `FK_Relationship_1`(`commodity_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`commodity_id`) REFERENCES `commodity` (`commodity_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of sku --- ---------------------------- -INSERT INTO `sku` VALUES (1, 1, '啊帝达斯蓝色,蓝色妖姬x码'); -INSERT INTO `sku` VALUES (2, 1, '啊帝达斯蓝色,蓝色妖姬xl码'); -INSERT INTO `sku` VALUES (3, 1, '啊帝达斯红色,红色风暴x码'); -INSERT INTO `sku` VALUES (4, 1, '啊帝达斯红色,红色风暴xl码'); -INSERT INTO `sku` VALUES (5, 1, '啊帝达斯金色,金色奥利给x码'); -INSERT INTO `sku` VALUES (6, 1, '啊帝达斯金色,金色奥利给xl码'); - -SET FOREIGN_KEY_CHECKS = 1; - - - - -select * from -commodity c, -sku s, -attrizhi az, -attribute ab, -relevance r -where -c.commodity_id=s.commodity_id -and s.sku_id=r.sku_id -and az.attrizhi_id=r.attribute_id -and ab.attribute_id=r.attribute_id; -``` - diff --git "a/16 \351\230\231\350\213\217\346\226\207/RBAC.md" "b/16 \351\230\231\350\213\217\346\226\207/RBAC.md" deleted file mode 100644 index 08deb159af5ce2fcfe2030991fe3ed1a9f713848..0000000000000000000000000000000000000000 --- "a/16 \351\230\231\350\213\217\346\226\207/RBAC.md" +++ /dev/null @@ -1,31 +0,0 @@ -## 1.BAC (Role-Based Access Control) - - 基于角色的权限访问控制 - - 数据库能存:1.业务数据表 2.功能资源表 - -## 2.权限的使用场景 - -1.菜单权限:不同的用户登录系统后,展现的菜单不一样 - -2.按钮权限:不同用户查看同一个对象时,展现的按钮不一样 - -3.数据权限:不同用户查看同一个对象时,可见的数据不一样 - -4.操作权限:能看到,但是操作不了 - -## 3.基于角色的权限访问控制模型RBAC,目前权限控制的主流方案 - - - -```mysql - /*==============================================================*//* DBMS name:     MySQL 5.0                                   *//* Created on:     2023-09-20 15:35:28                         *//*==============================================================*/create datebase kjys charset utf8;   use kjys;drop table if exists jurisdiction;drop table if exists role;drop table if exists role_jurisdiction;drop table if exists user;drop table if exists user_role;/*==============================================================*//* Table: jurisdiction                                         *//*==============================================================*/create table jurisdiction(   jur_id               int not null auto_increment,   jur_shoye            varchar(255) not null,   jur_aoteman          varchar(254) not null,   jur_kjys             varchar(199) not null,   jur_address          varchar(254) not null,   primary key (jur_id));/*==============================================================*//* Table: role                                                 *//*==============================================================*/create table role(   role_id              int not null auto_increment,   role_name            varchar(10) not null,   primary key (role_id));/*==============================================================*//* Table: role_jurisdiction                                     *//*==============================================================*/create table role_jurisdiction(   jur_id               int not null,   role_id              int not null,   primary key (jur_id, role_id));/*==============================================================*//* Table: user                                                 *//*==============================================================*/create table user(   user_id              int not null auto_increment,   user_name            varchar(10) not null,   user_pwd             varchar(10) not null,   primary key (user_id));/*==============================================================*//* Table: user_role                                             *//*==============================================================*/create table user_role(   role_id              int not null,   user_id              int not null,   primary key (role_id, user_id));alter table role_jurisdiction add constraint FK_role_jurisdiction foreign key (jur_id)      references jurisdiction (jur_id) on delete restrict on update restrict;alter table role_jurisdiction add constraint FK_role_jurisdiction2 foreign key (role_id)      references role (role_id) on delete restrict on update restrict;alter table user_role add constraint FK_user_role foreign key (role_id)      references role (role_id) on delete restrict on update restrict;alter table user_role add constraint FK_user_role2 foreign key (user_id)      references user (user_id) on delete restrict on update restrict;SELECT user_name 用户,role_name 角色,jur_shoye,jur_kjys,jur_aoteman,jur_addressFROM   `user` u,   user_role ur,   role r,   role_jurisdiction rj ,   jurisdiction jWHERE     u.user_id=ur.user_id AND     r.role_id=rj.jur_id AND     u.user_id=ur.role_id AND     j.jur_id=rj.jur_id      and u.user_name="小天"      and user_pwd="12345678"; -``` - - - -## SKU预习 - - **spu** 指的是商品,spu 属性就是不会影响到库存和价格的属性,又叫**关键属性**,与商品是一对一的关系 - - **sku** 指的是具体规格单品,sku 属性就是会影响到库存和价格的属性,又叫**销售属性**,与商品是多对一的关系 \ No newline at end of file diff --git "a/16 \351\230\231\350\213\217\346\226\207/sku\344\275\234\344\270\232.md" "b/16 \351\230\231\350\213\217\346\226\207/sku\344\275\234\344\270\232.md" deleted file mode 100644 index 713cb28d4ad3eae1b450549973dee7d741e6eb8e..0000000000000000000000000000000000000000 --- "a/16 \351\230\231\350\213\217\346\226\207/sku\344\275\234\344\270\232.md" +++ /dev/null @@ -1,150 +0,0 @@ -# 笔记 - -1.SKU是指一款商品,每款都有出现一个SKU。一款商品多色,则是有多个SKU,SKU是(库存量单位) SKU即库存进出计量的单位在服装、鞋类商品中使用最多最普遍。 例如纺织品中一个SKU通常表示:规格、颜色、款式。 SKU是物理上不可分割的最小存货单元。也就是说一款商品,可以根据SKU来确定具体的货物存量。 sku 属性会影响到库存和价格的属性, 又叫销售属性规格。 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : mysql - Source Server Type : MySQL - Source Server Version : 50742 - Source Host : localhost:3306 - Source Schema : commodity - - Target Server Type : MySQL - Target Server Version : 50742 - File Encoding : 65001 - - Date: 21/09/2023 20:34:12 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for attributes --- ---------------------------- -DROP TABLE IF EXISTS `attributes`; -CREATE TABLE `attributes` ( - `attributes_id` int(11) NOT NULL AUTO_INCREMENT, - `attributes_name` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`attributes_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of attributes --- ---------------------------- -INSERT INTO `attributes` VALUES (1, '黑色'); -INSERT INTO `attributes` VALUES (2, '红色'); -INSERT INTO `attributes` VALUES (3, '牛逼色'); -INSERT INTO `attributes` VALUES (4, '512GB'); -INSERT INTO `attributes` VALUES (5, '1TB'); - --- ---------------------------- --- Table structure for attribzhi --- ---------------------------- -DROP TABLE IF EXISTS `attribzhi`; -CREATE TABLE `attribzhi` ( - `attribzhi_id` int(11) NOT NULL AUTO_INCREMENT, - `attribzhi_neir` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`attribzhi_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of attribzhi --- ---------------------------- -INSERT INTO `attribzhi` VALUES (1, '颜色'); -INSERT INTO `attribzhi` VALUES (2, '容量'); - --- ---------------------------- --- Table structure for commodity --- ---------------------------- -DROP TABLE IF EXISTS `commodity`; -CREATE TABLE `commodity` ( - `commodity_id` int(11) NOT NULL AUTO_INCREMENT, - `commodity_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `commodity_part` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`commodity_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of commodity --- ---------------------------- -INSERT INTO `commodity` VALUES (1, 'iQOO7Pro传奇版', '遥遥领先'); - --- ---------------------------- --- Table structure for relevance --- ---------------------------- -DROP TABLE IF EXISTS `relevance`; -CREATE TABLE `relevance` ( - `relevance_id` int(11) NOT NULL AUTO_INCREMENT, - `attributes_id` int(11) NOT NULL, - `attribzhi_id` int(11) NOT NULL, - `sku_id` int(11) NOT NULL, - PRIMARY KEY (`relevance_id`) USING BTREE, - INDEX `FK_Relationship_1`(`attributes_id`) USING BTREE, - INDEX `FK_Relationship_2`(`attribzhi_id`) USING BTREE, - INDEX `FK_Relationship_3`(`sku_id`) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`attributes_id`) REFERENCES `attributes` (`attributes_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`attribzhi_id`) REFERENCES `attribzhi` (`attribzhi_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`sku_id`) REFERENCES `sku` (`sku_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of relevance --- ---------------------------- -INSERT INTO `relevance` VALUES (1, 1, 1, 1); -INSERT INTO `relevance` VALUES (2, 1, 2, 1); -INSERT INTO `relevance` VALUES (3, 2, 1, 2); -INSERT INTO `relevance` VALUES (4, 2, 2, 2); -INSERT INTO `relevance` VALUES (5, 3, 1, 3); -INSERT INTO `relevance` VALUES (6, 3, 2, 3); -INSERT INTO `relevance` VALUES (7, 4, 1, 4); -INSERT INTO `relevance` VALUES (8, 4, 2, 4); -INSERT INTO `relevance` VALUES (9, 5, 1, 5); -INSERT INTO `relevance` VALUES (10, 5, 2, 5); -INSERT INTO `relevance` VALUES (12, 5, 1, 6); -INSERT INTO `relevance` VALUES (13, 5, 2, 6); - --- ---------------------------- --- Table structure for sku --- ---------------------------- -DROP TABLE IF EXISTS `sku`; -CREATE TABLE `sku` ( - `sku_id` int(11) NOT NULL AUTO_INCREMENT, - `commodity_id` int(11) NOT NULL, - `sku_name` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`sku_id`) USING BTREE, - INDEX `FK_Relationship_4`(`commodity_id`) USING BTREE, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`commodity_id`) REFERENCES `commodity` (`commodity_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of sku --- ---------------------------- -INSERT INTO `sku` VALUES (1, 1, 'iQOO7Pro12G+512GB黑色火龙手机冬天的暖手宝,你值得拥有'); -INSERT INTO `sku` VALUES (2, 1, 'iQOO7Pro12G+1TB黑色火龙手机加热版的暖手宝,你也值得拥有'); -INSERT INTO `sku` VALUES (3, 1, 'iQOO7Pro12G+512GB红色火炉手机,让你冬天不在寒冷'); -INSERT INTO `sku` VALUES (4, 1, 'iQOO7Pro12G+1TB红色火炉手机,让你感觉夏天来了'); -INSERT INTO `sku` VALUES (5, 1, 'iQOO7Pro12G+512GB牛逼色火焰手机,让你感觉离太阳更近一步'); -INSERT INTO `sku` VALUES (6, 1, 'iQOO7Pro12G+1TB牛逼色火炉手机,让你感觉自己身处太阳上'); - -SET FOREIGN_KEY_CHECKS = 1; - - - - -select * from -commodity c, -sku s, -attributes ab, -attribzhi az, -relevance r -where -c.commodity_id=s.commodity_id -and s.sku_id=r.sku_id -and ab.attributes_id=r.attributes_id -and az.attribzhi_id=r.relevance_id; -``` - diff --git "a/16 \351\230\231\350\213\217\346\226\207/\345\260\217\346\265\213.md" "b/16 \351\230\231\350\213\217\346\226\207/\345\260\217\346\265\213.md" deleted file mode 100644 index 35dc29b255deca1fc15f422d62ad61c15aaad1b6..0000000000000000000000000000000000000000 --- "a/16 \351\230\231\350\213\217\346\226\207/\345\260\217\346\265\213.md" +++ /dev/null @@ -1,112 +0,0 @@ - - -![屏幕截图 2023-09-16 172829](https://s2.loli.net/2023/09/16/jmQhI8elnTD7gaE.png) - - - -![屏幕截图 2023-09-16 172851](https://s2.loli.net/2023/09/16/rf7542hK6MipcBx.png) - -![屏幕截图 2023-09-16 172903](https://s2.loli.net/2023/09/16/9YFo6rJmQTWht8H.png) - - - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/16 16:24:33 */ -/*==============================================================*/ - -create database qiche charset utf8; -use qiche; - -drop table if exists car; - -drop table if exists customer; - -drop table if exists sales; - -drop table if exists salesperson; - -/*==============================================================*/ -/* Table: car */ -/*============================ ==================================*/ -create table car -( - car_id int not null auto_increment, - car_name varchar(10) not null, - primary key (car_id) -); - -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - customer_id int not null auto_increment, - customer_name varchar(10) not null, - customer_age int not null, - customer_sex char(1) not null, - customer_tel int not null, - customer_sfzh int not null, - primary key (customer_id) -); - -/*==============================================================*/ -/* Table: sales */ -/*==============================================================*/ -create table sales -( - sales_id int not null auto_increment, - salesperson_id int not null, - customer_id int not null, - car_id int not null, - sales_number int not null, - sales_total int not null, - sales_date date not null, - primary key (sales_id) -); - -/*==============================================================*/ -/* Table: salesperson */ -/*==============================================================*/ -create table salesperson -( - salesperson_id int not null auto_increment, - salesperson_name char(10) not null, - salesperson_tel int not null, - primary key (salesperson_id) -); - -alter table sales add constraint FK_get foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table sales add constraint FK_mai foreign key (customer_id) - references customer (customer_id) on delete restrict on update restrict; - -alter table sales add constraint FK_promote foreign key (salesperson_id) - references salesperson (salesperson_id) on delete restrict on update restrict; - - --- 1.查询特定销售员的销售记录 - select * from salesperson p JOIN sales s on s.salesperson_id=p.salesperson_id where s.salesperson_id=( - select salesperson_id from salesperson where salesperson_name='韩勾八'); - - -- 2.查找销售记录中销售价格最高的汽车 - - select * from sales s join car c on s.car_id=c.car_id where sales_total= ( - select MAX(sales_total) from sales); - -- 3.统计某个销售员的销售总额 - select c.salesperson_id 销售员ID, s.salesperson_name 销售员姓名,sales_number*sales_total 销售总额 from salesperson s JOIN sales c on s.salesperson_id=c.salesperson_id where c.salesperson_id=( - select salesperson_id from salesperson where salesperson_name='韩勾八'); - -- 4.根据客户信息查询其购买过的汽车 - select * FROM customer c join sales s on c.customer_id=s.customer_id where c.customer_id = ( - select customer_id from customer where customer_name='阙老板'); - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -- 6.检索特定日期范围内的销售了哪些汽车 - select * from car c join sales s on c.car_id=s.car_id where sales_date=20230916; - -- 7.查找某车型的销售历史。 - select * from car c join sales s on c.car_id=s.car_id where car_name like '劳斯莱斯幻影'; - -- 8.统计每个销售员的销售数量\ - select s.salesperson_id 销售员ID, salesperson_name 销售员姓名, sum(sales_number) 数量 from salesperson s JOIN sales c on s.salesperson_id=c.sales_id GROUP BY s.salesperson_id; -``` - diff --git "a/16 \351\230\231\350\213\217\346\226\207/\346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" "b/16 \351\230\231\350\213\217\346\226\207/\346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" deleted file mode 100644 index 50f4ab6655724761d400a9a33ea7335061ca4005..0000000000000000000000000000000000000000 --- "a/16 \351\230\231\350\213\217\346\226\207/\346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" +++ /dev/null @@ -1,7 +0,0 @@ -# 笔记 - -```mysql -范式1:要求字段的内容,不可在分割,位的是保证数据的原子性 -范式2:要求满足第一范式的基础上,要求非主键字段要求完全依赖主键(非主键,要依赖整个联合主键),而不能只依赖部分 -范式3:满足一、二范式的前提下,要求非主键属要直接依赖主键 -``` \ No newline at end of file diff --git "a/16 \351\230\231\350\213\217\346\226\207/\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" "b/16 \351\230\231\350\213\217\346\226\207/\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" deleted file mode 100644 index 1ca37f8fc70488a4c0163ed690c2c9de63c7d195..0000000000000000000000000000000000000000 --- "a/16 \351\230\231\350\213\217\346\226\207/\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" +++ /dev/null @@ -1,22 +0,0 @@ - - -#### 一.事务 - - 什么是事务:为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - -事务的四个特性 - -- 原子性:事务包含的这一系列操作,要么全部成功,要么全部失败。 -- 一致性:事务完成之后,不会将非法的数据写入数据库。 -- 隔离性:多个事务可以在一定程度上并发执行。 -- 持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上)。 - -隔离级别: - -1.读未提交:一个事务可以读取到另外一个事务尚未提交的数据。该隔离级别可能会产生“脏读”、“不可重复读取”和“幻影读取”问题。 - -2.读已提交:一个事务只能读取到另外一个事务已经提交的数据。该隔离级别解决了“脏读”问题,但是仍然可能会发生“不可重复读取”和“幻影读取”问题。 - -3.可重复读取:在同一个事务当中,多次读取同一份数据,结果一样。该隔离级别解决了“脏读”和“不可重复读取”问题,但是仍然有可能会产生“幻影读取问题”(虚读)。 - -序列化:多个同务只能排队执行,即只有一个事务结束之后,另外一个事务才能开始执行。该隔离级别解决了“脏读”,“不可重复读取”和“幻影读取”问题,但是程序性能会下降。所以只有必要的时候(比如在银行系统里面)才会使用。 \ No newline at end of file diff --git "a/16 \351\230\231\350\213\217\346\226\207/\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260\345\222\214\344\275\234\344\270\232.md" "b/16 \351\230\231\350\213\217\346\226\207/\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260\345\222\214\344\275\234\344\270\232.md" deleted file mode 100644 index a59a920f40faa6b92eea95ce39b98fe0728e9494..0000000000000000000000000000000000000000 --- "a/16 \351\230\231\350\213\217\346\226\207/\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260\345\222\214\344\275\234\344\270\232.md" +++ /dev/null @@ -1,129 +0,0 @@ -# 笔记 - -## 一, - -表关系是相互的:一个学生,可以选多个课程;一个课程可以被多个学生选择,必须引用第三个表; - -表与表之间的关系:1对多,1对1,多对多; - -1对1:将其中任意一表中的主键,放到另一个表中当外键; - -1对多:将一所在的表的王键,放到物的表当外键 - -多对多:必须有第三张表 ,将前面二张表的主键放来当外建 - -## 二, - -数据库设计方法: - -{ - -1.直观设计法(手工试凑发), - -2,.规范设计法, - -3.计算机车辅助设计法; - -}; - -## 三, - -ER图三要素:实体,属性,关系; - -# 作业 - -```mysql -#创建数据库 -create DATABASE homework CHARSET utf8; -use homework; -#院系表 -CREATE table department( - department_id int auto_increment primary KEY,#院系编号 - department_name varchar(20) not null #院系名称 -); -#插入数据 -insert into department values (1,'软件工程学院'),(2,'信息工程学院'); -#专业表 -create table major( - major_id int auto_increment primary key, #专业编号 - major_name VARCHAR(20) not null, #专业名称 - department_id int #院系编号 - foreign key (department_id) references department(department_id) -); -#插入数据 -insert into major VALUES (1,'后端',1),(2,'后端',1); -#专业班级表(中间表) -create table majorclass( - majorclass_id int auto_increment primary key, #专班编号 - major_id int, #专业编号 - class_id int #班级编号 - FOREIGN key (major_id) REFERENCES major(major_id) -); -#插入数据 -insert into majorclass VALUES (1,1,2),(2,2,1); -#班级表 -create table class( - class_id int auto_increment primary key, #班级编号 - class_name varchar(20) not null, #班级名称 - grade int -); -#插入数据 -insert into class VALUES (1,'一班',22),(2,'二班',23); -#学生表 -CREATE table student( - student_id int auto_increment primary key, #学号 - student_name varchar(20) not null, #姓名 - student_class varchar(20) not null, #班级 - major_id int, #专业编号 - FOREIGN key (major_id) REFERENCES major_id(major_id) -); -#插入数据 -insert into student VALUES (1,'小明','一班',1),(2,'小刚','二班',2); -#教师表 -CREATE TABLE teacher( - job_id int auto_increment primary key, #工号 - job_name VARCHAR(20) not null #姓名 -); -#插入数据 -insert into teacher VALUES(1,'王老师'),(2,'李老师'); -#教师班级表(中间表) -create table teacherclass ( - teacherclass_id int auto_increment PRIMARY key, #教师班级编号 - job_id int, #工号 - class_id int #班级编号 -); -#插入数据 -INSERT into teacherclass VALUES(1,1,1),(2,2,1); -#课程 -CREATE table curriculum( - curriculum_id int auto_increment PRIMARY key, #课程编号 - curriculum_name VARCHAR(20) not null, #课程名称 - Lecturer VARCHAR(20) NOT null #授课老师 - FOREIGN key (Lecturer) REFERENCES major_id(job_name) -); -#插入数据 -INSERT into curriculum VALUES(1,'java','王老师'),(2,'mysql','李老师'); -#教室 -create table classroom( - classroom_id int auto_increment PRIMARY key, #教室编号 - classroom_name VARCHAR(20) not null #教室名称 -); -#插入数据 -INSERT into classroom VALUES(1,'望云楼'),(2,'辛耕楼'); -#课程表 -CREATE TABLE curr( - curr_id int auto_increment PRIMARY key, #课程编号 - classroom_id int , #教室编号 - curriculum_name VARCHAR(20) not null, #课程名称 - student_class varchar(20) not null, #班级 - week VARCHAR(20) not null , #星期 - section int #节次 - FOREIGN key (curr_id) REFERENCES curriculum(curriculum_id), - FOREIGN key (classroom_id) REFERENCES classroom(classroom), - FOREIGN key (curriculum_name) REFERENCES curriculum(curriculum_name), - FOREIGN key (student_class) REFERENCES student(student_class) -); -#插入数据 -INSERT into curr VALUES(1,1,'java','一班','星期一',4),(2,2,'java','二班','星期二',2); -``` - diff --git "a/16 \351\230\231\350\213\217\346\226\207/\347\272\246\346\235\237\345\222\214\350\247\206\345\233\276.md" "b/16 \351\230\231\350\213\217\346\226\207/\347\272\246\346\235\237\345\222\214\350\247\206\345\233\276.md" deleted file mode 100644 index 6e5c84df9424f17e331ba5767d49f1c76c63f397..0000000000000000000000000000000000000000 --- "a/16 \351\230\231\350\213\217\346\226\207/\347\272\246\346\235\237\345\222\214\350\247\206\345\233\276.md" +++ /dev/null @@ -1,98 +0,0 @@ -# 笔记 - -CHECK约束 - -检查某个字段是否符合xx要求 - -格式:字段 char(1) chenk(字段 in ('男','女'));一个字符是3个字节 - -创建视图: - -create view 视图名称(字段别名)别名数要与字段数一致 as 查询语句 - -将过滤后的数据,保存成一个视图,有利于数据的安全性, - -基于视图建视图, - -更新视图:一对一能改视图, - -查看视图:select 指定的字段名 from 视图名 - -改视图 - -方式一:create or replace view 子句修改视图 select 字段名 from 表名 where 条件 and 条件; - -方法二:alter view 前提被修改的视图被创建 - -删除视图 - -drop view 视图名; - -```mysql -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -create view employee_vu(姓名,员工号,部门号) as -select last_name,employee_id,department_id from employees; - -#2. 显示视图的结构 - -desc employee_vu; - -#3. 查询视图中的全部内容 -select * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -select * from employee_vu where department_id<=80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -create view emp_v1(员工姓名,工资,邮箱) as -select last_name,salary,email from employees where phone_number like "%011%"; - -select * from emp_v1; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -CREATE OR REPLACE VIEW emp_v1 -AS -SELECT last_name,email,phone_number,salary -FROM employees -WHERE phone_number LIKE '011%' AND email LIKE '%e%'; -SELECT * FROM emp_v1; - -#3. 向 emp_v1 插入一条记录,是否可以? -INSERT INTO emp_v1 (last_name,email,phone_number,salary) VALUES ("kera","clsosj","011.00.4243.098325","19000"); - -insert into emp_v1 VALUES ('king','emare',01142424,18888); - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -create or replace view emp_v1 as select * from employees where salary+1000; - -#5. 删除emp_v1中姓名为Olsen的员工 -delete from emp_v1 where last_name='Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -create view emp_v2 as select max(salary),department_id from employees GROUP BY department_id -HAVING max(salary)>12000; - -select * from emp_v2; - - - -#7. 向 emp_v2 中插入一条记录,是否可以? - -create or replace view emp_v2 as select * from employees; - -select * from emp_v2; - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v1 ,emp_v2; -``` - diff --git "a/16 \351\230\231\350\213\217\346\226\207/\347\273\203\344\271\240.md" "b/16 \351\230\231\350\213\217\346\226\207/\347\273\203\344\271\240.md" deleted file mode 100644 index 9f7ccd64a8e3e67d0543d9c332d52f84b6454bf8..0000000000000000000000000000000000000000 --- "a/16 \351\230\231\350\213\217\346\226\207/\347\273\203\344\271\240.md" +++ /dev/null @@ -1,349 +0,0 @@ -```mysql -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -select sum(salary* 12) 工资总和 from employees; - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -select sum(salary*(1+IFNULL(commission_pct,0))*12) 工资和奖金和 from employees; -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct -select distinct job_id from employees; - - -# 3.查询工资大于12000的员工姓名和工资 -select first_name,salary from employees where salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 - -select first_name, department_id from employees where employee_id=176; -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -select first_name,salary from employees where salary not between 5000 and 12000; - - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select * from employees where department_id between 20 and 50; -# 3.选择公司中没有管理者的员工姓名及job_id -select * from employees where ISNULL(manager_id); - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -select first_name ,salary*commission_pct , grade_level from employees -join job_grades -where salary*commission_pct between lowest_sal and highest_sal and commission_pct IS not NULL; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 -select last_name from employees where last_name like '__尔' -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -select last_name from employees where last_name like '%特%' and last_name like '%尔%' - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -select * from employees where first_name like '%尔' - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -select last_name , job_id from employees where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -select last_name,salary,manager_id from employees where manager_id in (100,101,110); - - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 -select last_name,department_id,salary*12 from employees ORDER BY salary desc; --- order by 年薪 asc/desc - -# - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select last_name,salary from employees where salary not between 8000 and 17000 ORDER BY salary desc LIMIT 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select * from employees where email like '%e%' ORDER BY length(email) desc ,department_id ; - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -select last_name,e1.department_id ,department_name from employees e1 join departments d1 on e1.department_id=d1.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id -select e1.job_id,location_id from employees e1 -join departments d1 on e1.department_id=e1.department_id -where d1.department_id=90 GROUP BY job_id; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select last_name , d1.department_name , l1.location_id , city from employees e1 -join departments d1 on e1.department_id=d1.department_id -join locations l1 on l1.location_id=d1.location_id -where commission_pct is not null ; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -select last_name , job_id , d1.department_id , department_name -from employees e1 -join departments d1 on e1.department_id=d1.department_id -join locations l1 on l1.location_id=d1.location_id -where city ='多伦多' ; - - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 -select department_name,street_address,last_name,job_title ,salary from departments d1 , employees e1 ,locations l1 ,jobs j1 where d1.department_id=e1.department_id and d1.location_id=l1.location_id and j1.job_id=e1.job_id and department_name='行政部' - - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select e1.last_name,e1.employee_id,e2.last_name,e2.manager_id from employees e1 join employees e2 on e1.employee_id=e2.manager_id; - -select e1.last_name,e1.employee_id,e2.last_name,e2.manager_id from employees e1 ,employees e2 where e1.employee_id=e2.manager_id; - -# 7.查询哪些部门没有员工 - -select department_name from employees e1 right join departments d1 on e1.department_id=d1.department_id where employee_id is null ; -# 8. 查询哪个城市没有部门 -select city from departments d1 right join locations l1 on d1.location_id=l1.location_id where department_name is null; -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -select * from departments d1 join employees e1 on d1.department_id=e1.department_id where department_name='销售部' or department_name='信息技术部' - - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary),min(salary),avg(salary),sum(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -select job_id, max(salary),min(salary),avg(salary),sum(salary) from employees GROUP BY job_id; - -#4.选择各个job_id的员工人数 -select job_id ,count(employee_id)from employees GROUP BY job_id; -# 5.查询员工最高工资和最低工资的差距 -select max(salary)-min(salary) from employees; - - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - - select manager_id,min(salary) from employees where salary>6000 and manager_id is not null group by manager_id - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 -select department_name,location_id ,COUNT(employee_id),avg(salary)from departments d1 , employees e1 where d1.department_id=e1.department_id group by department_name,location_id order by avg(salary) desc; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select department_name, job_title,min_salary from departments d1 -join employees e1 on d1.department_id=e1.department_id -join jobs j1 on j1.job_id=e1.job_id ; -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -select last_name , salary from employees where department_id = -(select e1.department_id from employees e1 join departments d1 on e1.department_id=d1.department_id where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -select employee_id ,last_name,salary from employees where salary >(select avg(salary) from employees ); - - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name, job_id, salary from employees where employee_id in -(select employee_id from employees where salary = -(select max(salary) from employees where job_id='sa_man')); - - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - - -select employee_id,last_name from employees where department_id in (select DISTINCT department_id from employees where email like '%u%') ORDER BY department_id; - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -select employee_id from employees where department_id in (select department_id from departments where location_id=1700); - -#6.查询管理者是 金 的员工姓名和工资 -SELECT last_name, salaryFROM employees WHERE manager_id IN (SELECT employee_id FROM employees WHERE last_name = '金'); - -#7.查询工资最低的员工信息: last_name, salary -select last_name,salary from employees where salary =(select min(salary) from employees ) -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 - --- A: -SELECT d.department_id, d.department_name, AVG(e.salary) AS average_salary -FROM departments d -JOIN employees e ON d.department_id = e.department_id -GROUP BY d.department_id, d.department_name -ORDER BY average_salary -LIMIT 1; - - - --- B: -select * from departments d1 where d1.department_id=( -SELECT d.department_id -FROM departments d -JOIN employees e ON d.department_id = e.department_id -GROUP BY d.department_id -HAVING AVG(e.salary) = (SELECT MIN(avg_salary) -FROM (SELECT AVG(salary) AS avg_salary -FROM employees -GROUP BY department_id) AS temp)); - -#方式2: -# 部门平均<= 公司所有平均 - - - - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -SELECT * -FROM departments d1 -JOIN ( - SELECT AVG(salary) avg_salary, department_id - FROM employees - WHERE department_id IS NOT NULL - GROUP BY department_id -) a ON d1.department_id = a.department_id -WHERE a.department_id = ( - SELECT department_id - FROM ( - SELECT AVG(salary) avg_salary, department_id - FROM employees - WHERE department_id IS NOT NULL - GROUP BY department_id - ) b - WHERE avg_salary = ( - SELECT MIN(avg_salary) min_avg - FROM ( - SELECT AVG(salary) avg_salary, department_id - FROM employees - WHERE department_id IS NOT NULL - GROUP BY department_id - ) AS c - ) -); - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - - - - -#11.查询平均工资高于公司平均工资的部门有哪些? - - - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 -select * from employees e1 join employees e2 on e1.employee_id=e2.manager_id; - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - - - -#方式: - - - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - - - - - -#16. 选择所有没有管理者的员工的last_name -select last_name from employees where manager_id is null; - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: -SELECT e1.employee_id, e1.first_name, e1.hire_date, e1.salary -FROM departments d1 -JOIN employees e1 ON d1.department_id = e1.department_id -WHERE e1.manager_id IN (SELECT employee_id FROM employees e2 WHERE e2.last_name = '格林伯格'); -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` - diff --git "a/17 \345\221\250\345\257\214/20230905\347\254\254\344\270\200\345\244\251\347\254\224\350\256\260.md" "b/17 \345\221\250\345\257\214/20230905\347\254\254\344\270\200\345\244\251\347\254\224\350\256\260.md" deleted file mode 100644 index fda8fbb24e771e43a3c36535e72472912033e669..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/20230905\347\254\254\344\270\200\345\244\251\347\254\224\350\256\260.md" +++ /dev/null @@ -1,23 +0,0 @@ -## 第一课笔记 - -大一:主打理论知识,学习基础知识,打下大二的基础 - -大二:实际应用(实操) - -大二上要学:1.MySQL高级语言 - -​ 2.JavaScript(Ajax) - -​ 3.MVC框架(全称:model view controller) - -大二下要学:1.node.js - -​ 2.Vue.js ----简化开发,有UI框架配合 - -​ 3.Spring boot框架 - -大二下实训:1.Linux服务器 - -​ 2.项目周可能实现的技术:中间件、签权:鉴别权限 - -​ 3.小程序:app移动端开发 \ No newline at end of file diff --git "a/17 \345\221\250\345\257\214/20230905\347\254\254\344\272\214\345\244\251\347\254\224\350\256\260.md" "b/17 \345\221\250\345\257\214/20230905\347\254\254\344\272\214\345\244\251\347\254\224\350\256\260.md" deleted file mode 100644 index f4fdf3a2357f531a62a4829ba1b97107615e8d2a..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/20230905\347\254\254\344\272\214\345\244\251\347\254\224\350\256\260.md" +++ /dev/null @@ -1,13 +0,0 @@ -## mysql第二课的笔记 - -建表:多对多的时候,引用第三张表,将前面两张表的主键拿来当第三张表的外键、 - -​ 一对多的时候,将一所在的表的主键放在多的表当外键 - -​ 一对一的时候,将一张表的主键放在另一张表当外键 - -## ER图 - -概念:实体关系图, 是指以实体,关系,属性三个基本概念概括数据的基本结构,从而描述静态数据结构的概念格式 - -要素:实体(表),属性(字段),和关系(类似外键) \ No newline at end of file diff --git "a/17 \345\221\250\345\257\214/20230906\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" "b/17 \345\221\250\345\257\214/20230906\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" deleted file mode 100644 index cf4de34624f86e4aaca7b4947407a2d693d0b2f8..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/20230906\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" +++ /dev/null @@ -1,60 +0,0 @@ -~~~mysql -CREATE DATABASE school charset utf8; -use school; -CREATE TABLE department( -d_id int primary KEY, -d_name VARCHAR(20) -); -CREATE TABLE major( -m_id int PRIMARY KEY, -m_name VARCHAR(20), -d_id int, -foreign key(d_id) references department(d_id) -) -CREATE TABLE class( -c_id int PRIMARY key, -c_name VARCHAR(20), - grade VARCHAR(20), - m_id int, - FOREIGN key(m_id) REFERENCES major(m_id) -) -CREATE TABLE teacher( -t_id int PRIMARY key, -t_name VARCHAR(20), -t_sex VARCHAR(5) -) -CREATE TABLE courses( -cou_id int PRIMARY key, -cou_name VARCHAR(20), -t_id int, -FOREIGN KEY (t_id) REFERENCES teacher(t_id) -) - -CREATE TABLE student( -s_id int PRIMARY key, -s_name VARCHAR(5), -s_sex VARCHAR(2), -c_id int, -FOREIGN key(c_id) REFERENCES class(c_id) -) -CREATE TABLE achievement( -s_id int, -cou_id int, -a_achievement int, -FOREIGN key(s_id) REFERENCES student(s_id), -FOREIGN key(cou_id) REFERENCES courses(cou_id) -) -CREATE TABLE timetable( -classroom_id int PRIMARY key, -ti_week VARCHAR(5), -ti_courses VARCHAR(20), -teacher_name VARCHAR(20) -) -CREATE TABLE classroom( -classroom_id int , -classroom_name VARCHAR(20), -classroom_address VARCHAR(50), -FOREIGN key(classroom_id) REFERENCES timetable(classroom_id) -) -~~~ - diff --git "a/17 \345\221\250\345\257\214/20230907\347\254\254\344\270\211\345\244\251\347\254\224\350\256\260.md" "b/17 \345\221\250\345\257\214/20230907\347\254\254\344\270\211\345\244\251\347\254\224\350\256\260.md" deleted file mode 100644 index 38876da7def34d15007dcb595ae9eb41a58609a9..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/20230907\347\254\254\344\270\211\345\244\251\347\254\224\350\256\260.md" +++ /dev/null @@ -1,9 +0,0 @@ -## 第三天笔记 - -数据库范式 - -1.第一范式:要求字段的内容不可再分割,为的是保证数据原子性 - -2.第二范式:在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键,要依赖整个联合主键),而不能只依赖部分。 - -3.第三范式:瞒住第二范式的前提下,要求非主键属性要直接依赖于主键。 \ No newline at end of file diff --git "a/17 \345\221\250\345\257\214/20230910\347\254\254\345\233\233\345\244\251\347\254\224\350\256\260.md" "b/17 \345\221\250\345\257\214/20230910\347\254\254\345\233\233\345\244\251\347\254\224\350\256\260.md" deleted file mode 100644 index ee708a406019b7b5162055bd703637eb994dec1f..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/20230910\347\254\254\345\233\233\345\244\251\347\254\224\350\256\260.md" +++ /dev/null @@ -1,9 +0,0 @@ -软件:powerdesigner - -1.创建概念模型(类似ER图)(用户角度)CDM。 - -2.转换式逻辑模型(计算机的角度)LDM。 - -3.转换成物理模型(数据库的角度)PDM。 - -4.生成DDL。 \ No newline at end of file diff --git "a/17 \345\221\250\345\257\214/20230911\345\233\276\344\271\246\351\246\206.md" "b/17 \345\221\250\345\257\214/20230911\345\233\276\344\271\246\351\246\206.md" deleted file mode 100644 index 2632a035d5d955967fba1de09379e1e9c2b8bdf6..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/20230911\345\233\276\344\271\246\351\246\206.md" +++ /dev/null @@ -1,454 +0,0 @@ -~~~mysql -/*==============================================================*/ -/* DBMS name: Sybase SQL Anywhere 12 */ -/* Created on: 2023/9/11 14:11:35 */ -/*==============================================================*/ - - -if exists(select 1 from sys.sysforeignkey where role='FK_BOOK_RELATIONS_BOOKSHEL') then - alter table book - delete foreign key FK_BOOK_RELATIONS_BOOKSHEL -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_BOOKSHEL_RELATIONS_FLOOR') then - alter table bookshelf - delete foreign key FK_BOOKSHEL_RELATIONS_FLOOR -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW-R_RELATIONS_BOOK') then - alter table "borrow-return" - delete foreign key "FK_BORROW-R_RELATIONS_BOOK" -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW-R_RELATIONS_STUDENT') then - alter table "borrow-return" - delete foreign key "FK_BORROW-R_RELATIONS_STUDENT" -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW-R_RELATIONS_FLOOR') then - alter table "borrow-return" - delete foreign key "FK_BORROW-R_RELATIONS_FLOOR" -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW-R_RELATIONS_BOOKSHEL') then - alter table "borrow-return" - delete foreign key "FK_BORROW-R_RELATIONS_BOOKSHEL" -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW-R_RELATIONS_LIBRARIA') then - alter table "borrow-return" - delete foreign key "FK_BORROW-R_RELATIONS_LIBRARIA" -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_FLOOR_RELATIONS_LIBRARY') then - alter table floor - delete foreign key FK_FLOOR_RELATIONS_LIBRARY -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_����_����_STUDENT') then - alter table ���� - delete foreign key FK_����_����_STUDENT -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_����_����2_LIBRARIA') then - alter table ���� - delete foreign key FK_����_����2_LIBRARIA -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_����_����_LIBRARIA') then - alter table ���� - delete foreign key FK_����_����_LIBRARIA -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_����_����2_BOOK') then - alter table ���� - delete foreign key FK_����_����2_BOOK -end if; - -drop index if exists book.Relationship_3_FK; - -drop index if exists book.book_PK; - -drop table if exists book; - -drop index if exists bookshelf.Relationship_2_FK; - -drop index if exists bookshelf.bookshelf_PK; - -drop table if exists bookshelf; - -drop index if exists "borrow-return".Relationship_10_FK; - -drop index if exists "borrow-return".Relationship_9_FK; - -drop index if exists "borrow-return".Relationship_8_FK; - -drop index if exists "borrow-return".Relationship_7_FK; - -drop index if exists "borrow-return".Relationship_6_FK; - -drop index if exists "borrow-return"."borrow-return_PK"; - -drop table if exists "borrow-return"; - -drop index if exists floor.Relationship_1_FK; - -drop index if exists floor.floor_PK; - -drop table if exists floor; - -drop index if exists librarian.librarian_PK; - -drop table if exists librarian; - -drop index if exists library.library_PK; - -drop table if exists library; - -drop index if exists student.student_PK; - -drop table if exists student; - -drop index if exists ����.����_FK; - -drop index if exists ����.����2_FK; - -drop index if exists ����.����_PK; - -drop table if exists ����; - -drop index if exists ����.����_FK; - -drop index if exists ����.����2_FK; - -drop index if exists ����.����_PK; - -drop table if exists ����; - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - id integer not null, - book_id integer not null, - name char(10) not null, - author char(5) not null, - constraint PK_BOOK primary key (id) -); - -/*==============================================================*/ -/* Index: book_PK */ -/*==============================================================*/ -create unique index book_PK on book ( -id ASC -); - -/*==============================================================*/ -/* Index: Relationship_3_FK */ -/*==============================================================*/ -create index Relationship_3_FK on book ( -book_id ASC -); - -/*==============================================================*/ -/* Table: bookshelf */ -/*==============================================================*/ -create table bookshelf -( - book_id integer not null, - fl_id integer not null, - book_name char(5) not null, - constraint PK_BOOKSHELF primary key (book_id) -); - -/*==============================================================*/ -/* Index: bookshelf_PK */ -/*==============================================================*/ -create unique index bookshelf_PK on bookshelf ( -book_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_2_FK */ -/*==============================================================*/ -create index Relationship_2_FK on bookshelf ( -fl_id ASC -); - -/*==============================================================*/ -/* Table: "borrow-return" */ -/*==============================================================*/ -create table "borrow-return" -( - b_id integer not null, - stu_id integer not null, - fl_id integer not null, - book_id integer not null, - libr_id integer not null, - id integer not null, - "time" timestamp not null, - "type(borrow,also)" char(10) not null, - constraint "PK_BORROW-RETURN" primary key (b_id) -); - -/*==============================================================*/ -/* Index: "borrow-return_PK" */ -/*==============================================================*/ -create unique index "borrow-return_PK" on "borrow-return" ( -b_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_6_FK */ -/*==============================================================*/ -create index Relationship_6_FK on "borrow-return" ( -stu_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_7_FK */ -/*==============================================================*/ -create index Relationship_7_FK on "borrow-return" ( -fl_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_8_FK */ -/*==============================================================*/ -create index Relationship_8_FK on "borrow-return" ( -book_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_9_FK */ -/*==============================================================*/ -create index Relationship_9_FK on "borrow-return" ( -libr_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_10_FK */ -/*==============================================================*/ -create index Relationship_10_FK on "borrow-return" ( -id ASC -); - -/*==============================================================*/ -/* Table: floor */ -/*==============================================================*/ -create table floor -( - fl_id integer not null, - li_id integer not null, - fi_name char(5) not null, - constraint PK_FLOOR primary key (fl_id) -); - -/*==============================================================*/ -/* Index: floor_PK */ -/*==============================================================*/ -create unique index floor_PK on floor ( -fl_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_1_FK */ -/*==============================================================*/ -create index Relationship_1_FK on floor ( -li_id ASC -); - -/*==============================================================*/ -/* Table: librarian */ -/*==============================================================*/ -create table librarian -( - libr_id integer not null, - libr_name char(5) not null, - constraint PK_LIBRARIAN primary key (libr_id) -); - -/*==============================================================*/ -/* Index: librarian_PK */ -/*==============================================================*/ -create unique index librarian_PK on librarian ( -libr_id ASC -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - li_id integer not null, - li_name varchar(10) not null, - constraint PK_LIBRARY primary key (li_id) -); - -/*==============================================================*/ -/* Index: library_PK */ -/*==============================================================*/ -create unique index library_PK on library ( -li_id ASC -); - -/*==============================================================*/ -/* Table: student */ -/*==============================================================*/ -create table student -( - stu_id integer not null, - stu_name char(5) not null, - stu_sex char(2) not null, - constraint PK_STUDENT primary key (stu_id) -); - -/*==============================================================*/ -/* Index: student_PK */ -/*==============================================================*/ -create unique index student_PK on student ( -stu_id ASC -); - -/*==============================================================*/ -/* Table: ���� */ -/*==============================================================*/ -create table ���� -( - stu_id integer not null, - libr_id integer not null, - timeʱ�� timestamp not null, - constraint PK_���� primary key (stu_id, libr_id) -); - -/*==============================================================*/ -/* Index: ����_PK */ -/*==============================================================*/ -create unique index ����_PK on ���� ( -stu_id ASC, -libr_id ASC -); - -/*==============================================================*/ -/* Index: ����2_FK */ -/*==============================================================*/ -create index ����2_FK on ���� ( -libr_id ASC -); - -/*==============================================================*/ -/* Index: ����_FK */ -/*==============================================================*/ -create index ����_FK on ���� ( -stu_id ASC -); - -/*==============================================================*/ -/* Table: ���� */ -/*==============================================================*/ -create table ���� -( - libr_id integer not null, - id integer not null, - "time" timestamp not null, - constraint PK_���� primary key (libr_id, id) -); - -/*==============================================================*/ -/* Index: ����_PK */ -/*==============================================================*/ -create unique index ����_PK on ���� ( -libr_id ASC, -id ASC -); - -/*==============================================================*/ -/* Index: ����2_FK */ -/*==============================================================*/ -create index ����2_FK on ���� ( -id ASC -); - -/*==============================================================*/ -/* Index: ����_FK */ -/*==============================================================*/ -create index ����_FK on ���� ( -libr_id ASC -); - -alter table book - add constraint FK_BOOK_RELATIONS_BOOKSHEL foreign key (book_id) - references bookshelf (book_id) - on update restrict - on delete restrict; - -alter table bookshelf - add constraint FK_BOOKSHEL_RELATIONS_FLOOR foreign key (fl_id) - references floor (fl_id) - on update restrict - on delete restrict; - -alter table "borrow-return" - add constraint "FK_BORROW-R_RELATIONS_BOOK" foreign key (id) - references book (id) - on update restrict - on delete restrict; - -alter table "borrow-return" - add constraint "FK_BORROW-R_RELATIONS_STUDENT" foreign key (stu_id) - references student (stu_id) - on update restrict - on delete restrict; - -alter table "borrow-return" - add constraint "FK_BORROW-R_RELATIONS_FLOOR" foreign key (fl_id) - references floor (fl_id) - on update restrict - on delete restrict; - -alter table "borrow-return" - add constraint "FK_BORROW-R_RELATIONS_BOOKSHEL" foreign key (book_id) - references bookshelf (book_id) - on update restrict - on delete restrict; - -alter table "borrow-return" - add constraint "FK_BORROW-R_RELATIONS_LIBRARIA" foreign key (libr_id) - references librarian (libr_id) - on update restrict - on delete restrict; - -alter table floor - add constraint FK_FLOOR_RELATIONS_LIBRARY foreign key (li_id) - references library (li_id) - on update restrict - on delete restrict; - -alter table ���� - add constraint FK_����_����_STUDENT foreign key (stu_id) - references student (stu_id) - on update restrict - on delete restrict; - -alter table ���� - add constraint FK_����_����2_LIBRARIA foreign key (libr_id) - references librarian (libr_id) - on update restrict - on delete restrict; - -alter table ���� - add constraint FK_����_����_LIBRARIA foreign key (libr_id) - references librarian (libr_id) - on update restrict - on delete restrict; - -alter table ���� - add constraint FK_����_����2_BOOK foreign key (id) - references book (id) - on update restrict - on delete restrict; - - -~~~ - diff --git "a/17 \345\221\250\345\257\214/20230917\346\261\275\350\275\246\344\275\234\344\270\232.md" "b/17 \345\221\250\345\257\214/20230917\346\261\275\350\275\246\344\275\234\344\270\232.md" deleted file mode 100644 index 41cc2b748030eaae1c2dcb029afd40a05e1ccdec..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/20230917\346\261\275\350\275\246\344\275\234\344\270\232.md" +++ /dev/null @@ -1,144 +0,0 @@ -~~~mysql -# 任务: - -- 给一个汽车商店设计销售系统的数据库 - -- 顶层实体:汽车、顾客、销售员 - -# 目标: - -- 完成概念模型、逻辑模型、物理模型 - -- 生成DDL SQL语句,建立对应数据库和表结构 - -- 模拟真实数据给每个表插入一些数据。并根据应用场景需求完成 DQL语句 - -# 需求: - -- 1.能记录在售车型的信息、销售员的基本信息、客户的基本信息 - -- 2.进行车辆售卖时,记录销售员、客户、销售日期、实际售卖价格等信息 - -- 3.满足实际应用场景下的数据查询功能 - - -# 应用场景: - -- 1.查询特定销售员的销售记录 - -- 2.查找销售记录中销售价格最高的汽车 - -- 3.统计某个销售员的销售总额 - -- 4.根据客户信息查询其购买过的汽车 - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - -- 8.统计每个销售员的销售数量 -CREATE DATABASE automobile charset utf8; -use automobile; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:58:41 */ -/*==============================================================*/ - - -drop table if exists car; - -drop table if exists client; - -drop table if exists contract; - -drop table if exists salesman; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - car_type varchar(20) not null, - car_introduce varchar(255) not null, - car_price numeric(8,0) not null, - primary key (car_id) -); -INSERT INTO car VALUES -(null,"奔驰","好",200000), -(null,"奥迪","很好",250000), -(null,"兰博基尼","超级好",500000), -(null,"法拉利","非常好",300000); -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - client_id int not null auto_increment, - client_name varchar(5) not null, - client_sex char(1) not null, - client_age int not null, - primary key (client_id) -); -INSERT INTO client VALUES -(null,"小红","男",20), -(null,"小绿","女",20), -(null,"小蓝","男",20), -(null,"小紫","女",20); -/*==============================================================*/ -/* Table: contract */ -/*==============================================================*/ -create table contract -( - contract_id int not null auto_increment, - car_id int, - salesman_id int, - client_id int, - contract_date date not null, - contract_money numeric(8,0) not null, - primary key (contract_id) -); -INSERT INTO contract VALUES -(NULL,2,4,1,"2022-9-8",300000), -(NULL,1,3,3,"2022-12-9",250000), -(NULL,3,1,4,"2022-11-8",1000000), -(NULL,4,4,3,"2022-10-9",8888888), -(NULL,2,2,2,"2022-8-6",300000); - - - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id int not null auto_increment, - salesman_name varchar(5) not null, - salesman_sex char(1) not null, - salesman_age int not null, - primary key (salesman_id) -); -INSERT INTO salesman VALUES -(null,"张三","男",35), -(null,"李四","女",30), -(null,"王五","男",40), -(null,"赵六","女",20); -alter table contract add constraint FK_Relationship_1 foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table contract add constraint FK_Relationship_2 foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - -alter table contract add constraint FK_Relationship_3 foreign key (client_id) - references client (client_id) on delete restrict on update restrict; - --- 1.查询特定销售员的销售记录 -SELECT * from contract a LEFT JOIN salesman b on a.salesman_id=b.salesman_id WHERE salesman_name="张三"; - -- 2.查找销售记录中销售价格最高的汽车 - SELECT car_type , contract_money FROM contract a LEFT JOIN car b on a.car_id = b.car_id WHERE contract_money in( SELECT max(contract_money) FROM contract ) ; - - -- 3.统计某个销售员的销售总额 -SELECT salesman_name 销售员,sum(contract_money) 销售总额 from contract a LEFT JOIN salesman b on a.salesman_id=b.salesman_id WHERE salesman_name in (SELECT salesman_name FROM salesman WHERE salesman_name = "赵六"); - - -- 4.根据客户信息查询其购买过的汽车 - SELECT client_name,car_type FROM client a LEFT JOIN contract b on a.client_id = b.client_id LEFT JOIN car c on b.car_id = c.car_id; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - SELECT car_type 品牌,sum(contract_money) 销售总额,count(c.car_id) 销售数量 FROM contract b LEFT JOIN car c on b.car_id = c.car_id GROUP BY car_type; - -- 6.检索特定日期范围内的销售了哪些汽车 - SELECT * FROM contract a LEFT JOIN car c on a.car_id = c.car_id WHERE contract_date between "2022-10-1" and "2022-12-30"; - -- 7.查找某车型的销售历史。 - SELECT car_type,contract_date FROM contract a LEFT JOIN car c on a.car_id = c.car_id WHERE car_type = "奥迪" ; - -- 8.统计每个销售员的销售数量 - SELECT salesman_name 销售员, count(b.salesman_id) 销售数量 from contract a LEFT JOIN salesman b on a.salesman_id = b.salesman_id GROUP BY salesman_name; - - - - -~~~ - diff --git "a/17 \345\221\250\345\257\214/20230922\351\242\204\344\271\240.md" "b/17 \345\221\250\345\257\214/20230922\351\242\204\344\271\240.md" deleted file mode 100644 index 7ec8ea4bd89b149176fbb9333734ff525565835a..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/20230922\351\242\204\344\271\240.md" +++ /dev/null @@ -1,45 +0,0 @@ -## 数据库高级 - -#### 1.事务 - - 为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - -#### 事务的四个特性 - - 1.原子性:事务包含的这一系列操作,要么全部成功,要么全部失败 - - 2.一致性:事务完成之后,不会将非法的数据写入数据库。 - - 3.隔离性:多个事务可以在一定程度上并发执行 - - 4.持久性:事务完成之后,数据要永久保存 - -#### 2.视图 - - 在已有的表或者视图上创建的虚拟表 - - 创建视图: create view 视图名 asselect - - 可以对(单表)视图进行一些增删改查的操作,这些操作会影响到原始的表 - - 删除视图:drop view 视图名 - -#### 3.索引 - - 为了提高查询的速度而在数据库断创建的一种排序的数据结构 - -#### 4.储存过程 - - 存储在数据库端的一组为了完成特点功能的sql语句 - - 存储过程:create procedure 存储过程名(【参数】) - - 参数格式(参数类型 参数名 数据类型) - - 参数类型有三种 - - IN:输入参数,改参数的值必须在调用该存储过程时指定,在存储过程内部使用,不能返回。缺省值是IN - - OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - - INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回 \ No newline at end of file diff --git "a/17 \345\221\250\345\257\214/20230926\350\247\206\345\233\276\347\254\224\350\256\260.md" "b/17 \345\221\250\345\257\214/20230926\350\247\206\345\233\276\347\254\224\350\256\260.md" deleted file mode 100644 index 502bfb45e99bf47d38c8aad4158108db5d66cf74..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/20230926\350\247\206\345\233\276\347\254\224\350\256\260.md" +++ /dev/null @@ -1,104 +0,0 @@ -## 新增约束 - -check 作用:检查某个字段的值是否符合xx要求。 - -一般是指范围(age,int,age>0) - -格式 check (字段名 in ('男','女')) - -在utf8中一个汉字等于一个字符等于3个字节。 - -## 视图(view) - -视图是一种虚拟表,本身是不具有数据的。 - -可以把查的临时表数据保存在视图里方便查询 - -create view 名称 as 查询语句 - -concat(“字段名”,“字段名”)(可以把字段结合在一起) - -查视图对象 - -show tables - -查看创建视图的语句 - -show create view 视图名称 - -当视图和基表是一对一的时候可以更新。 - -修改视图语句 - -1.create or replace view 视图名称 as 查询语句 (有就更新 没有就创建) - -2.alter view 视图名称 as 查询语句 (一定要存在被修改的视图) - -删除视图 - -drop view 视图名称 - -drop view if exists 视图名称(有就删除没有就跳过) - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -CREATE VIEW employee_vu(姓名,员工号,部门号) as SELECT LAST_NAME,EMPLOYEE_ID,DEPARTMENT_ID FROM employees; - - -#2. 显示视图的结构 -desc employee_vu; - - -#3. 查询视图中的全部内容 -SELECT * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 - -ALTER view employee_vu as SELECT LAST_NAME,EMPLOYEE_ID,DEPARTMENT_ID FROM employees WHERE DEPARTMENT_ID<=80; -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -SELECT * from emp_v1; -CREATE view emp_v1(员工姓名,工资,邮箱) as SELECT last_name,salary,email from employees where phone_number like "011%"; - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -SELECT * from emp_v1; - -ALTER view emp_v1 as SELECT last_name,salary,email,phone_number from employees where phone_number like "011%" and email like "%e%"; -#3. 向 emp_v1 插入一条记录,是否可以? -不可以 - - - - - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -update emp_v1 set salary = salary + 1000; - -#5. 删除emp_v1中姓名为Olsen的员工 -DELETE from emp_v1 where last_name like "Olsen"; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -SELECT max(salary) 最高工资 from employees a LEFT JOIN departments b on a.department_id=b.department_id GROUP BY department_name; - -CREATE view cmp_v2 as SELECT max(salary) 最高工资,department_id from employees WHERE salary >12000 GROUP BY department_id; - - - - - -#7. 向 emp_v2 中插入一条记录,是否可以? - -不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 -DROP view if exists cmp_v2; -DROP view emp_v1; \ No newline at end of file diff --git "a/17 \345\221\250\345\257\214/RBAC\347\254\224\350\256\260.md" "b/17 \345\221\250\345\257\214/RBAC\347\254\224\350\256\260.md" deleted file mode 100644 index 969a816d860b5061d9763f1dc1ebc35f0fb33da1..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/RBAC\347\254\224\350\256\260.md" +++ /dev/null @@ -1,8 +0,0 @@ -### RBAC:基于角色的访问权限管理控制模型 - -RBAC的概念:一种数据库的设计思想,目前开发系统的主流设计思想。 - -用户—>角色—>权限 - -RBAC的核心是角色 - diff --git "a/17 \345\221\250\345\257\214/SKU\344\275\234\344\270\232\347\254\224\350\256\260.md" "b/17 \345\221\250\345\257\214/SKU\344\275\234\344\270\232\347\254\224\350\256\260.md" deleted file mode 100644 index 3b81bac89c2ddbbeb925f865d83a92291e191c1d..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/SKU\344\275\234\344\270\232\347\254\224\350\256\260.md" +++ /dev/null @@ -1,176 +0,0 @@ -SPU -->多个SKU(规格)(最小库存规格)—>(多个属性)。 - -不同的SKU有不同的编号。 - -~~~mysql - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/21 17:34:09 */ -/*==============================================================*/ - - -CREATE DATABASE csgo charset utf8; -use csgo; - -drop table if exists ability; - -drop table if exists attributes; - -drop table if exists sku; - -drop table if exists sku_spe; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: ability */ -/*==============================================================*/ -create table ability -( - ab_id int not null auto_increment, - ab_name char(20) not null, - primary key (ab_id) -); - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - att_id int not null auto_increment, - att_name char(20) not null, - primary key (att_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int not null, - sku_title varchar(100) not null, - price decimal(8,2) not null, - repertory int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: sku_spe */ -/*==============================================================*/ -create table sku_spe -( - se_id int not null auto_increment, - sku_id int, - att_id int, - ab_id int, - primary key (se_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(20) not null, - spu_details varchar(100) not null, - primary key (spu_id) -); - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -alter table sku_spe add constraint FK_Relationship_2 foreign key (sku_sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table sku_spe add constraint FK_Relationship_3 foreign key (att_id) - references attributes (att_id) on delete restrict on update restrict; - -alter table sku_spe add constraint FK_Relationship_4 foreign key (ab_id) - references ability (ab_id) on delete restrict on update restrict; - - -INSERT INTO `spu` VALUES (1, '沙漠之鹰', '便宜好用'); - -INSERT INTO `ability` VALUES (1, '炽烈之炎'); -INSERT INTO `ability` VALUES (2, '手上加农炮'); -INSERT INTO `ability` VALUES (3, '沙漠之狐'); -INSERT INTO `ability` VALUES (4, '略磨'); -INSERT INTO `ability` VALUES (5, '崭新'); - -INSERT INTO `sku` VALUES (1, 1, '沙漠之鹰|炽烈之炎崭新', 5230.50, 100); -INSERT INTO `sku` VALUES (2, 1, '沙漠之鹰|炽烈之炎略磨', 4270.00, 200); -INSERT INTO `sku` VALUES (3, 1, '沙漠之鹰|手上加农炮崭新', 5000.00, 300); -INSERT INTO `sku` VALUES (4, 1, '沙漠之鹰|手上加农炮略磨', 4000.00, 400); -INSERT INTO `sku` VALUES (5, 1, '沙漠之鹰|沙漠之狐崭新', 3468.00, 500); -INSERT INTO `sku` VALUES (6, 1, '沙漠之鹰|沙漠之狐略磨', 2589.00, 600); - -INSERT INTO `attributes` VALUES (1, '皮肤'); -INSERT INTO `attributes` VALUES (2, '磨损'); - - -INSERT INTO `sku_spe` VALUES (1, 1, 1, 1); -INSERT INTO `sku_spe` VALUES (2, 1, 2, 5); -INSERT INTO `sku_spe` VALUES (3, 2, 1, 1); -INSERT INTO `sku_spe` VALUES (4, 2, 2, 4); -INSERT INTO `sku_spe` VALUES (5, 3, 1, 2); -INSERT INTO `sku_spe` VALUES (6, 3,2, 5); -INSERT INTO `sku_spe` VALUES (7, 4, 1, 2); -INSERT INTO `sku_spe` VALUES (8, 4, 2, 4); -INSERT INTO `sku_spe` VALUES (9, 5, 1,3); -INSERT INTO `sku_spe` VALUES (10, 5, 2, 5); -INSERT INTO `sku_spe` VALUES (11, 6, 1, 3); -INSERT INTO `sku_spe` VALUES (12, 6, 2, 4); - --- 查询1 - -SELECT - a.spu_id, - a.spu_details, - b.sku_title, - b.price, - b.repertory, - e.att_name, - d.ab_name -FROM - spu a, - sku b, - sku_spe c, - ability d, - attributes e -WHERE - a.spu_id = b.spu_id - AND b.sku_id = c.sku_id - AND c.ab_id = d.ab_id - AND c.att_id = e.att_id; - - --- 查询2 - SELECT - b.sku_id, - a.spu_details, - b.sku_title, - b.price, - b.repertory, - e.att_name, - d.ab_name -FROM - spu a, - sku b, - sku_spe c, - ability d, - attributes e -WHERE - a.spu_id = b.spu_id - AND b.sku_id = c.sku_id - AND c.ab_id = d.ab_id - AND c.att_id = e.att_id - and c.sku_id=( -SELECT f.sku_id FROM -(SELECT sku_id FROM sku_spe sp,ability ab where sp.ab_id=ab.ab_id and ab_name='炽烈之炎') f, -(SELECT sku_id FROM sku_spe sp,ability ab where sp.ab_id=ab.ab_id and ab_name='略磨') g -where f.sku_id=g.sku_id); -~~~ - diff --git "a/17 \345\221\250\345\257\214/mysql\345\244\215\344\271\240.md" "b/17 \345\221\250\345\257\214/mysql\345\244\215\344\271\240.md" deleted file mode 100644 index d656a8bcc4ada23d3f1751305e4677865b68872d..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/mysql\345\244\215\344\271\240.md" +++ /dev/null @@ -1,759 +0,0 @@ -CREATE DATABASE xiaoche charset utf8; -use xiaoche; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 -SELECT sum(salary*12) ,(sum(salary)+sum(commission_pct*salary))*12 奖金 from employees; - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct -SELECT distinct job_id from employees; - - -# 3.查询工资大于12000的员工姓名和工资 -SELECT last_name,salary from employees WHERE salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 -SELECT last_name,department_id from employees WHERE employee_id=176; - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -SELECT * from departments; -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -SELECT last_name,salary from employees WHERE salary not BETWEEN 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -SELECT last_name,department_id from employees WHERE department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -SELECT last_name,job_id from employees WHERE manager_id is null; - - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -SELECT last_name,salary,b.grade_level 奖金等级,commission_pct*salary from employees a LEFT JOIN job_grades b on a.commission_pct*salary BETWEEN b.lowest_sal and b.highest_sal WHERE a.commission_pct is not null ; - - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -SELECT * from employees WHERE last_name like "__尔"; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -SELECT * from employees WHERE last_name like "%尔%" and last_name like "%特%"; - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -SELECT * from employees WHERE last_name like "%尔"; - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -SELECT last_name,job_id from employees WHERE department_id BETWEEN 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -SELECT last_name,salary,manager_id from employees where manager_id in (100,101,110); - - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - SELECT last_name,department_id, salary*12 年薪 FROM employees ORDER BY 年薪 desc; -# - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -SELECT last_name,salary from employees WHERE salary not BETWEEN 8000 and 17000 order by salary desc LIMIT 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -SELECT * from employees WHERE email like "%e%" order by length(email) desc,department_id asc; - - - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -SELECT a.last_name,a.department_id,b.department_name from employees a LEFT JOIN departments b on a.department_id=b.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id -SELECT job_id,location_id from employees a LEFT JOIN departments b on a.department_id=b.department_id WHERE a.department_id=90 ; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -SELECT a.last_name,b.department_name,c.location_id,c.city from employees a LEFT JOIN departments b on a.department_id = b.department_id LEFT JOIN locations c on b.location_id = c.location_id WHERE a.commission_pct is not null; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -SELECT a.last_name,a.job_id,b.department_id,b.department_name,city from employees a LEFT JOIN departments b on a.department_id = b.department_id LEFT JOIN locations c on b.location_id = c.location_id WHERE city = "多伦多"; - -#sql92语法(自然连接): - -SELECT * from employees a , departments b WHERE a.department_id=b.department_id; - - -# 5.查询行政部门员工的、、、、 - - -SELECT a.last_name 姓名,b.department_name 部门名称,city 部门地址,salary 工资,d.job_title 工作 from employees a LEFT JOIN departments b on a.department_id = b.department_id LEFT JOIN locations c on b.location_id = c.location_id LEFT JOIN jobs d on a.job_id = d.job_id WHERE b.department_name="行政部" ; - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - - -SELECT * from employees; - -# 7.查询哪些部门没有员工 -SELECT * FROM departments d left join employees l on l.department_id=d.department_id WHERE l.last_name is null; - -# 8. 查询哪个城市没有部门 -SELECT * FROM locations l left join departments d on d.location_id = l.location_id WHERE department_name is null; - - - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -SELECT * from employees a LEFT JOIN departments b on a.department_id = b.department_id where department_name= "销售部" or department_name="信息技术部"; - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的,,, - -SELECT max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees; -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -SELECT job_id, max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees GROUP BY job_id; - -#4.选择各个job_id的 -SELECT job_id,count(employee_id) 员工人数 from employees GROUP BY job_id; -# 5.查询员工最高工资和最低工资的差距 - -SELECT max(salary)-min(salary) 最高工资和最低工资的差距 from employees; -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 -SELECT manager_id,min(salary) 最低工资 from employees GROUP BY manager_id HAVING 最低工资>=6000 and manager_id is not null; - - - - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -SELECT b.department_name 部门名称,location_id,count(a.employee_id) 员工数量,avg(a.salary) 平均工资 from departments b LEFT JOIN employees a on a.department_id = b.department_id GROUP BY b.department_name desc,location_id; - - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 -SELECT job_title 工种, department_name 部门名,min(salary) from employees a LEFT JOIN departments b on a.department_id = b.department_id LEFT JOIN jobs c on a.job_id=c.job_id GROUP BY job_title,department_name; - - - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -SELECT last_name,salary from employees a LEFT JOIN departments b on a.department_id = b.department_id WHERE department_name in (SELECT department_name from employees a LEFT JOIN departments b on a.department_id = b.department_id WHERE last_name="兹洛特基") -; - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -SELECT employee_id,last_name,salary from employees where salary>( -SELECT avg(salary) from employees) ; - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary -SELECT last_name, job_id, salary from employees WHERE salary >( -SELECT max(salary) FROM employees where job_id="SA_MAN"); - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -SELECT employee_id,last_name -FROM employees ; - - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -SELECT employee_id from employees a LEFT JOIN departments b on a.department_id = b.department_id WHERE location_id in( -SELECT location_id from locations WHERE location_id =1700); - - -#6.查询管理者是 金 的员工姓名和工资 -SELECT last_name,salary from employees where manager_id in ( -SELECT employee_id from employees where last_name = "金" and manager_id is null); - - - -#7.查询工资最低的员工信息: last_name, salary -SELECT last_name, salary from employees WHERE salary in ( -SELECT min(salary) from employees) ; - - -#8.查询平均工资最低的部门信息 -SELECT b.*,avg(salary) 平均工资 from employees a LEFT JOIN departments b on a.department_id = b.department_id GROUP BY b.department_id ORDER BY 平均工资 asc LIMIT 1; - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - - - -​ -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - -#10.查询平均工资最高的 job 信息 -SELECT * FROM jobs WHERE job_id = ( SELECT job_id FROM employees GROUP BY job_id HAVING AVG( salary ) >= ALL ( SELECT AVG( salary ) FROM employees GROUP BY job_id ) );#方式1:平均工资=最大 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - - - - -#11.查询平均工资高于公司平均工资的部门有哪些? -SELECT department_id FROM employees WHERE department_id IS NOT NULL GROUP BY department_id HAVING AVG( salary ) > ( SELECT AVG( salary ) FROM employees ); - - - -#12.查询出公司中所有 manager 的详细信息 -SELECT employee_id, last_name, salary FROM employees WHERE employee_id IN ( SELECT DISTINCT manager_id FROM employees ); -#方式1:自连接 自己连自己 - - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - - - -​ -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - - - -#方式: -SELECT * FROM employees WHERE department_id = 10; - - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - -SELECT department_id FROM departments WHERE department_id NOT IN ( SELECT DISTINCT department_id FROM employees WHERE job_id = 'ST_CLERK' ); - - - -#16. 选择所有没有管理者的员工的last_name -SELECT last_name FROM employees e1 WHERE NOT EXISTS ( SELECT * FROM employees e2 WHERE e1.manager_id = e2.employee_id ); - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: -SELECT employee_id,last_name,hire_date,salary FROM employees WHERE manager_id = ( SELECT employee_id FROM employees WHERE last_name = 'De Haan' ); - -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -SELECT department_name, department_id FROM departments d WHERE 5 < ( SELECT COUNT(*) FROM employees e WHERE d.department_id = e.department_id ); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) -SELECT country_id FROM locations l WHERE 2 < ( SELECT COUNT(*) FROM departments d WHERE l.`location_id` = d.`location_id` ); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ \ No newline at end of file diff --git "a/17 \345\221\250\345\257\214/\345\214\273\351\231\242.md" "b/17 \345\221\250\345\257\214/\345\214\273\351\231\242.md" deleted file mode 100644 index 64728078d7dfee247f970b8e7a6b552461824068..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/\345\214\273\351\231\242.md" +++ /dev/null @@ -1,144 +0,0 @@ -![屏幕截图 2023-09-14 005531](https://s2.loli.net/2023/09/14/UeQm4REbwiBAyHr.png) - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 0:55:40 */ -/*==============================================================*/ - -CREATE DATABASE hospital CHARSET utf8; -use hospital; -drop table if exists diagnose2; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists patient; - -drop table if exists pharmacy; - -drop table if exists prescription; - -drop table if exists registration; - -drop table if exists type; - -/*==============================================================*/ -/* Table: diagnose2 */ -/*==============================================================*/ -create table diagnose2 -( - patient_id int not null, - doctor_id int not null, - illness varchar(255) not null, - primary key (patient_id, doctor_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - type_id int, - doctor_name varchar(5) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - drug_name varchar(20) not null, - drug_intro varchar(200) not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(5) not null, - patient_sex char(1) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: pharmacy */ -/*==============================================================*/ -create table pharmacy -( - pharmacy int not null auto_increment, - pharmacy_name varchar(10) not null, - primary key (pharmacy) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - prescription_id int not null, - doctor_id int, - patient_id int, - drug_id int, - pharmacy int, - primary key (prescription_id) -); - -/*==============================================================*/ -/* Table: registration */ -/*==============================================================*/ -create table registration -( - reg_id char(10) not null, - doctor_id int not null, - patient_id int not null, - primary key (reg_id, doctor_id, patient_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name varchar(5) not null, - primary key (type_id) -); - -alter table diagnose2 add constraint FK_diagnose foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table diagnose2 add constraint FK_diagnose2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table doctor add constraint FK_Relationship_5 foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_Relationship_6 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_Relationship_7 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_Relationship_8 foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_Relationship_9 foreign key (pharmacy) - references pharmacy (pharmacy) on delete restrict on update restrict; - -alter table registration add constraint FK_registration foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table registration add constraint FK_registration2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - - -~~~ - diff --git "a/17 \345\221\250\345\257\214/\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" "b/17 \345\221\250\345\257\214/\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index 69ed06b094bf52e7f4064f4eb07bea19244bffb7..0000000000000000000000000000000000000000 --- "a/17 \345\221\250\345\257\214/\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,180 +0,0 @@ -![屏幕截图 2023-09-12 184900](https://s2.loli.net/2023/09/12/BzADMuUEZWYQvl9.png) - - - -~~~MYSQL -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 18:42:47 */ -/*==============================================================*/ - - -drop table if exists actor; - -drop table if exists country; - -drop table if exists director; - -drop table if exists evaluate; - -drop table if exists info; - -drop table if exists language; - -drop table if exists movie; - -drop table if exists scriptwriter; - -drop table if exists type; - -drop table if exists user; - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - info_id int not null, - mov_id int not null, - primary key (info_id, mov_id) -); - -/*==============================================================*/ -/* Table: country */ -/*==============================================================*/ -create table country -( - cou_id int not null auto_increment, - cou_name char(10) not null, - primary key (cou_id) -); - -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - info_id int not null, - mov_id int not null, - primary key (info_id, mov_id) -); - -/*==============================================================*/ -/* Table: evaluate */ -/*==============================================================*/ -create table evaluate -( - user_id int not null, - mov_id int not null, - headline char(50) not null, - content varchar(255) not null, - primary key (user_id, mov_id) -); - -/*==============================================================*/ -/* Table: info */ -/*==============================================================*/ -create table info -( - info_id int not null auto_increment, - info_name char(10) not null, - info_sex char(1) not null, - constellation char(3) not null, - date_of_birth datetime not null, - birthplace char(10) not null, - occupation char(5) not null, - primary key (info_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - lang_id int not null auto_increment, - lang_name char(10) not null, - primary key (lang_id) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - mov_id int not null auto_increment, - type_id int not null, - cou_id int not null, - lang_id int not null, - mov_name char(10) not null, - "be on_time" datetime not null, - min int not null, - mov_brief varchar(255) not null, - primary key (mov_id) -); - -/*==============================================================*/ -/* Table: scriptwriter */ -/*==============================================================*/ -create table scriptwriter -( - info_id int not null, - mov_id int not null, - primary key (info_id, mov_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name char(10) not null, - primary key (type_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_name char(20) not null, - primary key (user_id) -); - -alter table actor add constraint FK_Relationship_12 foreign key (mov_id) - references movie (mov_id) on delete restrict on update restrict; - -alter table actor add constraint FK_Relationship_8 foreign key (info_id) - references info (info_id) on delete restrict on update restrict; - -alter table director add constraint FK_Relationship_13 foreign key (mov_id) - references movie (mov_id) on delete restrict on update restrict; - -alter table director add constraint FK_Relationship_9 foreign key (info_id) - references info (info_id) on delete restrict on update restrict; - -alter table evaluate add constraint FK_Relationship_11 foreign key (mov_id) - references movie (mov_id) on delete restrict on update restrict; - -alter table evaluate add constraint FK_Relationship_7 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_4 foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_5 foreign key (cou_id) - references country (cou_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_6 foreign key (lang_id) - references language (lang_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_Relationship_10 foreign key (info_id) - references info (info_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_Relationship_14 foreign key (mov_id) - references movie (mov_id) on delete restrict on update restrict; - - -~~~ - diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230905\347\254\224\350\256\260.md" "b/18 \345\276\220\346\260\270\346\267\263/20230905\347\254\224\350\256\260.md" deleted file mode 100644 index ecd46743475a9926d517a0046a8c004e99880e34..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230905\347\254\224\350\256\260.md" +++ /dev/null @@ -1,31 +0,0 @@ -## 大二任务 - -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/18 \345\276\220\346\260\270\346\267\263/20230906\347\254\224\350\256\260.md" "b/18 \345\276\220\346\260\270\346\267\263/20230906\347\254\224\350\256\260.md" deleted file mode 100644 index 64c995ad17daacc06a9d5adb336888a71e0a7a32..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230906\347\254\224\350\256\260.md" +++ /dev/null @@ -1,28 +0,0 @@ -数据库的三种关系: - -一对一:例一个人只有一个身份证 - -一对多:例一个班级有多个学生,而学生只有一个班级 - -多对多:一个课程可以被多个学生选修,多个学生也可以选修一个课程 - -一对一的实例 - -在数据库建表的时候,可以将 - -人数据库的主键放在身份证里,虽然身份证表的主键也可以放进人表里,不过你不能进入警察局把信息改了吧 - -![20200226200140908.png (632×132)](https://img-blog.csdnimg.cn/20200226200140908.png) - -一对多的实例 - -班级是1端,而学生是n端,利用面向对象的原理,1是父亲,n是儿子,所以儿子拥有父亲的所有属性,也就是n端里面应该放进1端的主键,也就是学生表应该放进班级的主键 - -![img](https://img-blog.csdnimg.cn/20200226200200688.png) - -多对多的实例 - -对于多对多关系,需要转换成1对多关系,那么就需要一张中间表来转换,这张中间表里面需要存放学生表里面的主键和课程表里面的主键,此时学生与中间表示1对多关系,课程与中间表是1对多关系,学生与课程是多对多关系 - -![image-20230907000501486](C:\Users\86173\AppData\Roaming\Typora\typora-user-images\image-20230907000501486.png) - diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230907\344\275\234\344\270\232.md" "b/18 \345\276\220\346\260\270\346\267\263/20230907\344\275\234\344\270\232.md" deleted file mode 100644 index 0246a30a2589db0cb9d3c61ba11d7b6736afd1cb..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230907\344\275\234\344\270\232.md" +++ /dev/null @@ -1,71 +0,0 @@ - - -```sql -create database school charset utf8; -use school; --- 学院表 -create table deparment( -d_id int primary key auto_increment, -d_name varchar(50) -); --- 专业表 -create table major( -m_id int primary key, -m_name varchar(50), -foreign key (m_id) references deparment(d_id) -); --- 班级表 -create table class( -cl_id int primary key, -cl_name varchar(50), -foreign key (cl_id) references major(m_id) -); --- 学生表 -create table student( -stu_id int primary key, -stu_name varchar(50), -stu_sex enum('男','女'), -stu_age int, -foreign key (stu_id) references class(cl_id) -); --- 课程信息表 -create table course( -cou_id int primary key, -cou_name varchar(50), -foreign key (cou_id) references student(stu_id) -); --- 成绩表 -create table score( -sc_id int, -sc_performance double(3,1), -stu_id int, -cou_id int, -foreign key (stu_id) references student(stu_id), -foreign key (cou_id) references course(cou_id) -); - --- 老师表 -create table teacher( -t_id int primary key, -t_name varchar(50), -t_sex enum('男','女'), -t_age int -); --- 教室表 -create table classroom( -cr_id int primary key, -cr_name varchar(50) -); --- 课程表 -create table timetable( -otto_section int, -otto_week varchar(50), -stu_id int, -t_id int, -cr_id int, -foreign key (stu_id) references student(stu_id), -foreign key (t_id) references teacher(t_id), -foreign key (cr_id) references classroom(cr_id) -); -``` - diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230907\347\254\224\350\256\260.md" "b/18 \345\276\220\346\260\270\346\267\263/20230907\347\254\224\350\256\260.md" deleted file mode 100644 index 9916349d4067ba736074abe408b7a12c5111bfb3..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230907\347\254\224\350\256\260.md" +++ /dev/null @@ -1,15 +0,0 @@ -设计关系数据库时,遵从不同的规范要求,设计出合理的[关系型数据库](https://baike.baidu.com/item/关系型数据库/8999831?fromModule=lemma_inlink),这些不同的[规范要求](https://baike.baidu.com/item/规范要求/55443795?fromModule=lemma_inlink)被称为不同的范式,各种范式呈递次规范,越高的范式数据库冗余越小。 - -第一范式 - -第一范式主要是确保数据表中每个字段的值必须具有`原子性`,也就是说数据表中每个字段的值为`不可再次拆分`的最小数据单元。 -我们在设计某个字段的时候,对于字段X来说,不能把字段X拆分成字段X-1和字段X-2。事实上都会满足第一范式的要求,不会将字段进行拆分。 - -第二范式 - -第一范式主要是确保数据表中每个字段的值必须具有`原子性`,也就是说数据表中每个字段的值为`不可再次拆分`的最小数据单元。 -我们在设计某个字段的时候,对于字段X来说,不能把字段X拆分成字段X-1和字段X-2。事实上都会满足第一范式的要求,不会将字段进行拆分。 - -第三范式 - -第三范式是在第二范式的基础上,确保数据表中的每一个非主键字段都和主键字段直接相关,也就是说,要求数据表中的所有非主键字段不能依赖于其他非主键字段。(即,不能存在非主属性A依赖于非主属性B,非主属性B依赖于主键c的情况,即存在"A→B→C""的决定关系)通俗地讲,该规则的意思是所有非主键属性之间不能有依赖关系,必须相互独立。 diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230911\344\275\234\344\270\232.md" "b/18 \345\276\220\346\260\270\346\267\263/20230911\344\275\234\344\270\232.md" deleted file mode 100644 index f58f1bb802a3732ce80fcb65d885b048be8b78b7..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230911\344\275\234\344\270\232.md" +++ /dev/null @@ -1,66 +0,0 @@ -````mysql -*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 22:13:24 */ -/*==============================================================*/ -CREATE DATABASE books charset utf8; -use books; - -drop table if exists book; - -drop table if exists guanli; - -drop table if exists jie; - -drop table if exists librarian; - -drop table if exists library; - -drop table if exists reader; - -drop table if exists system; - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - bo_id char(10) not null, - sys_id int not null, - bo_name char(10) not null, - bo_author char(10) not null, - primary key (bo_id) -); - -/*==============================================================*/ -/* Table: guanli */ -/*==============================================================*/ -create table guanli -( - sys_id int not null, - rar_id int not null, - primary key (sys_id, rar_id) -); - -/*==============================================================*/ -/* Table: jie */ -/*==============================================================*/ -create table jie -( - bo_id char(10) not null, - re_id int not null, - rar_id int, - primary key (bo_id, re_id) -); - -/*==============================================================*/ -/* Table: librarian */ -/*==============================================================*/ -create table librarian -( - rar_id int not null auto_increment, - lib_id int not null, - rar_name varch -``` -```` - diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230911\347\254\224\350\256\260.md" "b/18 \345\276\220\346\260\270\346\267\263/20230911\347\254\224\350\256\260.md" deleted file mode 100644 index c85fbbb646a2ed72e3df73055c89f47e9a6aa063..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230911\347\254\224\350\256\260.md" +++ /dev/null @@ -1,11 +0,0 @@ -软件:powerDesigner - -powerDesigner的使用过程,以及将概念模型转成数据库 - -首先 ,先创建概念模型(类似于E-R图)CMD客户的角度 - -其次,转为逻辑模型,LDM(以计算机的角度) - -再次,转成物理模型,PDM(以数据库的角度) - -最后,转为DDL \ No newline at end of file diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230912\344\275\234\344\270\232.md" "b/18 \345\276\220\346\260\270\346\267\263/20230912\344\275\234\344\270\232.md" deleted file mode 100644 index b5745aacffb9f1ff0ed06b46699cdf3c6d332c40..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230912\344\275\234\344\270\232.md" +++ /dev/null @@ -1,150 +0,0 @@ -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 23:06:06 */ -/*==============================================================*/ -create database cinema charset utf8; - -use cinema; - -drop table if exists AUDIENCE; - -drop table if exists COMMENT; - -drop table if exists DIRECTOR; - -drop table if exists KEY_PERSONNEL; - -drop table if exists MAIN_ACTOR; - -drop table if exists MOVIE; - -drop table if exists SCRIPTWRITER; - -drop table if exists SHORT_REVIEW; - -/*==============================================================*/ -/* Table: AUDIENCE */ -/*==============================================================*/ -create table AUDIENCE -( - AUDIENCE_ID int not null auto_increment, - AUDIENCE_NAME varchar(100) not null, - AUDIENCE_GENDER char(1) not null, - AUDIENCE_NUMBER varchar(20) not null, - primary key (AUDIENCE_ID) -); - -/*==============================================================*/ -/* Table: COMMENT */ -/*==============================================================*/ -create table COMMENT -( - COMMENT_ID int not null auto_increment, - AUDIENCE_ID int not null, - COMMENT_CONTENT varchar(500), - primary key (COMMENT_ID) -); - -/*==============================================================*/ -/* Table: DIRECTOR */ -/*==============================================================*/ -create table DIRECTOR -( - DIRECTOR_ID int not null auto_increment, - MOVIE_ID int not null, - DIRECTOR_NAME varchar(10) not null, - primary key (DIRECTOR_ID) -); - -/*==============================================================*/ -/* Table: KEY_PERSONNEL */ -/*==============================================================*/ -create table KEY_PERSONNEL -( - KP_ID int not null auto_increment, - DIRECTOR_ID int not null, - SW_ID int not null, - MA_ID int not null, - KP_NAME varchar(10) not null, - primary key (KP_ID) -); - -/*==============================================================*/ -/* Table: MAIN_ACTOR */ -/*==============================================================*/ -create table MAIN_ACTOR -( - MA_ID int not null auto_increment, - MOVIE_ID int not null, - MA_NAME varchar(10) not null, - primary key (MA_ID) -); - -/*==============================================================*/ -/* Table: MOVIE */ -/*==============================================================*/ -create table MOVIE -( - MOVIE_ID int not null auto_increment, - AUDIENCE_ID int, - MOVIE_NAME varchar(100) not null, - MOVIE_TYPE varchar(100) not null, - MOVIE_LANGUAGE varchar(10) not null, - MOVIE_TIME time not null, - MOVIE_DATA date not null, - primary key (MOVIE_ID) -); - -/*==============================================================*/ -/* Table: SCRIPTWRITER */ -/*==============================================================*/ -create table SCRIPTWRITER -( - SW_ID int not null auto_increment, - MOVIE_ID int not null, - SW_NAME varchar(10), - primary key (SW_ID) -); - -/*==============================================================*/ -/* Table: SHORT_REVIEW */ -/*==============================================================*/ -create table SHORT_REVIEW -( - SR_ID int not null auto_increment, - AUDIENCE_ID int not null, - SR_CONTENT varchar(1000) not null, - primary key (SR_ID) -); - -alter table COMMENT add constraint FK_RELATIONSHIP_9 foreign key (AUDIENCE_ID) - references AUDIENCE (AUDIENCE_ID) on delete restrict on update restrict; - -alter table DIRECTOR add constraint FK_RELATIONSHIP_1 foreign key (MOVIE_ID) - references MOVIE (MOVIE_ID) on delete restrict on update restrict; - -alter table KEY_PERSONNEL add constraint FK_RELATIONSHIP_4 foreign key (DIRECTOR_ID) - references DIRECTOR (DIRECTOR_ID) on delete restrict on update restrict; - -alter table KEY_PERSONNEL add constraint FK_RELATIONSHIP_5 foreign key (SW_ID) - references SCRIPTWRITER (SW_ID) on delete restrict on update restrict; - -alter table KEY_PERSONNEL add constraint FK_RELATIONSHIP_6 foreign key (MA_ID) - references MAIN_ACTOR (MA_ID) on delete restrict on update restrict; - -alter table MAIN_ACTOR add constraint FK_RELATIONSHIP_3 foreign key (MOVIE_ID) - references MOVIE (MOVIE_ID) on delete restrict on update restrict; - -alter table MOVIE add constraint FK_RELATIONSHIP_7 foreign key (AUDIENCE_ID) - references AUDIENCE (AUDIENCE_ID) on delete restrict on update restrict; - -alter table SCRIPTWRITER add constraint FK_RELATIONSHIP_2 foreign key (MOVIE_ID) - references MOVIE (MOVIE_ID) on delete restrict on update restrict; - -alter table SHORT_REVIEW add constraint FK_RELATIONSHIP_8 foreign key (AUDIENCE_ID) - references AUDIENCE (AUDIENCE_ID) on delete restrict on update restrict; - - -``` - diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230913\344\275\234\344\270\232.md" "b/18 \345\276\220\346\260\270\346\267\263/20230913\344\275\234\344\270\232.md" deleted file mode 100644 index 9e7cdd3ea807a208f8c7f9f98b75961feddd06fa..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230913\344\275\234\344\270\232.md" +++ /dev/null @@ -1,118 +0,0 @@ -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 21:29:20 */ -/*==============================================================*/ -create database hospital charset utf8; - -use hospital; - -drop table if exists DEPARTMENT; - -drop table if exists DISPENSARY; - -drop table if exists DOCTOR; - -drop table if exists PATIENT; - -drop table if exists PRESCRIPT; - -/*==============================================================*/ -/* Table: DEPARTMENT */ -/*==============================================================*/ -create table DEPARTMENT #科室 -( - DEPARTMENT_ID int not null auto_increment, - DEPARTMENT_NUMBER varchar(20) not null, - primary key (DEPARTMENT_ID) -); - -insert into department values (null,110); - -insert into department values (null,119); - -insert into department values (null,120); - -insert into department values (null,911); - -insert into department values (null,100086); - -insert into department values (null,12345); - -/*==============================================================*/ -/* Table: DISPENSARY */ -/*==============================================================*/ -create table DISPENSARY #取药 -( - DISPENSARY_ID int not null auto_increment, - DISPENSARY_NAME varchar(10) not null, - DISPENSARY_USAGE varchar(100) not null, - primary key (DISPENSARY_ID) -); - -insert into dispensary values (null,'吗丁啉','饭后吃'); - -/*==============================================================*/ -/* Table: DOCTOR */ -/*==============================================================*/ -create table DOCTOR #医生 -( - DOCTOR_ID int not null auto_increment, - DEPARTMENT_ID int , - DOCTOR_NAME varchar(10) not null, - DOCTOR_AGE int not null, - DOCTOR_GENDER char(1) not null, - primary key (DOCTOR_ID) -); - -insert into doctor values (1,1,'东方饭店',12,'男'); - -insert into doctor values (null,2,'西方饭店',21,'女'); - - -/*==============================================================*/ -/* Table: PATIENT */ -/*==============================================================*/ -create table PATIENT #病人 -( - PATIENT_ID int not null auto_increment, - DOCTOR_ID int, - PATIENT_NAME varchar(10) not null, - PATIENT_GENDER char(1) not null, - PATIENT_NUMBER varchar(20) not null, - primary key (PATIENT_ID) -); - -insert into patient values (null,1,'本地接送','男','12138'); - -insert into patient values (null,2,'外地接送','女','12333'); - -/*==============================================================*/ -/* Table: PRESCRIPT */ -/*==============================================================*/ -create table PRESCRIPT #药方 -( - DISPENSARY_ID int not null, - PATIENT_ID int not null, - primary key (DISPENSARY_ID, PATIENT_ID) -); - -insert into prescript values (1,1); - -insert into prescript values (2,2); - -alter table DOCTOR add constraint FK_SUBORDINATE foreign key (DEPARTMENT_ID) - references DEPARTMENT (DEPARTMENT_ID) on delete restrict on update restrict; - -alter table PATIENT add constraint FK_DIAGNOSE foreign key (DOCTOR_ID) - references DOCTOR (DOCTOR_ID) on delete restrict on update restrict; - -alter table PRESCRIPT add constraint FK_PRESCRIPT foreign key (DISPENSARY_ID) - references DISPENSARY (DISPENSARY_ID) on delete restrict on update restrict; - -alter table PRESCRIPT add constraint FK_PRESCRIPT2 foreign key (PATIENT_ID) - references PATIENT (PATIENT_ID) on delete restrict on update restrict; - - -``` - diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230913\347\254\224\350\256\260.md" "b/18 \345\276\220\346\260\270\346\267\263/20230913\347\254\224\350\256\260.md" deleted file mode 100644 index 4978f3e454c0fdde43b644d29eaa0d4930fffab7..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230913\347\254\224\350\256\260.md" +++ /dev/null @@ -1 +0,0 @@ -若表内字段有多个值时,可将这个值单独取出新建一个表 \ No newline at end of file diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230917\344\275\234\344\270\232.md" "b/18 \345\276\220\346\260\270\346\267\263/20230917\344\275\234\344\270\232.md" deleted file mode 100644 index 3ed073cb76aa1e0e9ad780af09631e6ca00fa0e3..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230917\344\275\234\344\270\232.md" +++ /dev/null @@ -1,135 +0,0 @@ - - -![无标题](D:\数据库高级作业\database-advanced\18 徐永淳\无标题.png) - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/17 15:29:00 */ -/*==============================================================*/ -create database autocar charset utf8; - -use autocar; - -drop table if exists BILL; - -drop table if exists CAR; - -drop table if exists CLIENT; - -drop table if exists MANAGA; - -drop table if exists SALESMAN; - -drop table if exists SELL; - -/*==============================================================*/ -/* Table: BILL */ -/*==============================================================*/ -create table BILL -( - BILL_ID int not null auto_increment, - CAR_ID int not null, - SALESMAN_ID int not null, - CLIENT_ID int not null, - DATE datetime not null, - MONEY numeric(9,2) not null, - primary key (BILL_ID) -); - -/*==============================================================*/ -/* Table: CAR */ -/*==============================================================*/ -create table CAR -( - CAR_ID int not null auto_increment, - CAR_NAME varchar(50) not null, - CAR_PRICE numeric(9,2) not null, - primary key (CAR_ID) -); - -/*==============================================================*/ -/* Table: CLIENT */ -/*==============================================================*/ -create table CLIENT -( - CLIENT_ID int not null auto_increment, - CLIENT_NAME varchar(20) not null, - CLIENT_AGE int not null, - CLIENT_ADDRESS varchar(60) not null, - CLIENT_TELEPHONE varchar(50), - primary key (CLIENT_ID) -); - -/*==============================================================*/ -/* Table: MANAGA */ -/*==============================================================*/ -create table MANAGA -( - SALESMAN_ID int not null, - CAR_ID int not null, - primary key (SALESMAN_ID, CAR_ID) -); - -/*==============================================================*/ -/* Table: SALESMAN */ -/*==============================================================*/ -create table SALESMAN -( - SALESMAN_ID int not null auto_increment, - SALESMAN_NAME varchar(50) not null, - SALESMAN_AGE int not null, - SALESMAN_TELEPHONE varchar(20) not null, - primary key (SALESMAN_ID) -); - -/*==============================================================*/ -/* Table: SELL */ -/*==============================================================*/ -create table SELL -( - CLIENT_ID int not null, - SALESMAN_ID int not null, - primary key (CLIENT_ID, SALESMAN_ID) -); - -alter table BILL add constraint FK_RELATIONSHIP_3 foreign key (CAR_ID) - references CAR (CAR_ID) on delete restrict on update restrict; - -alter table BILL add constraint FK_RELATIONSHIP_4 foreign key (SALESMAN_ID) - references SALESMAN (SALESMAN_ID) on delete restrict on update restrict; - -alter table BILL add constraint FK_RELATIONSHIP_5 foreign key (CLIENT_ID) - references CLIENT (CLIENT_ID) on delete restrict on update restrict; - -alter table MANAGA add constraint FK_MANAGA foreign key (SALESMAN_ID) - references SALESMAN (SALESMAN_ID) on delete restrict on update restrict; - -alter table MANAGA add constraint FK_MANAGA2 foreign key (CAR_ID) - references CAR (CAR_ID) on delete restrict on update restrict; - -alter table SELL add constraint FK_SELL foreign key (CLIENT_ID) - references CLIENT (CLIENT_ID) on delete restrict on update restrict; - -alter table SELL add constraint FK_SELL2 foreign key (SALESMAN_ID) - references SALESMAN (SALESMAN_ID) on delete restrict on update restrict; - - - --- 1.查询特定销售员的销售记录 - -select * from salesman,bill where salesman.SALESMAN_ID=bill.SALESMAN_ID and SALESMAN_name=(select SALESMAN_NAME from salesman where SALESMAN_ID=1); - -- 2.查找销售记录中销售价格最高的汽车 - - -- 3.统计某个销售员的销售总额 - - -- 4.根据客户信息查询其购买过的汽车 - select CLIENT_NAME,CAR_NAME from client left join bill on client.CLIENT_ID=bill.CLIENT_ID - left join car on bill.CAR_ID=car.CAR_ID; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - -- 8.统计每个销售员的销售数量 -select count(CAR_ID) from bill where SALESMAN_ID=(select SALESMAN_ID from salesman where SALESMAN_ID=1); -``` - diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230919\344\275\234\344\270\232.md" "b/18 \345\276\220\346\260\270\346\267\263/20230919\344\275\234\344\270\232.md" deleted file mode 100644 index 0cca3b1c2ea4da17f4e610e1a657e62b7dfac1a4..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230919\344\275\234\344\270\232.md" +++ /dev/null @@ -1,783 +0,0 @@ -```mysql -数据库代码 -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ -create database DB charset utf8; -use DB; -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; -查询语句 -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -select sum(salary*12) 工资总和 from employees; -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - -select sum(salary*12)+sum(salary*commission_pct*12) from employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - -select distinct job_id from employees; - -# 3.查询工资大于12000的员工姓名和工资 -select last_name,salary from employees where salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 -select employee_id,department_id from employees where employee_id=176; - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -select * from departments; -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -select * from employees where salary between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 -select * from employees where department_id in(20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -select last_name,job_id from employees where manager_id is null; - - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -select last_name,salary,grade_level from employees e left join job_grades j on e.salary*commission_pct between j.lowest_sal and j.highest_sal where commission_pct is not null; - - - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select * from employees where last_name like '__尔'; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -select * from employees where last_name like '%特%' and last_name like '%尔%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -select * from employees where first_name like '%尔'; - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -select * from employees where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select last_name,salary,manager_id from employees where manager_id in (100,101,110) - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select last_name,department_id,salary*12 年薪 from employees order by 年薪 desc; -# -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select * from employees where !(salary between 8000 and 17000) order by salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select * from employees where email like '%e%' order by LENGTH(email) desc,department_id asc; - - - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -select last_name,employees.department_id,department_name from employees,departments where employees.department_id=departments.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -select job_id,location_id from employees,departments where employees.employee_id=departments.department_id and employees.department_id=90; - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select last_name,department_name,d.location_id,city from employees e left join departments d on e.department_id=d.department_id -left join locations l on d.location_id=l.location_id where commission_pct is not null; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -select last_name , job_id , e.department_id , department_name from employees e left join departments d on e.department_id=d.department_id -left join locations l on d.location_id=l.location_id where city='多伦多'; - - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 -select department_name 部门名称, city 部门地址, e.last_name 姓名, j.job_title 工作, e.salary 工资 -from employees e,departments d,locations l,jobs j -where e.department_id=d.department_id -and d.location_id=l.location_id -and j.job_id=e.job_id; - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select a.first_name,a.department_id,b.manager_id,b.first_name from employees a join employees b on a.department_id = b.department_id; - - -# 7.查询哪些部门没有员工 -select * from employees where department_id is NULL; -# 8. 查询哪个城市没有部门 - -select * from locations where state_province is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select * from employees e -join departments d on e.department_id = d.department_id -where d.department_name like '销售部' or d.department_name like '信息技术部'; - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary),min(salary),avg(salary),sum(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - - -select job_id,max(salary),min(salary),avg(salary),sum(salary) from employees group by job_id; -#4.选择各个job_id的员工人数 - -# 5.查询员工最高工资和最低工资的差距 - -select max(salary)-min(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - -select manager_id,min(salary) from employees -where salary > 6000 -group by manager_id -having manager_id is not null; - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select count(a.department_id) 员工数量,avg(a.salary) 平均工资 from employees a -join departments b on a.department_id = b.department_id -group by location_id -order by 平均工资 desc - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - -select min(a.salary) 最低工资,a.job_id 工种,c.job_title 工种名 from employees a -join departments b on a.department_id = b.department_id -join jobs c on a.job_id = c.job_id -group by a.job_id - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - - -select last_name,salary from employees where department_id = (select department_id from employees where last_name = "兹洛特基"); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - -select employee_id,last_name,salary from employees where salary > (select avg(salary) from employees) - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name,job_id,salary from employees where salary > (select min(salary) from employees where job_id = "sa_man") - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -## 姓名中文 X -select employee_id,last_name from where department_id = (select department_id from employees where last_name like "%u%") - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -select a.employee_id 员工号 from employees a -join departments b on a.department_id = b.department_id -join locations c on b.location_id = c.location_id -where b.location_id = (select location_id from locations where location_id = 1700) - - - -#6.查询管理者是 金 的员工姓名和工资 -select last_name,salary from employees where manager_id = (select employee_id from employees where last_name = "金" and manager_id is null); - - -#7.查询工资最低的员工信息: last_name, salary - - -select last_name,salary from employees where salary = (select min(salary) from employees); - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - - -select b.* from employees a -join departments b on a.department_id = b. department_id -where b.department_id = (select department_id from employees group by department_id order by avg(salary) limit 0,1); - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - --- 平均工资最低的部门 -select b.* from employees a -join departments b on a.department_id = b. department_id -where b.department_id = (select department_id from employees group by department_id order by avg(salary) limit 0,1); --- 该部门平均工资 -select department_id,avg(salary) from employees group by department_id order by avg(salary) limit 0,1 - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - -select b.* from employees a -join jobs b on a.job_id = b.job_id -where a.salary > (select avg(salary) from employees) -limit 0,1; - - - -#11.查询平均工资高于公司平均工资的部门有哪些? - - -select b.department_name,avg(salary) 平均工资 from employees a -join departments b on a.department_id = b.department_id -group by b.department_name -having 平均工资>(select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - - - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - - - -#方式: - - - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - -select avg(salary) from employees -group by department_id -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - - - - - -#16. 选择所有没有管理者的员工的last_name - - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - - -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - -select department_name from departments a join -(select count(department_id) 人数 from employees group by department_id having 人数>5) b - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - - -``` - diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230920\344\275\234\344\270\232.md" "b/18 \345\276\220\346\260\270\346\267\263/20230920\344\275\234\344\270\232.md" deleted file mode 100644 index 7d38abb58997f9cd1bca3e6487959640ecd4aa29..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230920\344\275\234\344\270\232.md" +++ /dev/null @@ -1,179 +0,0 @@ -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/21 12:16:20 */ -/*==============================================================*/ -create database if not exists jingdong charset utf8; - -use jingdong; - -drop table if exists INCREASE; - -drop table if exists MODIFY; - -drop table if exists MONEY; - -drop table if exists PERMISSION; - -drop table if exists PURCHASE; - -drop table if exists ROLE; - -drop table if exists ROLE_PERMISSION; - -drop table if exists SPECIFICATIONS; - -drop table if exists USER; - -drop table if exists USER_ROLE; - -/*==============================================================*/ -/* Table: INCREASE */ -/*==============================================================*/ -create table INCREASE -( - ADD_ID int not null auto_increment, - PERMISSION_ID int not null, - ADD_TYPE varchar(50) not null, - ADD_COLOR varchar(20) not null, - primary key (ADD_ID) -); - -/*==============================================================*/ -/* Table: MODIFY */ -/*==============================================================*/ -create table MODIFY -( - MODIFY_ID int not null auto_increment, - PERMISSION_ID int not null, - MODIFY_MOENY numeric(4,1) not null, - primary key (MODIFY_ID) -); - -/*==============================================================*/ -/* Table: MONEY */ -/*==============================================================*/ -create table MONEY -( - MONEY_ID int not null auto_increment, - SPECIFICATIONS_ID int not null, - PRICE numeric(6,1) not null, - primary key (MONEY_ID) -); - -/*==============================================================*/ -/* Table: PERMISSION */ -/*==============================================================*/ -create table PERMISSION -( - PERMISSION_ID int not null auto_increment, - WEB_SCRIPT varchar(20) not null, - WEB_URL varchar(600) not null, - primary key (PERMISSION_ID) -); - -/*==============================================================*/ -/* Table: PURCHASE */ -/*==============================================================*/ -create table PURCHASE -( - INDENT_ID int not null auto_increment, - PERMISSION_ID int not null, - SPECIFICATIONS_ID int not null, - ORGANISM_TYPE varchar(50) not null, - ORGANISM_NUMBER int not null, - primary key (INDENT_ID) -); - -/*==============================================================*/ -/* Table: ROLE */ -/*==============================================================*/ -create table ROLE -( - ROLE_ID int not null auto_increment, - ROLE_POSITION varchar(20) not null, - primary key (ROLE_ID) -); - -/*==============================================================*/ -/* Table: ROLE_PERMISSION */ -/*==============================================================*/ -create table ROLE_PERMISSION -( - PERMISSION_ID int not null, - ROLE_ID int not null, - primary key (PERMISSION_ID, ROLE_ID) -); - -/*==============================================================*/ -/* Table: SPECIFICATIONS */ -/*==============================================================*/ -create table SPECIFICATIONS -( - SPECIFICATIONS_ID int not null auto_increment, - INDENT_ID int not null, - MONEY_ID int not null, - ORGANISM_RAM int not null, - ORGANISM_MEMORY int not null, - ORGANISM_COLOR varchar(50) not null, - primary key (SPECIFICATIONS_ID) -); - -/*==============================================================*/ -/* Table: USER */ -/*==============================================================*/ -create table USER -( - USER_ID int not null auto_increment, - USER_NAME varchar(20) not null, - USER_PWD varchar(50) not null, - USER_EMAIL varchar(50) not null, - primary key (USER_ID) -); - -/*==============================================================*/ -/* Table: USER_ROLE */ -/*==============================================================*/ -create table USER_ROLE -( - ROLE_ID int not null, - USER_ID int not null, - primary key (ROLE_ID, USER_ID) -); - -alter table INCREASE add constraint FK_PERMISSION_INCREASE foreign key (PERMISSION_ID) - references PERMISSION (PERMISSION_ID) on delete restrict on update restrict; - -alter table MODIFY add constraint FK_PERMISSION_MODIFY foreign key (PERMISSION_ID) - references PERMISSION (PERMISSION_ID) on delete restrict on update restrict; - -alter table MONEY add constraint FK_SPECIFICATIONS_MOENY2 foreign key (SPECIFICATIONS_ID) - references SPECIFICATIONS (SPECIFICATIONS_ID) on delete restrict on update restrict; - -alter table PURCHASE add constraint FK_PERMISSION_PURCHASE foreign key (PERMISSION_ID) - references PERMISSION (PERMISSION_ID) on delete restrict on update restrict; - -alter table PURCHASE add constraint FK_PURCHASE_SPECIFICATIONS foreign key (SPECIFICATIONS_ID) - references SPECIFICATIONS (SPECIFICATIONS_ID) on delete restrict on update restrict; - -alter table ROLE_PERMISSION add constraint FK_ROLE_PERMISSION foreign key (PERMISSION_ID) - references PERMISSION (PERMISSION_ID) on delete restrict on update restrict; - -alter table ROLE_PERMISSION add constraint FK_ROLE_PERMISSION2 foreign key (ROLE_ID) - references ROLE (ROLE_ID) on delete restrict on update restrict; - -alter table SPECIFICATIONS add constraint FK_PURCHASE_SPECIFICATIONS2 foreign key (INDENT_ID) - references PURCHASE (INDENT_ID) on delete restrict on update restrict; - -alter table SPECIFICATIONS add constraint FK_SPECIFICATIONS_MOENY foreign key (MONEY_ID) - references MONEY (MONEY_ID) on delete restrict on update restrict; - -alter table USER_ROLE add constraint FK_USER_ROLE foreign key (ROLE_ID) - references ROLE (ROLE_ID) on delete restrict on update restrict; - -alter table USER_ROLE add constraint FK_USER_ROLE2 foreign key (USER_ID) - references USER (USER_ID) on delete restrict on update restrict; - - -``` - diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230920\347\254\224\350\256\260.md" "b/18 \345\276\220\346\260\270\346\267\263/20230920\347\254\224\350\256\260.md" deleted file mode 100644 index aaf0fa9f9c2ecb952292527975c8be0ba71cb203..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230920\347\254\224\350\256\260.md" +++ /dev/null @@ -1,19 +0,0 @@ -Role-Based Access Control -基于角色的权限访问控制 RBAC -是目前开发系统中主流的设计模式 - -数据库可以存业务数据表:用户,商品 -也可以存:菜单信息表,页面代码表 - -权限的使用场景 -网页不一样,网页一样,但可用的菜单不一样,菜单一样马,但同一个菜单下的网页元素一样 - -菜单权限:不同的用户查看同一个对象时,可见的菜单不一样 - -按钮权限:不同的用户查看同个对象时,按钮不一样 - -数据权限:不同的用户查看同一个对象时,可见的数据不一样 - -操作权限:能看得到,却操作不了 - -在RBAC中,角色是关键也是核心,也是“基调”,在数据库设计时一定要有角色 \ No newline at end of file diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230921\344\275\234\344\270\232.md" "b/18 \345\276\220\346\260\270\346\267\263/20230921\344\275\234\344\270\232.md" deleted file mode 100644 index d62a97d536523a6e25180dee6fa3a2ee71d00786..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230921\344\275\234\344\270\232.md" +++ /dev/null @@ -1,84 +0,0 @@ -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 17:17:51 */ -/*==============================================================*/ -create database if not exists jingdong charset utf8; -use jingdong; - -drop table if exists association_table; - -drop table if exists attribute_value; - -drop table if exists price; - -drop table if exists property; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: association_table */ -/*==============================================================*/ -create table association_table -( - association_table_id int not null auto_increment, - price_id int, - property_id int, - attribute_value_id int, - primary key (association_table_id) -); - -/*==============================================================*/ -/* Table: attribute_value */ -/*==============================================================*/ -create table attribute_value -( - attribute_value_id int not null auto_increment, - attribute_value_name varchar(30) not null, - primary key (attribute_value_id) -); - -/*==============================================================*/ -/* Table: price */ -/*==============================================================*/ -create table price -( - price_id int not null auto_increment, - spu_id int, - price_money float(8,2) not null, - primary key (price_id) -); - -/*==============================================================*/ -/* Table: property */ -/*==============================================================*/ -create table property -( - property_id int not null auto_increment, - property_name varchar(50) not null, - primary key (property_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - primary key (spu_id) -); - -alter table association_table add constraint FK_Relationship_2 foreign key (price_id) - references price (price_id) on delete restrict on update restrict; - -alter table association_table add constraint FK_Relationship_3 foreign key (property_id) - references property (property_id) on delete restrict on update restrict; - -alter table association_table add constraint FK_Relationship_4 foreign key (attribute_value_id) - references attribute_value (attribute_value_id) on delete restrict on update restrict; - -alter table price add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; -``` - diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230921\347\254\224\350\256\260.md" "b/18 \345\276\220\346\260\270\346\267\263/20230921\347\254\224\350\256\260.md" deleted file mode 100644 index 4b8c50dad7f1fed215fa8f672b7e990a705da2a8..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230921\347\254\224\350\256\260.md" +++ /dev/null @@ -1,15 +0,0 @@ -## 什么是SKU? - -SKU(Stock Keeping Unit/库存量单位)是指用于售卖的商品的一个独特标识符号。一般包含商品名称、品牌、颜色、尺寸、材料等信息。 - -## SKU在MySQL数据库中的作用 - -在MySQL数据库中,SKU作为商品的唯一标识符号被广泛运用于电子商务网站。它可以帮助电商平台管理商品信息,从而使得消费者能够轻松地找到他们想要购买的商品。 - -## 如何在MySQL数据库中使用SKU? - -使用SKU可以在数据库中轻松地进行商品管理。一般建议将SKU作为商品表的主键,以确保每个SKU的唯一性。同时,将SKU设置为商品的关键属性,可以用于与订单、库存和物流等信息相对应,确保电商平台的正常运作。 - -## SKU的规范化管理 - -SKU的规范化管理可以帮助电商平台减少对商品信息的冗余,避免商品信息重复,并避免因商品信息过于混乱而导致的数据查询及管理困难。对于SKU的管理,可以通过字段、表和索引等多种方式实现。 \ No newline at end of file diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230922\347\254\224\350\256\260.md" "b/18 \345\276\220\346\260\270\346\267\263/20230922\347\254\224\350\256\260.md" deleted file mode 100644 index fc64446637b41eda65e76a24a6f0ac7e7e2c42a1..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230922\347\254\224\350\256\260.md" +++ /dev/null @@ -1,27 +0,0 @@ - #### 1.事务 - -为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - - #### 事务的四个特性 - -1.原子性:事务包含的这一系列操作,要么全部成功,要么全部失败 2.一致性:事务完成之后,不会将非法的数据写入数据库。 - -3.隔离性:多个事务可以在一定程度上并发执行 - - 4.持久性:事务完成之后,数据要永久保存 - - 2.视图 在已有的表或者视图上创建的虚拟表 - -创建视图: create view 视图名 asselect 可以对(单表)视图进行一些增删改查的操作,这些操作会影响到原始的表 删除视图:drop view 视图名 - - 3.索引 - -为了提高查询的速度而在数据库断创建的一种排序的数据结构 - - 4.储存过程 - -存储在数据库端的一组为了完成特点功能的sql语句 - -存储过程:create procedure 存储过程名(【参数】) - -参数格式(参数类型 参数名 数据类型) \ No newline at end of file diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230926\344\275\234\344\270\232.md" "b/18 \345\276\220\346\260\270\346\267\263/20230926\344\275\234\344\270\232.md" deleted file mode 100644 index 783cacc0139417ca0855dc8341a3c2768cd701b1..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230926\344\275\234\344\270\232.md" +++ /dev/null @@ -1,277 +0,0 @@ -```mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -``` - - - -```mysql -#第14章_视图的课后练习 - -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -create view employee_vu as select last_name 姓名,employee_id 员工号,department_id 部门号 from employees; - -#2. 显示视图的结构 -desc employee_vu; - -#3. 查询视图中的全部内容 -select * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -create or replace view employee_vu as select last_name 姓名,employee_id 员工号,department_id 部门号 from employees where department_id=80; -select * from employee_vu; - -#练习2: -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -create view emp_v1 as select last_name 员工姓名,salary 工资,email 邮箱 from employees where phone_number like '011%'; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -create or replace view emp_v1 as select last_name 员工姓名,salary 工资,phone_number 电话号码,email 邮箱 from employees where phone_number like '011%' and email like '%e%'; - -#3. 向 emp_v1 插入一条记录,是否可以? -不可以 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -update emp_v1 set 工资=工资+1000; - -#5. 删除emp_v1中姓名为Olsen的员工 -delete from emp_v1 where 员工姓名='Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create view emp_v2 as select department_id 部门id,max(salary) 最高工资 from employees group by department_id having max(salary)>12000; - -#7. 向 emp_v2 中插入一条记录,是否可以? -不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v2 , emp_v1; -``` \ No newline at end of file diff --git "a/18 \345\276\220\346\260\270\346\267\263/20230926\347\254\224\350\256\260.md" "b/18 \345\276\220\346\260\270\346\267\263/20230926\347\254\224\350\256\260.md" deleted file mode 100644 index 4f9a4d7d56f43fc42481918cddb57963e37b083f..0000000000000000000000000000000000000000 --- "a/18 \345\276\220\346\260\270\346\267\263/20230926\347\254\224\350\256\260.md" +++ /dev/null @@ -1,59 +0,0 @@ -检查某个字段的值是否符合值的范围 - -``` -gender char(1) , /*逗号留不留都可以*/ -check(gender in ('男','女')) -``` - -MySQL 5.7不支持使用,MySQL8.0 可以使用 - -``` -/*在utf8中,一个汉字等于一个字符,等于3个字节*/ -check(length(name)>6) /*6指的是6个字节*/ -``` - -视图是一种虚拟表,本身不具有数据,占用很少的内存空间 - -``` -concat(last_name,' ',first_name) /*拼接字段*/ -``` - -创建视图语句 - -``` -create view 视图名 as select语句 -``` - -删除视图语句 - -``` -drop view 视图名1,视图名2 -``` - -修改视图语句 - -``` -create or replace view 视图名 as select 语句 -``` - -使用视图 - -``` -select * from 视图名 [where 条件] -``` - -查看创建语句 - -``` -show create table 表名 -``` - -修改视图语句 - -``` -update 表名 set 条件; -insert into 表名 values (值) -``` - - - diff --git "a/18 \345\276\220\346\260\270\346\267\263/\346\227\240\346\240\207\351\242\230.png" "b/18 \345\276\220\346\260\270\346\267\263/\346\227\240\346\240\207\351\242\230.png" deleted file mode 100644 index df520ecf75228c5bd9d54555d40800623df20c70..0000000000000000000000000000000000000000 Binary files "a/18 \345\276\220\346\260\270\346\267\263/\346\227\240\346\240\207\351\242\230.png" and /dev/null differ diff --git "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/RBAC\347\254\224\350\256\260.md" "b/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/RBAC\347\254\224\350\256\260.md" deleted file mode 100644 index 19298f79e2812326e26912b96ccde77b62621838..0000000000000000000000000000000000000000 --- "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/RBAC\347\254\224\350\256\260.md" +++ /dev/null @@ -1,105 +0,0 @@ -# 笔记 - -RBAC:基于角色的权限访问控制 - -数据库可以储存:业务代码,功能代码 - -权限分为以下几点 - -1. 菜单权限 - -2. 按钮权限 - -3. 数据权限 - -4. 操作权限 - -5. 文件资源下载权限 - - 等等等等 - - ![image-20230920171301260](https://s2.loli.net/2023/09/21/9JDFtVnrSkCveOf.png) - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:24:17 */ -/*==============================================================*/ - - -drop table if exists jurisdiction; - -drop table if exists personal; - -drop table if exists personal_role; - -drop table if exists role; - -drop table if exists role_jurisdiction; - -/*==============================================================*/ -/* Table: jurisdiction */ -/*==============================================================*/ -create table jurisdiction -( - jurisdiction_id int not null auto_increment, - jurisdiction_name varchar(50) not null, - primary key (jurisdiction_id) -); - -/*==============================================================*/ -/* Table: personal */ -/*==============================================================*/ -create table personal -( - personal_id int not null auto_increment, - personal_name varchar(11) not null, - personal_pwd varchar(11) not null, - primary key (personal_id) -); - -/*==============================================================*/ -/* Table: personal_role */ -/*==============================================================*/ -create table personal_role -( - role_id int not null, - personal_id int not null, - primary key (role_id, personal_id) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name varchar(50) not null, - primary key (role_id) -); - -/*==============================================================*/ -/* Table: role_jurisdiction */ -/*==============================================================*/ -create table role_jurisdiction -( - jurisdiction_id int not null, - role_id int not null, - primary key (jurisdiction_id, role_id) -); - -alter table personal_role add constraint FK_personal_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table personal_role add constraint FK_personal_role2 foreign key (personal_id) - references personal (personal_id) on delete restrict on update restrict; - -alter table role_jurisdiction add constraint FK_role_jurisdiction foreign key (jurisdiction_id) - references jurisdiction (jurisdiction_id) on delete restrict on update restrict; - -alter table role_jurisdiction add constraint FK_role_jurisdiction2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - - -``` - diff --git "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/SKU\345\222\214SPU\347\232\204\347\254\224\350\256\260.md" "b/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/SKU\345\222\214SPU\347\232\204\347\254\224\350\256\260.md" deleted file mode 100644 index 9ba75b457de709b568670431972d4a847e8ce1f3..0000000000000000000000000000000000000000 --- "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/SKU\345\222\214SPU\347\232\204\347\254\224\350\256\260.md" +++ /dev/null @@ -1,100 +0,0 @@ -# 笔记 - - - - - - - - - -![image-20230921172055009](C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20230921172055009.png) - - - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 17:17:51 */ -/*==============================================================*/ -create database if not exists jingdong charset utf8; -use jingdong; - -drop table if exists association_table; - -drop table if exists attribute_value; - -drop table if exists price; - -drop table if exists property; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: association_table */ -/*==============================================================*/ -create table association_table -( - association_table_id int not null auto_increment, - price_id int, - property_id int, - attribute_value_id int, - primary key (association_table_id) -); - -/*==============================================================*/ -/* Table: attribute_value */ -/*==============================================================*/ -create table attribute_value -( - attribute_value_id int not null auto_increment, - attribute_value_name varchar(30) not null, - primary key (attribute_value_id) -); - -/*==============================================================*/ -/* Table: price */ -/*==============================================================*/ -create table price -( - price_id int not null auto_increment, - spu_id int, - price_money float(8,2) not null, - primary key (price_id) -); - -/*==============================================================*/ -/* Table: property */ -/*==============================================================*/ -create table property -( - property_id int not null auto_increment, - property_name varchar(50) not null, - primary key (property_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - primary key (spu_id) -); - -alter table association_table add constraint FK_Relationship_2 foreign key (price_id) - references price (price_id) on delete restrict on update restrict; - -alter table association_table add constraint FK_Relationship_3 foreign key (property_id) - references property (property_id) on delete restrict on update restrict; - -alter table association_table add constraint FK_Relationship_4 foreign key (attribute_value_id) - references attribute_value (attribute_value_id) on delete restrict on update restrict; - -alter table price add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - - -``` - diff --git "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/mysql\345\244\215\344\271\240.md" "b/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/mysql\345\244\215\344\271\240.md" deleted file mode 100644 index 5969ecae48c59abc0a54b52c69bcd9c2076766e5..0000000000000000000000000000000000000000 --- "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/mysql\345\244\215\344\271\240.md" +++ /dev/null @@ -1,737 +0,0 @@ -```mysql -create database text01 charset utf8; -use text01; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - - - - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -#理解1:计算12月的基本工资 - select sum(salary * 12) 工资总和 from employees ; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - select sum(salary * 12) + sum(salary * 12 * commission_pct) 实发工资 from employees; - select sum(salary * 12 + salary * 12 * ifnull(commission_pct,0)) 实发工资 from employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - select distinct(job_id) from employees; - -# 3.查询工资大于12000的员工姓名和工资 - select first_name 姓名,salary 工资 from employees where salary > 12000; - -# 4.查询员工号为176的员工的姓名和部门号 - select first_name 姓名,department_id 部门号 from employees where employee_id = 176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - desc departments; - select * from departments; - - - -# 第04章_运算符课后练习 -# 1.选择工资不在5000到12000的员工的姓名和工资 - select first_name 姓名,salary 工资 from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - select first_name 姓名,department_id 部门号 from employees where department_id in(20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - select first_name 姓名,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,奖金和奖金级别 - select first_name 姓名,e.salary*commission_pct 奖金,grade_level 奖金级别 from employees e left join job_grades j on e.salary*commission_pct between j.lowest_sal and j.highest_sal where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - select first_name 姓名 from employees where first_name like '__尔'; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - select * from employees where last_name like '%特%' and last_name like '%尔%' - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - select * from employees where first_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - select first_name 姓名,job_title 工种 from employees e left join jobs j on e.job_id=j.job_id where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,108 的员工姓名、工资、管理者id - select first_name 员工姓名,salary 工资,manager_id 管理者id from employees where manager_id in(100,101,108) - - - - -#第05章_排序与分页的课后练习 - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - select first_name 姓名,department_id 部门号,(salary * 12) 年薪 from employees order by 年薪 desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - select * from employees where salary not between 8000 and 17000 order by salary desc limit 21,19; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - select * from employees where email like '%e%' order by char_length(email) desc,department_id; - - - - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - select first_name 姓名,e.job_id 部门号,job_title 部门名称 from employees e,jobs j where e.job_id=j.job_id - -# 2.查询90号部门员工的job_id和90号部门的location_id - select job_id,location_id from employees e,departments d where e.department_id = d.department_id and e.department_id = 90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - select last_name ,department_name ,d.location_id ,city - from employees e,departments d,locations l - where e.department_id = d.department_id and d.location_id = l.location_id and commission_pct is not null; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - - #子查询 - select last_name ,job_id ,b.department_id ,department_name from employees e, - (select department_id ,department_name from departments where location_id = - (select location_id from locations where city = '多伦多')) b where e.department_id=b.department_id; - - #连表查 - select last_name ,job_id ,d.department_id ,department_name - from locations l ,departments d ,employees e - where l.location_id = d.location_id and d.department_id = e.department_id and city = '多伦多'; - - -#sql92语法(自然连接): - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - #select * from locations join departments join employees where department_name = '行政部'; - select d.department_name 部门名称,l.street_address 部门地址,e.first_name 姓名,j.job_title 工作,e.salary 工资 from locations l - left join departments d on l.location_id = d.location_id - left join employees e on d.department_id = e.department_id - right join jobs j on e.job_id = j.job_id where d.department_name = '行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - select e1.last_name 员工姓名,e1.employee_id 员工编号,e2.last_name 上级姓名,e2.employee_id 上级的员工编号 from employees e1,employees e2 where e1.manager_id =e2.employee_id - -# 7.查询哪些部门没有员工 - select department_name 部门名称 from departments d left join employees e on d.department_id = e.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - select city 没有部门的城市 from locations where location_id not in - (select distinct(location_id) from departments); - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - select * from employees where department_id in - (select department_id from departments where department_name in('销售部','信息技术部')); - - - - -# 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees ; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - select j.job_id, max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 - from jobs j left join employees e on j.job_id = e.job_id group by j.job_id; - -#4.选择各个job_id的员工人数 - select j.job_id,count(j.job_id) from jobs j left join employees e on j.job_id = e.job_id group by j.job_id; - -# 5.查询员工最高工资和最低工资的差距 - select max(salary)-min(salary) 最高工资和最低工资的差距 from employees ; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - select e1.manager_id,min(e1.salary) 最低工资 - from employees e1 right join employees e2 on e1.manager_id = e2.employee_id - where e1.salary >6000 group by e1.manager_id - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - select d.department_name 部门名,d.location_id,count(e.department_id) 员工数量,avg(e.salary) 平均工资 - from employees e right join departments d on e.department_id = d.department_id - group by d.department_id order by 平均工资 desc - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - select d.department_name 部门名,j.job_title 工种名,min(e.salary) 最低工资 from jobs j right join employees e on j.job_id = e.job_id left join departments d on e.department_id = d.department_id group by j.job_id,d.department_id; - - - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - select last_name 员工姓名,salary 工资 from employees where department_id = - (select department_id from employees where last_name = '兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - #select l.location_id, avg(e.salary) 平均工资 from locations l right join departments d on l.location_id = d.location_id left join employees e on d.department_id = e.department_id group by l.location_id; - - select employee_id,first_name,salary from employees where salary>(select avg(salary) from employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - select last_name, job_id, salary from employees where salary > - (select max(e.salary) from jobs j left join employees e on j.job_id = e.job_id where j.job_id = 'SA_MAN'); - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - #select * from employees where last_name like '' -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - select employee_id 员工号 from employees where department_id in - (select department_id from departments where location_id = 1700); - -#6.查询管理者是 金 的员工姓名和工资 - select last_name 姓名,salary 工资 from employees where manager_id in - (select employee_id from employees where last_name = '金'); - -#7.查询工资最低的员工信息: last_name, salary - select last_name,salary from employees where salary = - (select min(salary) from employees); - - - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - # 连表查 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - # 子查询 - select d.*,a.平均工资 from departments d right join - (select department_id,avg(salary) 平均工资 from employees group by department_id having avg(salary) = - (select avg(salary) 平均工资 from employees group by department_id order by 平均工资 limit 0,1)) a - on d.department_id = a.department_id; - - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 - select j.*,avg(e.salary) 平均工资 - from jobs j right join employees e on j.job_id = e.job_id group by j.job_id order by 平均工资 desc limit 0,1; - -#11.查询平均工资高于公司平均工资的部门有哪些? - select d.department_name 部门名,avg(e.salary) 平均工资 - from departments d right join employees e on d.department_id = e.department_id - group by d.department_id having 平均工资 > (select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - select * from employees where employee_id in - (select distinct(a.employee_id) from - (select e2.* from employees e1 left join employees e2 on e1.manager_id = e2.employee_id) a); - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - select * from employees where employee_id in - (select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - select min(e.salary) 最低工资 from employees e right join - (select department_id,max(salary) 最高工资 from employees group by department_id order by 最高工资 limit 0,1) a - on e.department_id = a.department_id ; - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - select last_name, department_id, email, salary from employees where employee_id = - (select employee_id from employees e right join - (select department_id,avg(salary) 平均工资 from employees group by department_id order by 平均工资 desc limit 0,1) a - on e.department_id = a.department_id limit 0,1); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - select job_id from jobs where job_id != 'ST_CLERK'; - -#16. 选择所有没有管理者的员工的last_name - select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - select * from employees where last_name = 'De Haan' - -#方式2: - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - select e.employee_id 员工号,e.last_name 姓名,e.salary 工资,a.平均工资 from employees e left join - (select department_id,avg(salary) 平均工资 from employees group by department_id) a - on e.department_id = a.department_id and e.salary > a.平均工资; - -#方式2:在FROM中声明子查询 - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - select department_name from departments where department_id in - (select distinct department_id from employees where employee_id in - (select manager_id from employees group by manager_id having count(manager_id)>5)); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - select country_id from locations where location_id in - (select location_id from departments group by location_id having count(location_id) > 2); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` \ No newline at end of file diff --git "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\344\275\234\344\270\232.md" "b/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\344\275\234\344\270\232.md" deleted file mode 100644 index 5d14eeab2034413adbf550cb036af7b4e100b0dc..0000000000000000000000000000000000000000 --- "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\344\275\234\344\270\232.md" +++ /dev/null @@ -1,148 +0,0 @@ -# 作业 9/12 - - - -```MYSQL -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 11:33:36 */ -/*==============================================================*/ -CREATE DATABASE film charset utf8; -use film; - -drop table if exists Commenttype; - -drop table if exists `comment`; - -drop table if exists commentssection; - -drop table if exists country; - -drop table if exists `language`; - -drop table if exists movie; - -drop table if exists movieteam; - -drop table if exists movietypes; - -/*==============================================================*/ -/* Table: Commenttype */ -/*==============================================================*/ -create table Commenttype -( - Commenttype_id int not null auto_increment, - comment_id int not null, - Commenttype_name varchar(10) not null, - primary key (Commenttype_id) -); - -/*==============================================================*/ -/* Table: comment */ -/*==============================================================*/ -create table `comment` -( - comment_id int not null auto_increment, - comment_user varchar(10) not null, - comment_time datetime not null, - comment_content varchar(255) not null, - primary key (comment_id) -); - -/*==============================================================*/ -/* Table: commentssection */ -/*==============================================================*/ -create table commentssection -( - commentssection_id int not null auto_increment, - movie_id int not null, - commentssection_theme varchar(20) not null, - commentssection_source varchar(5) not null, - commentssection_time datetime not null, - primary key (commentssection_id) -); - -/*==============================================================*/ -/* Table: country */ -/*==============================================================*/ -create table country -( - country_id int not null auto_increment, - country_name varchar(10) not null, - primary key (country_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - language_id int not null auto_increment, - language varchar(10) not null, - primary key (language_id) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_id int not null auto_increment, - movietypes_id int not null, - country_id int not null, - comment_id int not null, - language_id int not null, - movie_name varchar(20) not null, - movie_time int not null, - movie_alias varchar(20) not null, - movie_data datetime not null, - TMDB varchar(20) not null, - movie_intro varchar(255) not null, - movie_awards varchar(100) not null, - movie_score decimal(2,1) not null, - primary key (movie_id) -); - -/*==============================================================*/ -/* Table: movieteam */ -/*==============================================================*/ -create table movieteam -( - movieteam_id int not null auto_increment, - movie_id int not null, - movieteam_name varchar(10) not null, - movieteam_age char(1) not null, - movieteam_status varchar(10) not null, - primary key (movieteam_id) -); - -/*==============================================================*/ -/* Table: movietypes */ -/*==============================================================*/ -create table movietypes -( - movietypes_id int not null auto_increment, - movietypes_name varchar(5) not null, - primary key (movietypes_id) -); - -alter table Commenttype add constraint FK_Relationship_5 foreign key (comment_id) - references comment (comment_id) on delete restrict on update restrict; - -alter table commentssection add constraint FK_Relationship_7 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_1 foreign key (movietypes_id) - references movietypes (movietypes_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_2 foreign key (country_id) - references country (country_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_3 foreign key (language_id) - references language (language_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_4 foreign key (comment_id) - references comment (comment_id) on delete restrict on update restrict; - -alter table movieteam add constraint FK_Relationship_6 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; \ No newline at end of file diff --git "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\345\214\273\351\231\242.md" "b/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\345\214\273\351\231\242.md" deleted file mode 100644 index 92a0ee5bb88a4215b7e593723fb01dc05b29c681..0000000000000000000000000000000000000000 --- "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\345\214\273\351\231\242.md" +++ /dev/null @@ -1,198 +0,0 @@ -E_R图 - -![image-20230914112503321](https://s2.loli.net/2023/09/14/hazeIFEfy73VDsn.png) - - - -# 代码 - -```MYSQL -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 11:17:52 */ -/*==============================================================*/ -CREATE DATABASE hospital1 charset utf8; -use hospital1; - -drop table if exists aaa; - -drop table if exists administrative; - -drop table if exists doctor; - -drop table if exists doctor_patients; - -drop table if exists drug; - -drop table if exists hospital; - -drop table if exists patients; - -drop table if exists patients_reception; - -drop table if exists prescription; - -drop table if exists prescription_drug; - -drop table if exists reception; - -/*==============================================================*/ -/* Table: aaa */ -/*==============================================================*/ -create table aaa -( - durg_id int not null, - reception_id int not null, - primary key (durg_id, reception_id) -); - -/*==============================================================*/ -/* Table: administrative */ -/*==============================================================*/ -create table administrative -( - administrative_id int not null auto_increment, - hospital_id char(10), - administrative����name varchar(40) not null, - primary key (administrative_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - administrative_id int, - doctor_name varchar(20) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: doctor_patients */ -/*==============================================================*/ -create table doctor_patients -( - patients_id int not null, - doctor_id int not null, - primary key (patients_id, doctor_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - durg_id int not null auto_increment, - drug_name varchar(50) not null, - drug_mioney varchar(100) not null, - primary key (durg_id) -); - -/*==============================================================*/ -/* Table: hospital */ -/*==============================================================*/ -create table hospital -( - hospital_id char(10) not null, - hospital_name varchar(40) not null, - primary key (hospital_id) -); - -/*==============================================================*/ -/* Table: patients */ -/*==============================================================*/ -create table patients -( - patients_id int not null auto_increment, - prescribe_id char(10), - patients_name varchar(20) not null, - primary key (patients_id) -); - -/*==============================================================*/ -/* Table: patients_reception */ -/*==============================================================*/ -create table patients_reception -( - patients_id int not null, - reception_id int not null, - primary key (patients_id, reception_id) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - prescribe_time char(10) not null, - prescribe_id char(10) not null, - doctor_id int, - reception_id int, - patients_id int, - prescribe_amount char(10) not null, - primary key (prescribe_id) -); - -/*==============================================================*/ -/* Table: prescription_drug */ -/*==============================================================*/ -create table prescription_drug -( - durg_id int not null, - prescribe_id char(10) not null, - primary key (durg_id, prescribe_id) -); - -/*==============================================================*/ -/* Table: reception */ -/*==============================================================*/ -create table reception -( - reception_id int not null auto_increment, - reception_name varchar(10) not null, - primary key (reception_id) -); - -alter table aaa add constraint FK_aaa foreign key (durg_id) - references drug (durg_id) on delete restrict on update restrict; - -alter table aaa add constraint FK_aaa2 foreign key (reception_id) - references reception (reception_id) on delete restrict on update restrict; - -alter table administrative add constraint FK_Relationship_6 foreign key (hospital_id) - references hospital (hospital_id) on delete restrict on update restrict; - -alter table doctor add constraint FK_Relationship_7 foreign key (administrative_id) - references administrative (administrative_id) on delete restrict on update restrict; - -alter table doctor_patients add constraint FK_doctor_patients foreign key (patients_id) - references patients (patients_id) on delete restrict on update restrict; - -alter table doctor_patients add constraint FK_doctor_patients2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table patients add constraint FK_prescription_patients2 foreign key (prescribe_id) - references prescription (prescribe_id) on delete restrict on update restrict; - -alter table patients_reception add constraint FK_patients_reception foreign key (patients_id) - references patients (patients_id) on delete restrict on update restrict; - -alter table patients_reception add constraint FK_patients_reception2 foreign key (reception_id) - references reception (reception_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_doctor_prescribe foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription_patients foreign key (patients_id) - references patients (patients_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_price_statistics foreign key (reception_id) - references reception (reception_id) on delete restrict on update restrict; - -alter table prescription_drug add constraint FK_prescription_drug foreign key (durg_id) - references drug (durg_id) on delete restrict on update restrict; - -alter table prescription_drug add constraint FK_prescription_drug2 foreign key (prescribe_id) - references prescription (prescribe_id) on delete restrict on update restrict; - diff --git "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index 80b330c34337f670f09880565d373628fd3dfadc..0000000000000000000000000000000000000000 --- "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,67 +0,0 @@ -![8750562da5843903a5aeabd6c0b120d](https://s2.loli.net/2023/09/11/PlZvLfmqhsAMuyw.png) - -```MYSQL -*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 20:20:24 */ -/*==============================================================*/ -CREATE DATABASE bookes charset utf8; -use bookes; - -drop table if exists book; - -drop table if exists guanli; - -drop table if exists jie; - -drop table if exists librarian; - -drop table if exists library; - -drop table if exists reader; - -drop table if exists system; - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - bo_id char(10) not null, - sys_id int not null, - bo_name char(10) not null, - bo_author char(10) not null, - primary key (bo_id) -); - -/*==============================================================*/ -/* Table: guanli */ -/*==============================================================*/ -create table guanli -( - sys_id int not null, - rar_id int not null, - primary key (sys_id, rar_id) -); - -/*==============================================================*/ -/* Table: jie */ -/*==============================================================*/ -create table jie -( - bo_id char(10) not null, - re_id int not null, - rar_id int, - primary key (bo_id, re_id) -); - -/*==============================================================*/ -/* Table: librarian */ -/*==============================================================*/ -create table librarian -( - rar_id int not null auto_increment, - lib_id int not null, - rar_name varch -``` - diff --git "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\345\244\247\344\272\214\345\255\246\345\271\264\350\247\204\345\210\222.md" "b/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\345\244\247\344\272\214\345\255\246\345\271\264\350\247\204\345\210\222.md" deleted file mode 100644 index 44b43b8e54c080ded3cae9b461d5f003b004b902..0000000000000000000000000000000000000000 --- "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\345\244\247\344\272\214\345\255\246\345\271\264\350\247\204\345\210\222.md" +++ /dev/null @@ -1,34 +0,0 @@ -大-理论 -大实际点用实操)难度加强 -1.数据库高级(MySQL) - -2.JavaScript(Ajax) - -3.MVC框架(MxVen,**Spring,SpringMVC, MyBatis**)SSM - -4.Node.js - -5.Vue.js - -6.springBoot(缓存) - -4,5,6是下学期的任务 - -实训 - -1.Linux 服务器 Nginx , MongoDb - -2.项目中可能要实现的技术:中间,*(签权):鉴别权限 - -3.小程序,uniapp 移动端开发 - - - -技术栈 - - 一个项目要求用什么技术实现,可以称技术选型 - -技能书 - -一个人具备的技能.称为技能树. - diff --git "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\346\225\260\346\215\256\345\272\223\347\232\204\350\214\203\345\274\217.md" "b/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\346\225\260\346\215\256\345\272\223\347\232\204\350\214\203\345\274\217.md" deleted file mode 100644 index 22affab2c3180c1e692caab7f003753b0cb05611..0000000000000000000000000000000000000000 --- "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\346\225\260\346\215\256\345\272\223\347\232\204\350\214\203\345\274\217.md" +++ /dev/null @@ -1,7 +0,0 @@ -数据库的范式 - -第1范式 : 要求字段的内容,不可再分割,为的是保证数据的原子性 - -第2范式 : 要求在满足第1范式的基础上,要求非主键字段要完全依赖主键(不可以只依赖一方,要依赖整个联合主键) - -第3范式 : 满足第2范式的基础上,要求非主键属性要直接依赖于主键 \ No newline at end of file diff --git "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" "b/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" deleted file mode 100644 index 987a99238be9265dc74d97e4905a693611cc8ae1..0000000000000000000000000000000000000000 --- "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" +++ /dev/null @@ -1,26 +0,0 @@ -数据库设计 - -1. 需求分析 -2. 概念结构设计 -3. 逻辑结构设计 -4. 物理结构设计 -5. 数据库实施 -6. 数据库运行和维护 - -关系是互相的 - -表的关系 - -一对一 - -一对多 - -多对多 - -E-R图的三要数 - -1.实体(表) 实体型:用矩形表示 - -2.属性(字段)属性:用椭圆形表示 - -3.关系 联系用菱形表示 \ No newline at end of file diff --git "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\346\225\260\346\215\256\345\272\223\351\242\204\344\271\240.md" "b/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\346\225\260\346\215\256\345\272\223\351\242\204\344\271\240.md" deleted file mode 100644 index 7aed09727d0a4988bbcf341a5ee32db7c2608ccb..0000000000000000000000000000000000000000 --- "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\346\225\260\346\215\256\345\272\223\351\242\204\344\271\240.md" +++ /dev/null @@ -1,127 +0,0 @@ -## 数据库高级预习 - -当数据库复杂需要多条 SQL 语句查询时,可以使用存储过程去完成这个需求。 - -### 创建存储过程语法 - -使用 create procedure 语句创建存储过程 - -#### 声明语句结束符 - -```mysql -delimiter $$ - -delimiter // -``` - -#### 创建 mysql 存储过程、存储函数 - -```mysql -create procedure 存储过程名(参数) -``` - -#### 存储过程体 - -```mysql -create function 存储函数名(参数) -``` - -#### 参数类型有三种: - -```mysql -IN: 输入参数,该参数的值必须在调用该存储过程时指定,在存储过程内部使用, 不能返回。 - -缺省值是IN。 - -OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - -INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回。 -``` - -### 事务 - - 为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - -#### 事务的四个特性 - -原子性:事务包含的这一系列操作,要么全部成功,要么全部失败(由DBMS的事务管理子系统来实现)。 - -一致性:事务完成之后,不会将非法的数据写入数据库(由DBMS的完整性子系统执行测试任务)。 - -隔离性:多个事务可以在一定程度上并发执行(由DBMS的并发控制子系统实现)。 - -持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上)(由DBMS的恢复管理子系统实现的)。 - -#### 隔离级别 - - 隔离级别从低到高依次是"读未提交"、“读已提交”、“可重复读取”和“序列化”,隔离级别越高,性能越低。mysql 数据库默认隔离级别是“可重复读取”,oracle是“读已提交”。数据库底层使用的“加锁”的机制来实现不同的隔离级别,包括对整个表加锁,对表中的行加锁。 - -### 视图 - -在已有的表或者视图上创建的虚拟表。 - -#### 创建视图 - -```mysql -create view 视图名 as select -``` - -注:可以对单表或者多表进行查询,数据库会将视图的定义保存下来。 - -可以对(单表)视图进行一些增删改查操作,这些操作会影响到原始的表。 - -#### 删除视图 - -```mysql -drop view 视图名 -``` - -### 索引 - - 为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - - 注:索引类似于一本书的目录 - -#### 创建索引 - -```mysql -create index 索引名 on 表名(字段列表) -``` - -在经常作为查询条件的字段加索引,除此以外,还要在分组、过滤、排序及联合查询的字段上加索引。 - -#### 删除索引 - -```mysql -drop index 索引名 on 表名 -``` - -### 锁 - -共享锁(S锁,读锁)和排他锁(X锁,写锁)——行锁 - -``` -共享锁:若事务A 对某行数据加S锁,此时允许其他事务对该行数据加S锁,即可以有多个事务共同读取改行数 据,但是不允许其他事务对该数据加X锁 - -排他锁(X锁,写锁,独占锁):若事务A对某行数据加X锁,此时不允许其他事务对该行数据加任何锁 -``` - -数据库中 - -数据库中进行增,删,改操作时,会自动给行添加排他锁,行数据添加上了排他锁,不允许其他事务对该行数据加任何锁 - -数据库中进行查(select)操作时,对数据不加任何锁 - -给行数据手动添加共享锁: - -```mysql -select ..from..lock in share mode -select..from .. for share -``` - -添加排他锁: - -```mysql -select...from...for update -``` - diff --git "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\346\261\275\350\275\246\351\224\200\345\224\256.md" "b/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\346\261\275\350\275\246\351\224\200\345\224\256.md" deleted file mode 100644 index 3e2e9fe33d99315dc2b808439fbbe975a170ce2d..0000000000000000000000000000000000000000 --- "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\346\261\275\350\275\246\351\224\200\345\224\256.md" +++ /dev/null @@ -1,210 +0,0 @@ -![image-20230917220642520](https://s2.loli.net/2023/09/17/rbkQX1HenwVu8z5.png) - -````mysql - -# 应用场景: - -```m --- 1.查询特定销售员的销售记录 --- 2.查找销售记录中销售价格最高的汽车 --- 3.统计某个销售员的销售总额 --- 4.根据客户信息查询其购买过的汽车 --- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 --- 6.检索特定日期范围内的销售了哪些汽车 --- 7.查找某车型的销售历史。 --- 8.统计每个销售员的销售数量 - -``` - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:55:58 */ -/*==============================================================*/ - -create database no_money_car charset utf8; - -use no_money_car; - -drop table if exists admin; - -drop table if exists car; - -drop table if exists car_brand; - -drop table if exists car_type; - -drop table if exists guke; - -drop table if exists xiaoshou; - -/*==============================================================*/ -/* Table: car_brand */ -/*==============================================================*/ -create table car_brand -( - car_brand_id int not null auto_increment, - car_brand_name varchar(20) not null, - primary key (car_brand_id) -); - -insert into car_brand values -(0,'宝马'), -(0,'大众'), -(0,'奔驰'), -(0,'玛莎拉蒂'); - -/*==============================================================*/ -/* Table: car_type */ -/*==============================================================*/ -create table car_type -( - car_type_id int not null auto_increment, - car_type_name varchar(10) not null, - primary key (car_type_id) -); - -insert into car_type values -(0,'SUV'), -(0,'轿车'), -(0,'货车'), -(0,'跑车'); - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - car_type_id int, - car_brand_id int, - car_name varchar(20) not null, - car_money numeric(8,1) not null, - primary key (car_id) -); - -insert into car values -(0,4,4,'B24',8851507.0), -(0,1,1,'A57',6505841.0), -(0,2,3,'蹦蹦',3548060.0), -(0,2,1,'486',7516152.0); - -/*==============================================================*/ -/* Table: guke */ -/*==============================================================*/ -create table guke -( - guke_id int not null auto_increment, - guke_name varchar(6) not null, - guke_tel varchar(11) not null, - primary key (guke_id) -); - -insert into guke values -(0,'刘总','15825681476'), -(0,'张总','18813681156'), -(0,'周总','17447681479'), -(0,'笑总','14563681278'); - -/*==============================================================*/ -/* Table: xiaoshou */ -/*==============================================================*/ -create table xiaoshou -( - xiaoshou_id int not null auto_increment, - xiaoshou_name varchar(6) not null, - xiaoshou_tel char(11) not null, - primary key (xiaoshou_id) -); - -insert into xiaoshou values -(0,'马量','16573821841'), -(0,'司马易','13828921841'), -(0,'孙武空','12815824841'); - -/*==============================================================*/ -/* Table: admin */ -/*==============================================================*/ -create table admin -( - admin_id int not null auto_increment, - xiaoshou_id int, - guke_id int, - car_id int, - admin_date date not null, - primary key (admin_id) -); - -insert into admin values -(0,1,1,1,'2022-9-4'), -(0,3,4,3,'2022-9-3'), -(0,3,2,2,'2022-9-3'), -(0,1,1,3,'2022-9-5'); - --- 1.查询特定销售员的销售记录 - -select * from xiaoshou x -join admin a on x.xiaoshou_id=a.xiaoshou_id -join car c on c.car_id=a.car_id -join car_type t on c.car_type_id=t.car_type_id -join car_brand b on c.car_brand_id=b.car_brand_id -where xiaoshou_name='孙武空'; - - -- 2.查找销售记录中销售价格最高的汽车 - -select max(car_money) from car c; - - -- 3.统计某个销售员的销售总额 - -select sum(car_money) from xiaoshou x -join admin a on x.xiaoshou_id=a.xiaoshou_id -join car c on c.car_id=a.car_id where xiaoshou_name='孙武空'; - - -- 4.根据客户信息查询其购买过的汽车 - -select * from guke g -left join admin a on g.guke_id=a.guke_id -left join car c on a.car_id=c.car_id; - - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -select car_brand_name,count(car_money),sum(car_money) from car_brand b -left join car c on b.car_brand_id=c.car_brand_id group by b.car_brand_id; - - -- 6.检索特定日期范围内的销售了哪些汽车 - -select car_name from admin a -left join car c on a.car_id=c.car_id where admin_date='2022-09-03'; - - -- 7.查找某车型的销售历史。 - -select car_name,admin_date from car c -left join admin a on c.car_id=a.car_id; - - -- 8.统计每个销售员的销售数量 - -select xiaoshou_name,count(car_name) from xiaoshou x -left join admin a on x.xiaoshou_id=a.xiaoshou_id -left join car c on a.car_id=c.car_id group by x.xiaoshou_id; - -alter table admin add constraint FK_sale foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table admin add constraint FK_select foreign key (guke_id) - references guke (guke_id) on delete restrict on update restrict; - -alter table admin add constraint FK_sell foreign key (xiaoshou_id) - references xiaoshou (xiaoshou_id) on delete restrict on update restrict; - -alter table car add constraint FK_brand foreign key (car_brand_id) - references car_brand (car_brand_id) on delete restrict on update restrict; - -alter table car add constraint FK_classify foreign key (car_type_id) - references car_type (car_type_id) on delete restrict on update restrict; - - -``` - - -```` - diff --git "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\350\261\206\347\223\243\347\224\265\345\275\261.md" "b/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\350\261\206\347\223\243\347\224\265\345\275\261.md" deleted file mode 100644 index 378922d67a85be795ef09fe33955fc11205e09b3..0000000000000000000000000000000000000000 --- "a/19\345\275\255\345\213\207\346\226\214/\347\254\224\350\256\260/\350\261\206\347\223\243\347\224\265\345\275\261.md" +++ /dev/null @@ -1,239 +0,0 @@ -## 豆瓣电影 - -```mysql -create database movie charset utf8; - -use movie; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 18:59:50 */ -/*==============================================================*/ - -drop table if exists account; - -drop table if exists actor; - -drop table if exists `comment`; - -drop table if exists country; - -drop table if exists director; - -drop table if exists `language`; - -drop table if exists member; - -drop table if exists movie; - -drop table if exists screenwriter; - -drop table if exists `show`; - -drop table if exists type; - -/*==============================================================*/ -/* Table: account */ -/*==============================================================*/ - -# 账户 -create table account -( - accoout_id int not null auto_increment, - account_name varchar(5) not null, - account_sex char(1), - account_distrct varchar(5), # 账户地区 - account_label varchar(10), # 个性签名 - primary key (accoout_id) -); - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - member_id int not null, - movie_id int not null, - primary key (member_id, movie_id) -); - -/*==============================================================*/ -/* Table: comment */ -/*==============================================================*/ - -#评论 -create table `comment` -( - comment_id int not null auto_increment, - accoout_id int not null, - comment_state char(2), # 想看/看过 - comment_label varchar(3), # 标签 - comment_name varchar(50), # 内容 - comment_radio char(1) not null, # 是否放入广播 - comment_starts int not null, # 评星 - primary key (comment_id) -); - -/*==============================================================*/ -/* Table: country */ -/*==============================================================*/ -create table country -( - country_id int not null auto_increment, - country_name varchar(5) not null, - primary key (country_id) -); - -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - member_id int not null, - movie_id int not null, - primary key (member_id, movie_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table `language` -( - language_id int not null auto_increment, - language_name varchar(3) not null, - primary key (language_id) -); - -/*==============================================================*/ -/* Table: member */ -/*==============================================================*/ - -# 主要人员 -create table member -( - member_id int not null auto_increment, - member_name varchar(10) not null, - member_sex char(1) not null, - member_constellation char(3) not null, # 星座 - member_born date not null, # 出生日期 - member_job varchar(2) not null, - member_foreign varchar(50), # 更多外国名 - member_chinese varchar(10), # 更多中国名 - family varchar(20), #家庭情况 - imdb_id char(9) not null, - primary key (member_id) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_id int not null auto_increment, - type_id int not null, - country_id int not null, - language_id int not null, - movie_name varchar(10) not null, - movie_date date not null, - movie_time int not null, - movie_name_2 varchar(10) not null, # 别名 - IMDb char(10) not null, - primary key (movie_id) -); - -/*==============================================================*/ -/* Table: screenwriter */ -/*==============================================================*/ -create table screenwriter -( - member_id int not null, - movie_id int not null, - primary key (member_id, movie_id) -); - -/*==============================================================*/ -/* Table: show */ -/*==============================================================*/ -create table `show` -( - id int not null, - movie_id int not null, - comment_id int not null, - movie_score numeric(2,1) not null, - comment_num int not null, - primary key (id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name char(2) not null, - primary key (type_id) -); - -alter table actor add constraint FK_movie_member3 foreign key (member_id) - references member (member_id) on delete restrict on update restrict; - -alter table actor add constraint FK_movie_member6 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table `comment` add constraint FK_comment foreign key (accoout_id) - references account (accoout_id) on delete restrict on update restrict; - -alter table director add constraint FK_movie_member1 foreign key (member_id) - references member (member_id) on delete restrict on update restrict; - -alter table director add constraint FK_movie_member4 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table movie add constraint FK_country_movie foreign key (country_id) - references country (country_id) on delete restrict on update restrict; - -alter table movie add constraint FK_language_movie foreign key (language_id) - references language (language_id) on delete restrict on update restrict; - -alter table movie add constraint FK_type_movie foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table screenwriter add constraint FK_movie_member2 foreign key (member_id) - references member (member_id) on delete restrict on update restrict; - -alter table screenwriter add constraint FK_movie_member5 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table `show` add constraint FK_Relationship_12 foreign key (comment_id) - references comment (comment_id) on delete restrict on update restrict; - -alter table `show` add constraint FK_movie_comment foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -INSERT INTO `account` VALUES (1, '伊恩', NULL, NULL, NULL); -INSERT INTO `account` VALUES (2, '艾小柯', NULL, '澳大利亚', NULL); -INSERT INTO `account` VALUES (3, '麻辣小龙虾', NULL, '广东', NULL); - -INSERT INTO `member` VALUES (1, '乌尔善', '男', '双子座', '1972-06-10', '导演', 'Uragshaa', ' U23(昵称)', '蒙柯卓兰(妻)', 'nm4069612'); -INSERT INTO `member` VALUES (2, '冉平', '男', '双子座', '1953-06-10', '编剧', NULL, NULL, '冉甲男(女)', 'nm3220563'); -INSERT INTO `member` VALUES (3, '费翔', '男', '摩羯座', '1960-12-24', '演员', NULL, NULL, NULL, 'nm1191525'); - -INSERT INTO `country` VALUES (1, '中国大陆'); - -INSERT INTO `language` VALUES (1, '汉语'); - -INSERT INTO `type` VALUES (1, '动作'); - -INSERT INTO `movie` VALUES (1, 1, 1, 1, '封神第一部:朝歌风云', '2023-07-20', 148, '封神第一部', 'tt6979756'); - -INSERT INTO `comment` VALUES (1, 3, '看过', NULL, '太好看了', '否', 5); - -INSERT INTO `director` VALUES (1, 1); - -INSERT INTO `screenwriter` VALUES (2, 1); - -INSERT INTO `actor` VALUES (3, 1); - -INSERT INTO `show` VALUES (1, 1, 1, 7.9, 860010); - -``` \ No newline at end of file diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230905MySQL\351\253\230\347\272\247\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" "b/20 \347\237\263\350\211\257\346\266\233/20230905MySQL\351\253\230\347\272\247\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" deleted file mode 100644 index 9a77b0ee5602cd77562744ace4bebc0d0a7b9a96..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230905MySQL\351\253\230\347\272\247\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" +++ /dev/null @@ -1,25 +0,0 @@ - - -1. **索引优化**:了解如何设计和使用索引来提高查询性能。包括B树索引、全文索引等。 - -2. **事务管理**:学习如何使用事务来确保数据的一致性和完整性。包括事务的启动、提交、回滚等操作。 - -3. **视图和存储过程**:了解如何创建和使用视图以及存储过程,以简化复杂查询和操作。 - -4. **性能优化**:深入了解如何分析和优化查询性能,包括使用`EXPLAIN`语句来分析查询执行计划。 - -5. **安全性**:学习如何设置数据库的安全性,包括用户权限管理和数据加密等方面。 - -6. **复制和高可用性**:了解MySQL复制机制以及如何配置高可用性解决方案,如主从复制和集群。 - -7. **分区和分表**:学习如何对大型数据库进行分区和分表,以提高性能和管理性。 - -8. **备份和恢复**:了解如何定期备份数据库,并学习紧急情况下如何进行数据恢复。 - -9. **JSON支持**:掌握MySQL中对JSON数据的支持,以便处理半结构化数据。 - -10. **性能监控和日志分析**:学习如何使用性能监控工具和分析数据库日志以发现潜在问题。 - - - - diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230906MySQL\351\253\230\347\272\247\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" "b/20 \347\237\263\350\211\257\346\266\233/20230906MySQL\351\253\230\347\272\247\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" deleted file mode 100644 index 6b78ae72c8d5670a112cf374aa334e1383324c83..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230906MySQL\351\253\230\347\272\247\347\254\254\344\272\214\346\254\241\347\254\224\350\256\260.md" +++ /dev/null @@ -1,25 +0,0 @@ - - -1. **性能调优**:深入了解MySQL性能调优的策略,包括查询优化、索引优化和缓存配置等。 - -2. **分布式数据库**:了解如何配置和管理分布式MySQL数据库,以支持大规模数据处理。 - -3. **存储引擎**:深入研究不同存储引擎(如InnoDB、MyISAM、Memory等)的特性和适用场景。 - -4. **扩展性**:学习如何扩展MySQL以应对高负载和大规模数据增长,包括分片和负载均衡策略。 - -5. **安全审计**:了解如何进行数据库的安全审计,跟踪用户活动和检测潜在的安全威胁。 - -6. **备份策略**:深入了解备份策略,包括全量备份、增量备份和差异备份等。 - -7. **故障恢复**:学习如何应对数据库故障,并了解恢复数据库的最佳实践。 - -8. **外键和约束**:深入研究如何使用外键和约束来维护数据完整性。 - -9. **并发控制**:了解MySQL的并发控制机制,包括事务隔离级别和锁的管理。 - -10. **监控工具**:学习如何使用各种监控工具来实时监视数据库性能和健康状态。 - -11. **NoSQL数据库**:探索MySQL与NoSQL数据库的集成,如使用MySQL作为文档存储或键值存储。 - - diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230907 \346\225\260\346\215\256\345\272\223\345\205\263\347\263\273.md" "b/20 \347\237\263\350\211\257\346\266\233/20230907 \346\225\260\346\215\256\345\272\223\345\205\263\347\263\273.md" deleted file mode 100644 index 1a250894b2a9da2ef4f297d70c2d3f7bf1da5654..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230907 \346\225\260\346\215\256\345\272\223\345\205\263\347\263\273.md" +++ /dev/null @@ -1,150 +0,0 @@ -### 数据库关系 - -#### 1.关系是相互的 - -​ 比如,一个学生,可以选多个课程;一个课程可以被多个学生选,必须引用第三张表 - -#### 2.表之间的关系 - -1. 一对一:将其中任一表中的主键,放到另一张表当外键 -2. 一对多:将一所在的表的主键,放在多的表当外键 -3. 多对多:必须有第三张表,将前面两个表的主键放进来当外键 - -#### 3.ER图 - -​ ER图:实体关系图,简称E-R,用于显示实体集之间的关系。它提供了一种表示实体类型、属性、联系的方法。 - -​ ER图三要素:实体、属性、联系 - -#### 作业 - -~~~ mysql -# 创建学生数据库 -create database student charset utf8; -use student; - -# 创建院系表 -create table college( - co_id int primary key, - co_name varchar(50) not null -); -# 插入数据 -insert into college values -(1,"软件工程学院"), -(2,"财经商贸学院"), -(3,"信息工程学院"), -(4,"智能制造学院"); - -# 创建专业表 -create table major( - m_id int primary key, - m_name varchar(20) not null, - co_id int, - foreign key(co_id) references college(co_id) -); -# 插入数据 -insert into major values -(1,"前端开发",1), -(2,"后端开发",1), -(3,"人力财务管理",2), -(4,"大数据技术",3), -(5,"电气自动化技术",4); - -# 创建班级表 -create table class( - c_id int primary key, - c_name varchar(20) not null, - m_id int, - foreign key(m_id) references major(m_id) -); -# 插入数据 -insert into class values -(1,"软件技术2班",2), -(2,"软件技术7班",1), -(3,"人力财务管理1班",3), -(4,"大数据技术4班",4), -(5,"电气自动化技术3班",5); - -# 创建学生表 -create table student( - s_id int primary key, - s_name varchar(10) not null, - sex varchar(2) not null, - c_id int, - foreign key(c_id) references class(c_id) -); -# 插入数据 -insert into student values -(1,"卢亨耀","男",1), -(2,"李堔义","男",2), -(3,"王小丽","女",3), -(4,"孙泽傲","男",4), -(5,"方蔼雅","男",5); - -# 创建课程信息表 -create table course_inf( - c_id int primary key, - c_name varchar(10) not null -); -# 插入数据 -insert into course_inf values -(1,"MySQL高级"), -(2,"javaScript"), -(3,"财务管理"), -(4,"大数据"), -(5,"电气自动化"); - -# 创建教室表 -create table classroom( - cr_id int primary key, - address varchar(20) not null -); -# 插入数据 -insert into classroom values -(1,"望云楼实训室8"), -(2,"望云楼实训室6"), -(3,"岩声楼305"), -(4,"辛耕楼204"), -(5,"辛耕楼105"); - - -# 创建教师表 -create table teacher( - t_id int primary key, - t_name varchar(5) not null, - sex varchar(2) not null, - co_id int, - foreign key(co_id) references college(co_id) -); -# 插入数据 -insert into teacher values -(001,"丘老师","男",1), -(002,"王老师","男",1), -(003,"黄老师","女",2), -(004,"徐老师","男",3), -(005,"李老师","女",4); - -# 创建课程表(中间表) -create table course( - c_id int, - cr_id int, - t_id int, - s_id int, - foreign key(c_id) references course_inf(c_id), - foreign key(cr_id) references classroom(cr_id), - foreign key(t_id) references teacher(t_id), - foreign key(s_id) references student(s_id) -); -# 插入数据 -insert into course values -(1,1,1,1), -(2,2,2,2), -(3,3,3,3), -(4,4,4,4), -(5,5,5,5); - -# 查询 -select * from college co,major m,class cl,student s ,course c,course_inf ci,classroom cr,teacher t where co.co_id=m.co_id and m.m_id=cl.m_id and cl.c_id=s.c_id and s.s_id=c.s_id and ci.c_id=c.c_id and cr.cr_id=c.cr_id and t.t_id=c.t_id; - -~~~ - diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" "b/20 \347\237\263\350\211\257\346\266\233/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" deleted file mode 100644 index fb5ddb23498020fcff22e67fcfc0a66a28b9dcdd..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" +++ /dev/null @@ -1,10 +0,0 @@ -### 数据库范式 - - 范式也是一种规则 - -1. 要求字段内容,不可再分割,为了保证数字原子性 -2. 在满足范式1 的要求基础上,要求非主键字段要完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 -3. 满足范式2 的基础上,非关键属性要直接依赖于主键不能出现传递依赖。 - -但是实际开发当中不会完全按照范式来设计,因为需求不同,所以有时会故意反范式 - diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230908\347\273\223\346\236\204.md" "b/20 \347\237\263\350\211\257\346\266\233/20230908\347\273\223\346\236\204.md" deleted file mode 100644 index deb15214a339d2f65e9d0294fabbb66a522d95fc..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230908\347\273\223\346\236\204.md" +++ /dev/null @@ -1,122 +0,0 @@ -### 结构 - -结构图分为: - -1. E-R图 -2. powerDesigner - -powerDesigner使用 - -1. 创建概念模型 类似于E-R图 以人的角度 -2. 转成逻辑模型 以计算机的角度 -3. 转换成物理模型 以数据库的角度 -4. 生成DDL语句 - -### 图书管理系统代码 - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 9:34:50 */ -/*==============================================================*/ -CREATE DATABASE take CHARSET utf8; -use take; -drop table if exists Admin; - -drop table if exists Borrowinfo; - -drop table if exists Readerinfo; - -drop table if exists book; - -drop table if exists limits; - -/*==============================================================*/ -/* Table: Admin */ -/*==============================================================*/ -create table Admin -( - A_id char(5) not null, - book_id char(10) not null, - Boor_id int not null, - A_name char(15) not null, - A_paw char(16), - A_tel char(11) not null, - primary key (A_id) -); - -/*==============================================================*/ -/* Table: Borrowinfo */ -/*==============================================================*/ -create table Borrowinfo -( - Boor_id int not null, - Reade_id char(10) not null, - book_id char(10) not null, - Rea_id char(10) not null, - Book_number char(10) not null, - Boor_time datetime not null, - due_time datetime not null, - return_time datetime not null, - state int not null, - admin_id char(10) not null, - primary key (Boor_id) -); - -/*==============================================================*/ -/* Table: Readerinfo */ -/*==============================================================*/ -create table Readerinfo -( - Reade_id char(10) not null, - Level char(10) not null, - name char(15) not null, - Reade_faculty char(10) not null, - Readejjtime timestamp not null, - primary key (Reade_id) -); - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - book_id char(10) not null, - title char(25) not null, - quantity int not null, - address varchar(25) not null, - author char(30) not null, - press char(30) not null, - time timestamp not null, - primary key (book_id) -); - -/*==============================================================*/ -/* Table: limits */ -/*==============================================================*/ -create table limits -( - Level char(10) not null, - MaxBookNum char(10) not null, - MaxDays char(10) not null, - primary key (Level) -); - -alter table Admin add constraint FK_admin foreign key (book_id) - references book (book_id) on delete restrict on update restrict; - -alter table Admin add constraint FK_regulate foreign key (Boor_id) - references Borrowinfo (Boor_id) on delete restrict on update restrict; - -alter table Borrowinfo add constraint FK_Borrowinfo foreign key (Reade_id) - references Readerinfo (Reade_id) on delete restrict on update restrict; - -alter table Borrowinfo add constraint FK_borrow foreign key (book_id) - references book (book_id) on delete restrict on update restrict; - -alter table Readerinfo add constraint FK_astrict foreign key (Level) - references limits (Level) on delete restrict on update restrict; - - -~~~ - diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230912 \347\224\265\345\275\261\346\236\266\346\236\204\345\233\276.md" "b/20 \347\237\263\350\211\257\346\266\233/20230912 \347\224\265\345\275\261\346\236\266\346\236\204\345\233\276.md" deleted file mode 100644 index b6d797318b7ba001b0b4687bada7395dc5be5b45..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230912 \347\224\265\345\275\261\346\236\266\346\236\204\345\233\276.md" +++ /dev/null @@ -1,191 +0,0 @@ -### 电影架构图 - -![图片1](https://s2.loli.net/2023/09/12/lA7GCrDE1m54pbo.png) - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 18:32:00 */ -/*==============================================================*/ -CREATE DATABASE movie_db CHARSET utf8; -use movie_db; - -drop table if exists director; - -drop table if exists film; - -drop table if exists language; - -drop table if exists movieInfo; - -drop table if exists participants; - -drop table if exists protagonist; - -drop table if exists region; - -drop table if exists score; - -drop table if exists scriptwriter; - -drop table if exists user; - -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - part_id char(10) not null, - movie_id char(8) not null, - primary key (part_id, movie_id) -); - -/*==============================================================*/ -/* Table: film */ -/*==============================================================*/ -create table film -( - film_id char(10) not null, - user_id char(10) not null, - film_name char(10) not null, - film_title char(10) not null, - text char(10) not null, - appraise char(10), - primary key (film_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - lang_id char(10) not null, - lang_name varchar(5), - primary key (lang_id) -); - -/*==============================================================*/ -/* Table: movieInfo */ -/*==============================================================*/ -create table movieInfo -( - movie_id char(8) not null, - film_id char(10) not null, - sc_id char(10) not null, - lang_id char(10) not null, - movie_name varchar(20) not null, - movie_time int not null, - type_id char(5) not null, - release_date datetime not null, - alias varchar(20) not null, - primary key (movie_id) -); - -/*==============================================================*/ -/* Table: participants */ -/*==============================================================*/ -create table participants -( - part_id char(10) not null, - name char(10) not null, - age int, - primary key (part_id) -); - -/*==============================================================*/ -/* Table: protagonist */ -/*==============================================================*/ -create table protagonist -( - part_id char(10) not null, - movie_id char(8) not null, - sex char(1) not null, - birthday varchar(15) not null, - `else` varchar(10), - profession char(30) not null, - address varchar(15), - primary key (part_id, movie_id) -); - -/*==============================================================*/ -/* Table: region */ -/*==============================================================*/ -create table region -( - reg_id char(10) not null, - movie_id char(8), - reg_name char(25) not null, - primary key (reg_id) -); - -/*==============================================================*/ -/* Table: score */ -/*==============================================================*/ -create table score -( - sc_id char(10) not null, - user_id char(10) not null, - grade char(10) not null, - primary key (sc_id) -); - -/*==============================================================*/ -/* Table: scriptwriter */ -/*==============================================================*/ -create table scriptwriter -( - part_id char(10) not null, - movie_id char(8) not null, - primary key (part_id, movie_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id char(10) not null, - user_name varchar(20) not null, - user_sex char(1) not null, - primary key (user_id) -); - -alter table director add constraint FK_director foreign key (part_id) - references participants (part_id) on delete restrict on update restrict; - -alter table director add constraint FK_director2 foreign key (movie_id) - references movieInfo (movie_id) on delete restrict on update restrict; - -alter table film add constraint FK_write foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table movieInfo add constraint FK_evaluate foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table movieInfo add constraint FK_mark foreign key (sc_id) - references score (sc_id) on delete restrict on update restrict; - -alter table movieInfo add constraint FK_select foreign key (lang_id) - references language (lang_id) on delete restrict on update restrict; - -alter table protagonist add constraint FK_protagonist foreign key (part_id) - references participants (part_id) on delete restrict on update restrict; - -alter table protagonist add constraint FK_protagonist2 foreign key (movie_id) - references movieInfo (movie_id) on delete restrict on update restrict; - -alter table region add constraint FK_publish foreign key (movie_id) - references movieInfo (movie_id) on delete restrict on update restrict; - -alter table score add constraint FK_comment foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter foreign key (part_id) - references participants (part_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter2 foreign key (movie_id) - references movieInfo (movie_id) on delete restrict on update restrict; - - -~~~ - diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230913 \345\214\273\351\231\242\346\225\260\346\215\256\345\272\223.md" "b/20 \347\237\263\350\211\257\346\266\233/20230913 \345\214\273\351\231\242\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index 6ff1e2e67f04f08771bea2da79b76a233cf7d86e..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230913 \345\214\273\351\231\242\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,256 +0,0 @@ -# 笔记 - -#### 如果一个主体的属性有多个值,那这个属性就可以拆成一个新主体 - -# 作业 - -### 医院数据库设计 - - 需求分析 - -科室(科室编号,科室名,地址,联系电话) - -病人(病历号,姓名,年龄,性别) - -病房(病房编号,病房名) - -药品(药品编号,药品名称,价格,重量) - -药品分类(分类编号,分类名) - -药房 (药房编号,药房名) - -护士(工号,姓名,年龄,性别) - -![image-20230914011846375](https://s2.loli.net/2023/09/14/JgjkF7sh3MxXiqW.png) - -![image-20230914012312885](https://s2.loli.net/2023/09/14/X89l3YLiEfydJcx.png) - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 1:24:04 */ -/*==============================================================*/ -create database yy charset utf8; -use yy; - -drop table if exists assignment; - -drop table if exists department; - -drop table if exists diagnosis; - -drop table if exists doctor; - -drop table if exists nurse; - -drop table if exists patient; - -drop table if exists pharmaceuticals; - -drop table if exists pharmacy; - -drop table if exists prescription; - -drop table if exists type; - -drop table if exists ward; - -/*==============================================================*/ -/* Table: assignment */ -/*==============================================================*/ -create table assignment -( - ward_id int not null, - nurse_id char(10) not null, - assignment_date date not null, - primary key (ward_id, nurse_id) -); - -/*==============================================================*/ -/* Table: department */ -/*==============================================================*/ -create table department -( - departmen_id int not null auto_increment, - department_name varchar(10) not null, - department_add varchar(50) not null, - department_tel char(11) not null, - primary key (departmen_id) -); - -/*==============================================================*/ -/* Table: diagnosis */ -/*==============================================================*/ -create table diagnosis -( - patient_id char(10) not null, - doctor_id char(10) not null, - diagnosis_name varchar(255) not null, - diagnosis_time datetime not null, - primary key (patient_id, doctor_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id char(10) not null, - departmen_id int not null, - doctor_name varchar(4) not null, - doctor_age char(2) not null, - doctor_sex char(1) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: nurse */ -/*==============================================================*/ -create table nurse -( - nurse_id char(10) not null, - departmen_id int not null, - nurse_name varchar(4) not null, - nurse_age char(2) not null, - nurse_sex char(1) not null, - primary key (nurse_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id char(10) not null, - ward_id int not null, - patient_name varchar(4) not null, - patient_age char(2) not null, - patient_sex char(1) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: pharmaceuticals */ -/*==============================================================*/ -create table pharmaceuticals -( - pharmaceuticals_id int not null auto_increment, - pharmacy_id int not null, - type_id int not null, - pharmaceuticals_name varchar(10) not null, - pharmaceuticals_prrice int not null, - pharmaceuticals_wigat decimal(5,2) not null, - primary key (pharmaceuticals_id) -); - -/*==============================================================*/ -/* Table: pharmacy */ -/*==============================================================*/ -create table pharmacy -( - pharmacy_id int not null auto_increment, - pharmacy_name varchar(10) not null, - primary key (pharmacy_id) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - pharmaceuticals_id int not null, - patient_id char(10) not null, - prescription_say varchar(255) not null, - prescription_time time not null, - primary key (pharmaceuticals_id, patient_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name varchar(3) not null, - primary key (type_id) -); - -/*==============================================================*/ -/* Table: ward */ -/*==============================================================*/ -create table ward -( - ward_id int not null auto_increment, - ward_name varchar(10) not null, - primary key (ward_id) -); - -alter table assignment add constraint FK_assignment foreign key (ward_id) - references ward (ward_id) on delete restrict on update restrict; - -alter table assignment add constraint FK_assignment2 foreign key (nurse_id) - references nurse (nurse_id) on delete restrict on update restrict; - -alter table diagnosis add constraint FK_diagnosis foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table diagnosis add constraint FK_diagnosis2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table doctor add constraint FK_belong foreign key (departmen_id) - references department (departmen_id) on delete restrict on update restrict; - -alter table nurse add constraint FK_belongs foreign key (departmen_id) - references department (departmen_id) on delete restrict on update restrict; - -alter table patient add constraint FK_live foreign key (ward_id) - references ward (ward_id) on delete restrict on update restrict; - -alter table pharmaceuticals add constraint FK_deposit foreign key (pharmacy_id) - references pharmacy (pharmacy_id) on delete restrict on update restrict; - -alter table pharmaceuticals add constraint FK_have foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription foreign key (pharmaceuticals_id) - references pharmaceuticals (pharmaceuticals_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -#科室 -insert into department values -(1,"内科","2楼","12345678912"),(2,"外科","5楼","23456789123"); -#护士 -insert into nurse values -(101,1,"瓜文成","22","男"),(120,2,"周福","20","女"); -#医生 -insert into doctor values -(1001,1,"时雪安","22","男"),(1002,2,"夜只浩","20","男"); -#病房 -insert into ward values -(1,"一号病房"),(2,"二号病房"); -#病人 -insert into patient values -(10001,1,"时量涛","19","男"),(10002,2,"文贵文","20","女"); -#药品分类 -insert into type values -(1,"中药"),(2,"西药"); -#药房 -insert into pharmacy values -(1,"1号药房"),(2,"2号药房"); -#药品 -insert into pharmaceuticals values -(1,1,1,"安眠药",666,105.22),(2,2,2,"止泻药",888,110.11); -#分配 -insert into assignment values -(1,101,"2023-09-13"),(2,120,"2023-09-12"); -#诊断 -insert into diagnosis values -(10001,1001,"失眠症","2023-09-13 13:22:01"),(10002,1002,"结石","2023-09-12 16:13:11"); -#处方 -insert into prescription values -(1,10001,"注意休息","13:30:22"),(2,10002,"6666666","18:30:30"); -``` - diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230915 \346\261\275\350\275\246\345\224\256\345\215\226\347\263\273\347\273\237.md" "b/20 \347\237\263\350\211\257\346\266\233/20230915 \346\261\275\350\275\246\345\224\256\345\215\226\347\263\273\347\273\237.md" deleted file mode 100644 index 8f971de5d2b6f6de45364241bd07005eb022fbc7..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230915 \346\261\275\350\275\246\345\224\256\345\215\226\347\263\273\347\273\237.md" +++ /dev/null @@ -1,154 +0,0 @@ -![](https://s2.loli.net/2023/09/16/bYhJlVZ3SKnGOH7.png) - -~~~ mysql -create database buy_car charset utf8; -use buy_car; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/16 16:12:55 */ -/*==============================================================*/ - - -drop table if exists car; - -drop table if exists car_brand; - -drop table if exists customer; - -drop table if exists sales_record; - -drop table if exists salesperson; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - cb_id int, - car_name varchar(10) not null, - car_price decimal(4,2) not null, - primary key (car_id) -); -insert into car values -(null,1,'奥迪A6L',42.79), -(null,1,'奥迪A8L',82.98), -(null,1,'奥迪A4L',32.18), -(null,2,'奔驰S400L',86.26), -(null,2,'奔驰GLA',28.78), -(null,2,'奔驰E级',50.25), -(null,3,'宝马X3',63.69), -(null,3,'宝马2系',41.98), -(null,3,'宝马X5',71.99); - -/*==============================================================*/ -/* Table: car_brand */ -/*==============================================================*/ -create table car_brand -( - cb_id int not null auto_increment, - cb_name varchar(10) not null, - primary key (cb_id) -); -insert into car_brand values -(null,'奥迪'), -(null,'奔驰'), -(null,'宝马'); - -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - customer_id int not null auto_increment, - customer_name varchar(5) not null, - customer_sex char(1) not null, - customer_tel varchar(11) not null, - customer_address varchar(20) not null, - primary key (customer_id) -); -insert into customer values -(null,'张三','男','18850625585','福建省南平市'), -(null,'李四','女','16845766554','福建省龙岩市'), -(null,'王五','男','14950028523','福建省泉州市'), -(null,'赵六','女','15650258573','福建省漳州市'), -(null,'田七','女','14589562573','福建省漳州市'); - -/*==============================================================*/ -/* Table: 销售记录 */ -/*==============================================================*/ -create table sales_record -( - sr_id int not null auto_increment, - car_id int, - sp_id int, - customer_id int, - sr_time date not null, - primary key (sr_id) -); -insert into sales_record values -(null,2,1,1,'2023-02-13'), -(null,1,3,1,'2023-05-23'), -(null,3,1,3,'2023-03-19'), -(null,5,2,2,'2023-07-21'), -(null,4,4,5,'2023-06-14'), -(null,6,2,4,'2023-08-15'), -(null,9,3,2,'2023-07-21'); - -/*==============================================================*/ -/* Table: 销售员 */ -/*==============================================================*/ -create table salesperson -( - sp_id int not null auto_increment, - sp_name varchar(5) not null, - sp_sex char(1) not null, - sp_tel varchar(11) not null, - sp_address varchar(20) not null, - primary key (sp_id) -); -insert into salesperson values -(null,'小李','男','14648515156','福建省南平市'), -(null,'小敏','女','18956764856','福建省漳州市'), -(null,'小莉','女','15989525856','福建省龙岩市'), -(null,'小黄','男','15954879156','福建省龙岩市'); - -alter table car add constraint FK_belong_to foreign key (cb_id) - references car_brand (cb_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_buy foreign key (customer_id) - references customer (customer_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_sell_a foreign key (sp_id) - references salesperson (sp_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_sell_b foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - - - - -- 1.查询特定销售员的销售记录(小李) - select * from salesperson s,sales_record sr where s.sp_id = sr.sp_id and sp_name = '小李'; - -- 2.查找销售记录中销售价格最高的汽车 - select * from car where car_price = - (select max(car_price) from car c,sales_record sr where c.car_id = sr.car_id); - -- 3.统计某个销售员的销售总额(小敏) - select sum(car_price) 万元 from car c,sales_record sr where c.car_id = sr.car_id and sp_id =(select sp_id from salesperson where sp_name = '小敏'); - -- 4.根据客户信息查询其购买过的汽车(李四) - select * from car where car_id in - (select car_id from sales_record where customer_id = (select customer_id from customer where customer_name = '李四')); - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额(奔驰) - select cb.cb_name 品牌,count(cb.cb_id) 销售数量,sum(car_price) 总销售额万元 - from car_brand cb,car c,sales_record sr where cb.cb_id = c.cb_id and c.car_id = sr.car_id group by cb.cb_id; - -- 6.检索特定日期范围内的销售了哪些汽车(2023-07-21) - select * from car where car_id in - (select car_id from sales_record where sr_time = '2023-07-21'); - -- 7.查找某车型的销售历史(宝马X3)。 - select * from sales_record where car_id = - (select car_id from car where car_name = '奔驰S400L'); - -- 8.统计每个销售员的销售数量 - select sp_name 销售员,count(sp.sp_id) 销售数量 from salesperson sp , sales_record sr where sp.sp_id = sr.sp_id group by sp.sp_id; - -~~~ - diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230919 \346\237\245\350\257\242\345\244\215\344\271\240\351\242\230.md" "b/20 \347\237\263\350\211\257\346\266\233/20230919 \346\237\245\350\257\242\345\244\215\344\271\240\351\242\230.md" deleted file mode 100644 index 68ed311e649a499157ee8f1ee6c9720320febca6..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230919 \346\237\245\350\257\242\345\244\215\344\271\240\351\242\230.md" +++ /dev/null @@ -1,776 +0,0 @@ -## mysql复习 - -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不是null,就保持原值 - -limit 起始数,显示数 - -desc 库名:显示表结构 - -length(email):email的字节长度 - -#### 自然连接 - -表,表 where 字段=字段 and 字段=字段 - -#### 联表区间 - -表 left join 表 on 表.字段 between 表.字段 and 表.字段(不支持别名) - -#### 自连接 - -inner join - -not in(条件,条件) - -!(between 20 and 50) - -#### 代码 - -~~~ mysql - -create database text01 charset utf8; -use text01; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - - - - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -#理解1:计算12月的基本工资 - select sum(salary * 12) 工资总和 from employees ; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - select sum(salary * 12) + sum(salary * 12 * commission_pct) 实发工资 from employees; - select sum(salary * 12 + salary * 12 * ifnull(commission_pct,0)) 实发工资 from employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - select distinct(job_id) from employees; - -# 3.查询工资大于12000的员工姓名和工资 - select first_name 姓名,salary 工资 from employees where salary > 12000; - -# 4.查询员工号为176的员工的姓名和部门号 - select first_name 姓名,department_id 部门号 from employees where employee_id = 176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - desc departments; - select * from departments; - - - -# 第04章_运算符课后练习 -# 1.选择工资不在5000到12000的员工的姓名和工资 - select first_name 姓名,salary 工资 from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - select first_name 姓名,department_id 部门号 from employees where department_id in(20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - select first_name 姓名,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,奖金和奖金级别 - select first_name 姓名,e.salary*commission_pct 奖金,grade_level 奖金级别 from employees e left join job_grades j on e.salary*commission_pct between j.lowest_sal and j.highest_sal where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - select first_name 姓名 from employees where first_name like '__尔'; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - select * from employees where last_name like '%特%' and last_name like '%尔%' - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - select * from employees where first_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - select first_name 姓名,job_title 工种 from employees e left join jobs j on e.job_id=j.job_id where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,108 的员工姓名、工资、管理者id - select first_name 员工姓名,salary 工资,manager_id 管理者id from employees where manager_id in(100,101,108) - - - - -#第05章_排序与分页的课后练习 - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - select first_name 姓名,department_id 部门号,(salary * 12) 年薪 from employees order by 年薪 desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - select * from employees where salary not between 8000 and 17000 order by salary desc limit 21,19; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - select * from employees where email like '%e%' order by char_length(email) desc,department_id; - - - - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - select first_name 姓名,e.job_id 部门号,job_title 部门名称 from employees e,jobs j where e.job_id=j.job_id - -# 2.查询90号部门员工的job_id和90号部门的location_id - select job_id,location_id from employees e,departments d where e.department_id = d.department_id and e.department_id = 90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - select last_name ,department_name ,d.location_id ,city - from employees e,departments d,locations l - where e.department_id = d.department_id and d.location_id = l.location_id and commission_pct is not null; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - - #子查询 - select last_name ,job_id ,b.department_id ,department_name from employees e, - (select department_id ,department_name from departments where location_id = - (select location_id from locations where city = '多伦多')) b where e.department_id=b.department_id; - - #连表查 - select last_name ,job_id ,d.department_id ,department_name - from locations l ,departments d ,employees e - where l.location_id = d.location_id and d.department_id = e.department_id and city = '多伦多'; - - -#sql92语法(自然连接): - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - #select * from locations join departments join employees where department_name = '行政部'; - select d.department_name 部门名称,l.street_address 部门地址,e.first_name 姓名,j.job_title 工作,e.salary 工资 from locations l - left join departments d on l.location_id = d.location_id - left join employees e on d.department_id = e.department_id - right join jobs j on e.job_id = j.job_id where d.department_name = '行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - select e1.last_name 员工姓名,e1.employee_id 员工编号,e2.last_name 上级姓名,e2.employee_id 上级的员工编号 from employees e1,employees e2 where e1.manager_id =e2.employee_id - -# 7.查询哪些部门没有员工 - select department_name 部门名称 from departments d left join employees e on d.department_id = e.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - select city 没有部门的城市 from locations where location_id not in - (select distinct(location_id) from departments); - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - select * from employees where department_id in - (select department_id from departments where department_name in('销售部','信息技术部')); - - - - -# 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees ; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - select j.job_id, max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 - from jobs j left join employees e on j.job_id = e.job_id group by j.job_id; - -#4.选择各个job_id的员工人数 - select j.job_id,count(j.job_id) from jobs j left join employees e on j.job_id = e.job_id group by j.job_id; - -# 5.查询员工最高工资和最低工资的差距 - select max(salary)-min(salary) 最高工资和最低工资的差距 from employees ; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - select e1.manager_id,min(e1.salary) 最低工资 - from employees e1 right join employees e2 on e1.manager_id = e2.employee_id - where e1.salary >6000 group by e1.manager_id - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - select d.department_name 部门名,d.location_id,count(e.department_id) 员工数量,avg(e.salary) 平均工资 - from employees e right join departments d on e.department_id = d.department_id - group by d.department_id order by 平均工资 desc - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - select d.department_name 部门名,j.job_title 工种名,min(e.salary) 最低工资 from jobs j right join employees e on j.job_id = e.job_id left join departments d on e.department_id = d.department_id group by j.job_id,d.department_id; - - - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - select last_name 员工姓名,salary 工资 from employees where department_id = - (select department_id from employees where last_name = '兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - #select l.location_id, avg(e.salary) 平均工资 from locations l right join departments d on l.location_id = d.location_id left join employees e on d.department_id = e.department_id group by l.location_id; - - select employee_id,first_name,salary from employees where salary>(select avg(salary) from employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - select last_name, job_id, salary from employees where salary > - (select max(e.salary) from jobs j left join employees e on j.job_id = e.job_id where j.job_id = 'SA_MAN'); - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - #select * from employees where last_name like '' -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - select employee_id 员工号 from employees where department_id in - (select department_id from departments where location_id = 1700); - -#6.查询管理者是 金 的员工姓名和工资 - select last_name 姓名,salary 工资 from employees where manager_id in - (select employee_id from employees where last_name = '金'); - -#7.查询工资最低的员工信息: last_name, salary - select last_name,salary from employees where salary = - (select min(salary) from employees); - - - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - # 连表查 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - # 子查询 - select d.*,a.平均工资 from departments d right join - (select department_id,avg(salary) 平均工资 from employees group by department_id having avg(salary) = - (select avg(salary) 平均工资 from employees group by department_id order by 平均工资 limit 0,1)) a - on d.department_id = a.department_id; - - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 - select j.*,avg(e.salary) 平均工资 - from jobs j right join employees e on j.job_id = e.job_id group by j.job_id order by 平均工资 desc limit 0,1; - -#11.查询平均工资高于公司平均工资的部门有哪些? - select d.department_name 部门名,avg(e.salary) 平均工资 - from departments d right join employees e on d.department_id = e.department_id - group by d.department_id having 平均工资 > (select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - select * from employees where employee_id in - (select distinct(a.employee_id) from - (select e2.* from employees e1 left join employees e2 on e1.manager_id = e2.employee_id) a); - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - select * from employees where employee_id in - (select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - select min(e.salary) 最低工资 from employees e right join - (select department_id,max(salary) 最高工资 from employees group by department_id order by 最高工资 limit 0,1) a - on e.department_id = a.department_id ; - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - select last_name, department_id, email, salary from employees where employee_id = - (select employee_id from employees e right join - (select department_id,avg(salary) 平均工资 from employees group by department_id order by 平均工资 desc limit 0,1) a - on e.department_id = a.department_id limit 0,1); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - select job_id from jobs where job_id != 'ST_CLERK'; - -#16. 选择所有没有管理者的员工的last_name - select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - select * from employees where last_name = 'De Haan' - -#方式2: - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - select e.employee_id 员工号,e.last_name 姓名,e.salary 工资,a.平均工资 from employees e left join - (select department_id,avg(salary) 平均工资 from employees group by department_id) a - on e.department_id = a.department_id and e.salary > a.平均工资; - -#方式2:在FROM中声明子查询 - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - select department_name from departments where department_id in - (select distinct department_id from employees where employee_id in - (select manager_id from employees group by manager_id having count(manager_id)>5)); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - select country_id from locations where location_id in - (select location_id from departments group by location_id having count(location_id) > 2); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - - - - -~~~ - - \ No newline at end of file diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230920 RBAC\347\254\224\350\256\260.md" "b/20 \347\237\263\350\211\257\346\266\233/20230920 RBAC\347\254\224\350\256\260.md" deleted file mode 100644 index 3efb310cfbf0d77ef404267d433dead2351b2b56..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230920 RBAC\347\254\224\350\256\260.md" +++ /dev/null @@ -1,174 +0,0 @@ -### RBAC (Role-Based Access Control) - -RBAC : 基于角色访问控制权限,是一种数据库设计思想,一个控制模型 - -==RBAC是主流设计模式== - -#### 数据库能存什么 - -1. 业务数据表:用户、商品 -2. 功能资源表:菜单信息表、页面代码 - -#### 权限使用背景 - -菜单权限: 不同用户登录系统后,展示菜单不同 - -按钮权限:不同用户查看同一个对象时,展示按钮不一样 - -数据权限:可见数据不同 - -操作权限:看得到点不着 例如:腾讯视频VIP你可以看到视频但是不可以播放 - -#### RBAC由三个部分组成 - -1. 用户 -2. 角色:是RBAC是的核心 -3. 权限 - -- User(用户):每个用户都有唯一的UID识别,并被授予不同的角色 -- Role(角色):不同角色具有不同的权限 -- Permission(权限):访问权限 -- 用户-角色映射:用户和角色之间的映射关系 -- 角色-权限映射:角色和权限之间的映射 - -权限关联实现授权,给用户分配应当有的对应权限 - -##### RBAC 的优点: - -简化了用户和权限的关系 - -易扩展,易维护 - -##### 缺点: - -RBAC模型没有提供操作顺序的控制机制,这一缺陷得RBAC模型很难适应那些对操作次序有严格要求的系统 - -###### 练习 - -~~~ mysql -create database text03 charset utf8; -use text03; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:27:53 */ -/*==============================================================*/ - - -drop table if exists menu; - -drop table if exists role; - -drop table if exists role_menu; - -drop table if exists `user`; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: menu */ -/*==============================================================*/ -create table menu -( - menu_id int not null auto_increment, - menu_name varchar(10) not null, - menu_address varchar(150) not null, - primary key (menu_id) -); -insert into menu values -(null,'首页','http://www.md.com/'), -(null,'查询学生信息','http://www.md.com/student'), -(null,'查询教师信息','http://www.md.com/teacher'), -(null,'查询教师工资','http://www.md.com/salary'); -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name varchar(10) not null, - primary key (role_id) -); -insert into role values -(null,'校长'), -(null,'老师'), -(null,'学生'); - -/*==============================================================*/ -/* Table: role_menu */ -/*==============================================================*/ -create table role_menu -( - menu_id int not null, - role_id int not null, - primary key (menu_id, role_id) -); -insert into role_menu values -(1,1), -(2,1), -(3,1), -(4,1), -(1,2), -(2,2), -(3,2), -(1,3), -(2,3); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table `user` -( - user_id int not null auto_increment, - user_name varchar(10) not null, - user_paw varchar(10) not null, - primary key (user_id) -); -insert into `user` values -(null,'张三','88888888'), -(null,'丘丘','66666666'), -(null,'小明','12345678'), -(null,'小红','12345678'); - -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - role_id int not null, - user_id int not null, - primary key (role_id, user_id) -); -insert into user_role values -(1,1), -(2,2), -(3,3), -(3,4); - -alter table role_menu add constraint FK_role_menu foreign key (menu_id) - references menu (menu_id) on delete restrict on update restrict; - -alter table role_menu add constraint FK_role_menu2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - - -delimiter $$ -create procedure proc01(in in_name varchar(5),in in_psw varchar(10)) -begin - select user_name,role_name,menu_name,menu_address - from `user` u,user_role ur,role r,role_menu rm,menu m where u.user_id = ur.user_id and ur.role_id = r.role_id and r.role_id = rm.role_id and rm.menu_id = m.menu_id and u.user_name = in_name and u.user_paw = in_psw; -end $$ -delimiter ; - -call proc01('张三','88888888'); -call proc01('丘丘','66666666'); -call proc01('小明','12345678'); -call proc01('小红','12345678'); -~~~ - diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230921 SKU\347\254\224\350\256\260.md" "b/20 \347\237\263\350\211\257\346\266\233/20230921 SKU\347\254\224\350\256\260.md" deleted file mode 100644 index 41a1401c256b472cfafed1e5d1aa4beacaaf69fb..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230921 SKU\347\254\224\350\256\260.md" +++ /dev/null @@ -1,191 +0,0 @@ -### 什么是SKU - -SKU: 英文全称为Stock Keeping Unit,简称SKU,是产品入库后一种编码归类方法,也是库存控制的最小单位。库存进出计量的单位, 可以是以件、盒、托盘等为单位。在服装、鞋类商品中使用最多最普遍。 例如纺织品中一个SKU通常表示:规格、颜色、款式。 - -### 什么是SPU - -SPU: 是商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个产品的特性。通俗点讲,属性值、特性相同的商品就可以称为一个SPU。 - -#### 总结:SPU是标准化产品单元,区分品种;SKU是库存量单位,区分单品;商品特指与商家有关的商品,可对应多个SKU。 - -### ER图 - -![](https://s2.loli.net/2023/09/21/lJTPQFUuSvmELYa.png) - -### 代码 - -~~~ mysql -create database text01 charset utf8; -use text01; - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 17:07:58 */ -/*==============================================================*/ - - -drop table if exists goods; - -drop table if exists goods_attribute; - -drop table if exists goods_attribute_value; - -drop table if exists goods_middle; - -drop table if exists specification; - -/*==============================================================*/ -/* Table: 商品表 */ -/*==============================================================*/ -create table goods -( - goods_id int not null auto_increment, - goods_name varchar(50) not null, - primary key (goods_id) -); -insert into goods values -(null,'华为 Mate60 Pro'); - -/*==============================================================*/ -/* Table: 商品属性表 */ -/*==============================================================*/ -create table goods_attribute -( - ga_id int not null auto_increment, - ga_name varchar(10) not null, - primary key (ga_id) -); -insert into goods_attribute values -(null,'颜色'), -(null,'版本'); - -/*==============================================================*/ -/* Table: 商品属性值表 */ -/*==============================================================*/ -create table goods_attribute_value -( - gav_id int not null auto_increment, - gav_name varchar(10) not null, - primary key (gav_id) -); -insert into goods_attribute_value values -(null,'黑色'), -(null,'白色'), -(null,'绿色'), -(null,'256G'), -(null,'512G'), -(null,'1T'); - - -/*==============================================================*/ -/* Table: 商品中间表 */ -/*==============================================================*/ -create table goods_middle -( - gm_id int not null auto_increment, - sf_id int, - ga_id int, - gav_id int, - primary key (gm_id) -); -insert into goods_middle values -(null,1,1,1), -(null,1,2,4), -(null,2,1,2), -(null,2,2,4), -(null,3,1,3), -(null,3,2,4), -(null,4,1,1), -(null,4,2,5), -(null,5,1,2), -(null,5,2,5), -(null,6,1,1), -(null,6,2,6), -(null,7,1,2), -(null,7,2,6), -(null,8,1,3), -(null,8,2,6); - -/*==============================================================*/ -/* Table: 规格表 */ -/*==============================================================*/ -create table specification -( - sf_id int not null auto_increment, - goods_id int, - sf_name varchar(50) not null, - sf_price decimal(6,2) not null, - sf_stock int not null, - primary key (sf_id) -); -insert into specification values -(null,1,'华为 Mate 60 Pro 256G+黑色',6999,0), -(null,1,'华为 Mate 60 Pro 256G+白色',6999,5), -(null,1,'华为 Mate 60 Pro 256G+绿色',6999,5), -(null,1,'华为 Mate 60 Pro 512G+黑色',7999,10), -(null,1,'华为 Mate 60 Pro 512G+白色',7999,20), -(null,1,'华为 Mate 60 Pro 1T+黑色',8999,30), -(null,1,'华为 Mate 60 Pro 1T+白色',8999,30), -(null,1,'华为 Mate 60 Pro 1T+绿色',8999,30); - - -alter table goods_middle add constraint FK_Relationship_2 foreign key (sf_id) - references specification (sf_id) on delete restrict on update restrict; - -alter table goods_middle add constraint FK_Relationship_3 foreign key (ga_id) - references goods_attribute (ga_id) on delete restrict on update restrict; - -alter table goods_middle add constraint FK_Relationship_4 foreign key (gav_id) - references goods_attribute_value (gav_id) on delete restrict on update restrict; - -alter table specification add constraint FK_Relationship_1 foreign key (goods_id) - references goods (goods_id) on delete restrict on update restrict; - - -# 视图(查询所有) -create or replace view select_all -as -SELECT - s.sf_id, - s.sf_name, - gav.gav_name, - s.sf_price -FROM - goods g, - specification s, - goods_middle gm, - goods_attribute ga, - goods_attribute_value gav -WHERE - g.goods_id = s.goods_id - AND s.sf_id = gm.sf_id - AND gm.ga_id = ga.ga_id - AND gm.gav_id = gav.gav_id - order by s.sf_id ; - - # 查询视图 - select * from select_all; - - -# 存储过程(查询指定的类型) -delimiter $$ -create procedure proc01(in in_color varchar(5),in in_ram varchar(10)) -begin - select * from specification where sf_id = - (select a.sf_id from - (select sf_id,gav_name from goods_middle gm,goods_attribute_value gav where gm.gav_id = gav.gav_id and gav_name = in_color) as a - , - (select sf_id,gav_name from goods_middle gm,goods_attribute_value gav where gm.gav_id = gav.gav_id and gav_name = in_ram) as b - where a.sf_id = b.sf_id); -end $$ -delimiter ; - -# 调用存储过程 -call proc01('白色','256G'); -call proc01('绿色','1T'); -call proc01('黑色','512G'); - - -~~~ - diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230924 \345\255\230\345\202\250\350\277\207\347\250\213\347\232\204\344\274\240\345\217\202.md" "b/20 \347\237\263\350\211\257\346\266\233/20230924 \345\255\230\345\202\250\350\277\207\347\250\213\347\232\204\344\274\240\345\217\202.md" deleted file mode 100644 index 2342f2389f2767250a21c8e5c65e06ba9cc30317..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230924 \345\255\230\345\202\250\350\277\207\347\250\213\347\232\204\344\274\240\345\217\202.md" +++ /dev/null @@ -1,106 +0,0 @@ -#### 存储过程的传参 - -#### in :表示传入的参数 - -只有一个参数 - -~~~ mysql -delimiter $$ -create procedure proc04(in name varchar(5)) # in 表示传入参数 -begin - select * from student where student.name = name; # 将传递的参数赋值并利用 -end $$ -delimiter ; - -call proc04("张三"); # 传递参数,执行语句,得到张三的所有信息 -call proc04("李四"); # 传递参数,执行语句,得到李四的所有信息 -~~~ - -有多个参数 - -~~~ mysql -# 需求:查询指定部门,大于多少薪资的员工信息 (两个参数但是可变的) -delimiter $$ -create procedure proc05(in param_dname varchar(10),in param_sal decimal(7,2)) -begin - select * from dept d,emp e where d.dname = param_dname and e.sal > param_sal; -end $$ -delimiter ; - -call proc05("学工部",20000); # 调用分装好的语句,查询学工部薪资大于20000的员工信息 -call proc05("销售部",10000); -~~~ - -#### out :表示从存储过程内部传值给调用者 - -一个out参数 - -~~~ mysql -# 需求:传入员工编号,返回员工姓名 -delimiter $$ -create procedure proc06(in in_empno int, out out_ename varchar(5)) -begin - select ename into out_ename from emp where empno = in_empno; #into 表示将查询的结果赋值给out_ename -end $$ -delimiter ; - -call proc06(1001,@o_ename); # 传入员工编号,定义一个变量接收返回的结果 -select @o_ename; # 查询变量值 -~~~ - -多个out参数 - -~~~ mysql -# 需求:传入员工编号,返回员工姓名、薪资 -delimiter $$ -create procedure proc07(in in_empno int, out out_ename varchar(5), out out_sal decimal(7,2)) -begin - select ename,sal into out_ename,out_sal from emp where empno = in_empno; # 赋值字段一一对应,字段之间逗号隔开 -end $$ -delimiter ; - -call proc07(1001,@o_ename,@o_sal); # 定义变量接收返回结果 -select @o_ename; -select @o_sal; -~~~ - -#### inout:表示从外部传入的参数进过修改后可以返回的变量,既可以使用传入变量的值,也可以修改传入变量的值 - -案例一 - -~~~ mysql -# 需求:传入一个数字,传出这个数字的10倍值 -delimiter $$ -create procedure proc08(inout num int) -begin - set num = num * 10; -end $$ -delimiter ; - -set @inout_num = 2; # 设一个变量用来接收变化的值,并给初始值 -call proc08(@inout_num); # 调用存储过程,并将值传入 -select @inout_num; # 得到改变的值 20 -~~~ - -案例二 - -~~~ mysql -# 需求:传入员工名,拼接部门号,传入薪资,求出年薪 -# 拼接要求: 30_张三 -delimiter $$ -create procedure proc08(inout inout_ename varchar(5),inout inout_sal int) -begin - # concat_ws 是一个拼接的函数,可以指定拼接格式 - select concat_ws('_',deptno,ename) into inout_ename from emp where emp.ename = inout_ename; - set inout_sal = inout_sal * 12; -end $$ -delimiter ; -# 定义变量,并赋初始值 -set @inout_ename = "张三"; -set @inout_sal = 3000; -# 调用存储过程,得到结果 -call proc08(@inout_ename,@inout_sal); -# 打印结果 -select @inout_ename; -select @inout_sal; -~~~ diff --git "a/20 \347\237\263\350\211\257\346\266\233/20230926 Check\347\272\246\346\235\237\344\270\216\350\247\206\345\233\276.md" "b/20 \347\237\263\350\211\257\346\266\233/20230926 Check\347\272\246\346\235\237\344\270\216\350\247\206\345\233\276.md" deleted file mode 100644 index f472bcbec162753513ae60e05e3b0fcc4b411236..0000000000000000000000000000000000000000 --- "a/20 \347\237\263\350\211\257\346\266\233/20230926 Check\347\272\246\346\235\237\344\270\216\350\247\206\345\233\276.md" +++ /dev/null @@ -1,349 +0,0 @@ -## Check 约束 - -作用:检查某个字段的值是否符合XX要求,一般指的是值的范围 - -例: - -~~~ mysql -create table student( - gender char(1), - age int, - check(gender in('男','女')), - check(age > 0) -); -~~~ - -## 视图 - -#### 视图介绍: - -​ 视图(view)是一个虚拟表,为其命名后,用户使用时只需查此虚拟表即可获取结果集,并可以将其当作表来使用。此虚拟表的数据,来源于原表当中。 - -#### 视图的作用: - -​ 简化代码,可以把重复使用的查询封装成视图重复使用,同时可以使复杂的查询易于理解和使用。 - -​ 安全原因,如果一张表中有很多数据不希望让人看到,此时可以使用视图。 - -#### 创建视图语句 - -语法一: - -~~~ mysql -create view 视图名 as 查询语句 -~~~ - -语法二: - -~~~ mysql -create view 视图名(字段别名) as 查询语句 # 字段别名的个数要与查询语句一样 -~~~ - -#### 修改视图语句 - -语法一: - -~~~ mysql -create or replace view 视图名 as 查询语句 # 有就修改,没就创建 -~~~ - -语法二: - -~~~ mysql -alter view 视图名 as 新的查询语句 # 前提是被修改的视图要存在 -~~~ - - #### 更新视图: - -​ 因为视图表是根据原表数据来的,所有对视图表进行增、删、改操作,也就相当于对原表进行操作。即,有一定的操作是会执行失败的。 - -​ ==所有,一般情况下,最好将视图作为查询数据的虚拟表,而不是通过视图更新数据。== - -#### 重命名视图 - -~~~ mysql -rename table 视图名 to 新视图名; -~~~ - -#### 删除视图 - -~~~ MySQL -drop view if exists 视图名; -~~~ - -## 视图练习 - -~~~ mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - - - - -#第14章_视图的课后练习 - - -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -create view employee_vu as -select LAST_NAME 姓名,EMPLOYEE_ID 员工号,DEPARTMENT_ID 部门号 from employees; - -#2. 显示视图的结构 -desc employee_vu; - -#3. 查询视图中的全部内容 -select * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -create or replace view employee_vu as -select - LAST_NAME 姓名, - EMPLOYEE_ID 员工号, - DEPARTMENT_ID 部门号 -from employees -where DEPARTMENT_ID = 80; - -#练习2: - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -create view emp_v1 as -select - concat(last_name,' ',first_name) 员工姓名, - salary 工资, - email 邮箱 -from employees -where phone_number like '011%'; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -create or replace view emp_v1 as -select - concat(last_name,' ',first_name) 员工姓名, - salary 工资, - email 邮箱 -from employees -where phone_number like '011%' and email like '%e%' ; - -select * from emp_v1 -#3. 向 emp_v1 插入一条记录,是否可以? -# 不可以,因为emp_v1是一个视图,它是一个只读的虚拟表格,只是将查询语句的结果封装成一个新的表格而已。因此,无法通过直接向MySQL视图中插入数据 - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -update emp_v1 set 工资 = 工资 + 1000; - -#5. 删除emp_v1中姓名为Olsen的员工 -delete from emp_v1 where 员工姓名 like 'olsen%' - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create view emp_v2 as -select - department_id 部门id, - max(salary) 最高工资 -from employees -where salary > 12000 group by department_id; -#查询方二:select department_id 部门id,max(salary) 最高工资 from employees group by department_id having 最高工资 > 12000 ; -select * from emp_v2; - -#7. 向 emp_v2 中插入一条记录,是否可以? -# 不可以,因为emp_v2是一个视图,它是一个只读的虚拟表格,只是将查询语句的结果封装成一个新的表格而已。因此,无法通过直接向MySQL视图中插入数据 - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v2; -drop view emp_v1; - - -~~~ - diff --git "a/21 \345\215\242\344\272\250\350\200\200/MySQL\347\252\227\345\217\243\345\207\275\346\225\260\347\232\204\344\275\277\347\224\250\345\222\214\350\257\264\346\230\216.md" "b/21 \345\215\242\344\272\250\350\200\200/MySQL\347\252\227\345\217\243\345\207\275\346\225\260\347\232\204\344\275\277\347\224\250\345\222\214\350\257\264\346\230\216.md" deleted file mode 100644 index 49c24b07b5c27b211a53ecde2c44f08e4895a439..0000000000000000000000000000000000000000 --- "a/21 \345\215\242\344\272\250\350\200\200/MySQL\347\252\227\345\217\243\345\207\275\346\225\260\347\232\204\344\275\277\347\224\250\345\222\214\350\257\264\346\230\216.md" +++ /dev/null @@ -1,153 +0,0 @@ -## MySQL窗口函数的使用和说明 - -MySQL引入了窗口函数(Window Functions),它们允许在结果集的窗口或子集上执行聚合、排序和分析操作,而不需要将查询结果分成多个子查询或使用复杂的连接。窗口函数在处理复杂的分析查询时非常有用,可以在同一查询中计算行内和行间的聚合值。 - ---------- - - - -1. 基本语法: - 窗口函数的基本语法如下: - ```sql - <窗口函数>(<表达式>) OVER ( - [PARTITION BY <列1>, <列2>, ...] - [ORDER BY <排序列1> [ASC|DESC], <排序列2> [ASC|DESC], ...] - [ROWS {PRECEDING|FOLLOWING}] - ) AS <别名> - ``` - - `<窗口函数>`:要使用的窗口函数,如SUM、AVG、RANK、DENSE_RANK等。 - - `<表达式>`:应用窗口函数的列或表达式。 - - `PARTITION BY`:可选项,定义窗口的分区,将结果集分成不同的分组以进行窗口函数的计算。 - - `ORDER BY`:可选项,定义窗口内行的排序方式。 - - `ROWS`:可选项,指定窗口中的行数范围。 - - ``:行数范围的大小,可以是具体的行数或特定的关键词(例如,UNBOUNDED PRECEDING表示从分区的开头到当前行,FOLLOWING表示从当前行到分区的结尾)。 - -2. 示例: - 让我们看一个示例,假设有一个名为`sales`的表,包含销售订单的信息。我们想要计算每个销售员的销售总额,并按照销售总额降序排列,同时显示销售员的排名。 - - ```sql - SELECT - salesperson_id, - total_sales, - RANK() OVER (ORDER BY total_sales DESC) AS rank - FROM ( - SELECT - salesperson_id, - SUM(sale_amount) AS total_sales - FROM sales - GROUP BY salesperson_id - ) AS subquery; - ``` - - 在这个示例中,`RANK()` 是一个窗口函数,它计算每个销售员的销售总额,并根据销售总额进行排序,然后为每个销售员分配一个排名(rank)。 - -窗口函数是SQL中非常强大的工具,可以用于解决各种分析问题,包括排名、累积、移动平均等。你可以根据具体的需求来选择合适的窗口函数和窗口规范(PARTITION BY、ORDER BY、ROWS)来构建查询。确保在使用窗口函数时查阅MySQL版本的文档,因为窗口函数的支持在不同的MySQL版本中可能会有所不同。 - - - ---------- - -当涉及到MySQL中的窗口函数时,还有一些额外的注意事项和常见的窗口函数,如下所示: - -1. 常见的窗口函数: - - `ROW_NUMBER()`:为每一行分配一个唯一的整数值,通常用于生成行号。 - - `RANK()`:为每一行分配一个排名,如果有相同的值,则会跳过相同的排名。 - - `DENSE_RANK()`:为每一行分配一个排名,如果有相同的值,则不会跳过相同的排名。 - - `NTILE(n)`:将结果集分成n个大致相等的部分,并为每个部分的行分配一个标识号。 - - `LEAD()`和`LAG()`:分别用于访问当前行之后和之前的行,通常用于计算行与前/后行之间的差异。 - -2. 窗口函数和聚合函数的区别: - 窗口函数和聚合函数(如SUM、AVG、COUNT等)都可以用于数据分析,但有一个重要的区别。聚合函数将整个结果集作为输入,并生成一个单一的值,而窗口函数将结果集分成多个窗口(窗口可以重叠)并对每个窗口内的行执行计算。 - -3. 窗口函数的性能注意事项: - - 窗口函数可能需要更多的计算资源,因此在处理大型数据集时要谨慎使用。 - - 使用合适的索引和分区策略可以提高窗口函数的性能。 - - 在需要窗口函数的情况下,尽量在数据库层面执行计算,而不是在应用程序中进行后处理。 - -4. 窗口函数的应用场景: - - 排名和百分位数计算。 - - 移动平均和累积求和。 - - 前N或后N行的分析。 - - 数据分布分析。 - -窗口函数是SQL中强大且灵活的功能,可以大大简化复杂查询的编写,同时提供了丰富的数据分析和报告功能。不同的窗口函数可以用于不同的分析任务,根据具体需求选择适当的函数和窗口规范来构建查询。 - ----- - -当使用MySQL的窗口函数时,示例通常是最有帮助的。以下是一些示例,演示了如何使用一些常见的窗口函数: - -1. **RANK() 和 DENSE_RANK() 示例**: - 假设您有一个名为`scores`的表,记录了学生的成绩,以及他们所属的班级。您想要为每个班级的学生排名,并显示排名: - - ```sql - SELECT - student_name, - score, - class_name, - RANK() OVER (PARTITION BY class_name ORDER BY score DESC) AS rank, - DENSE_RANK() OVER (PARTITION BY class_name ORDER BY score DESC) AS dense_rank - FROM scores; - ``` - - 在此示例中,`RANK()` 和 `DENSE_RANK()` 窗口函数分别计算每个班级中学生的排名,根据成绩降序排列。`PARTITION BY` 子句将结果集分成不同的班级。 - -2. **NTILE() 示例**: - 假设您有一个名为`sales`的表,记录了销售员的销售额,您希望将销售员分成三个销售额范围,并为每个销售员分配一个范围标识号: - - ```sql - SELECT - salesperson_name, - sales_amount, - NTILE(3) OVER (ORDER BY sales_amount) AS ntile - FROM sales; - ``` - - 在此示例中,`NTILE(3)` 将销售员分成三个大致相等的部分,并为每个部分的销售员分配一个标识号。 - -3. **PERCENT_RANK() 和 CUME_DIST() 示例**: - 假设您有一个名为`scores`的表,记录了学生的成绩,您想要计算每个学生的百分位排名和累积分布值: - - ```sql - SELECT - student_name, - score, - PERCENT_RANK() OVER (ORDER BY score) AS percent_rank, - CUME_DIST() OVER (ORDER BY score) AS cume_dist - FROM scores; - ``` - - 在此示例中,`PERCENT_RANK()` 计算每个学生的百分位排名,`CUME_DIST()` 计算每个学生的累积分布值,都根据成绩排序。 - -这些示例展示了如何使用不同的窗口函数来执行各种分析操作,包括排名、分位数计算和累积分布。您可以根据您的具体需求和数据结构来选择和自定义窗口函数。 - --------- - -除了前面提到的常见窗口函数,MySQL还支持其他一些窗口函数,这些函数可以用于不同类型的数据分析和报告。以下是一些其他常见的窗口函数: - -1. **FIRST_VALUE() 和 LAST_VALUE()**: - - `FIRST_VALUE(column)`:返回窗口内第一行的指定列的值。 - - `LAST_VALUE(column)`:返回窗口内最后一行的指定列的值。 - 这些函数通常用于查找窗口内的首行或末行,并获取其特定列的值。 - -2. **CUME_DIST()**: - - `CUME_DIST()`:返回当前行的累积分布值,即在排序后的结果集中,当前行前面的行所占的比例。 - 该函数用于计算当前行在整个排序结果中的相对位置。 - -3. **PERCENT_RANK()**: - - `PERCENT_RANK()`:返回当前行的百分位排名值,表示在排序后的结果集中,当前行前面的行所占的比例(0到1之间的值)。 - 这通常与百分位数计算一起使用。 - -4. **NTH_VALUE()**: - - `NTH_VALUE(column, n)`:返回窗口内指定列的第n个值,其中n是一个整数。 - 该函数允许您查找窗口内的第n个值。 - -5. **LISTAGG()**: - - `LISTAGG(column, delimiter)`:将窗口内的值连接为一个字符串,使用指定的分隔符。 - 这对于将多个值合并成一个逗号分隔的列表非常有用。 - -6. **STDDEV_POP() 和 STDDEV_SAMP()**: - - `STDDEV_POP(column)`:计算窗口内指定列的总体标准差。 - - `STDDEV_SAMP(column)`:计算窗口内指定列的样本标准差。 - 这些函数用于计算数据集的标准差,可用于了解数据的分散程度。 - -这些窗口函数可以根据具体的分析需求来选择。它们扩展了SQL的分析和聚合能力,使得能够更轻松地执行复杂的数据分析操作,从而生成有价值的报告和洞察。根据您的具体需求,可以使用这些函数来构建查询以获取所需的分析结果。 \ No newline at end of file diff --git "a/21 \345\215\242\344\272\250\350\200\200/MySQL\351\253\230\347\272\247\345\207\275\346\225\260\347\232\204\350\256\244\350\257\206\345\222\214\344\275\277\347\224\250.md" "b/21 \345\215\242\344\272\250\350\200\200/MySQL\351\253\230\347\272\247\345\207\275\346\225\260\347\232\204\350\256\244\350\257\206\345\222\214\344\275\277\347\224\250.md" deleted file mode 100644 index 421691e550086077fb8b740836c59d918f779876..0000000000000000000000000000000000000000 --- "a/21 \345\215\242\344\272\250\350\200\200/MySQL\351\253\230\347\272\247\345\207\275\346\225\260\347\232\204\350\256\244\350\257\206\345\222\214\344\275\277\347\224\250.md" +++ /dev/null @@ -1,606 +0,0 @@ -## mysql的字符串函数的使用和说明 - -MySQL提供了许多字符串函数,用于处理字符串数据。以下是其中一些常用的字符串函数的使用和说明: - -1. CONCAT(str1, str2, ...):将多个字符串连接成一个字符串。 - -示例: - -```sql -SELECT CONCAT('Hello', ' ', 'World') AS result; --- 输出:Hello World -``` - -1. CONCAT_WS(separator, str1, str2, ...):使用指定的分隔符将多个字符串连接成一个字符串。 - -示例: - -```sql -SELECT CONCAT_WS('-', 'apple', 'banana', 'orange') AS result; --- 输出:apple-banana-orange -``` - -1. INSERT(str, pos, len, newstr):在指定位置插入新的子串。 - -示例: - -```sql -SELECT INSERT('Hello World', 7, 0, 'Beautiful ') AS result; --- 输出:Hello Beautiful World -``` - -1. SUBSTRING(str, pos, len):返回从指定位置开始的子串。 - -示例: - -```sql -SELECT SUBSTRING('Hello World', 7, 5) AS result; --- 输出:World -``` - -1. REPLACE(str, find_string, replace_with):用新的字符串替换字符串中的子串。 - -示例: - -```sql -SELECT REPLACE('Hello World', 'World', 'Universe') AS result; --- 输出:Hello Universe -``` - -1. LOWER(str) 和 UPPER(str):将字符串转换为小写或大写。 - -示例: - -```sql -SELECT LOWER('Hello World') AS result; --- 输出:hello world - -SELECT UPPER('Hello World') AS result; --- 输出:HELLO WORLD -``` - -1. TRIM(str):删除字符串开头和结尾的空格。 - -示例: - -```sql -SELECT TRIM(' Hello World ') AS result; --- 输出:Hello World -``` - -1. LENGTH(str):返回字符串的长度。 - -示例: - -```sql -SELECT LENGTH('Hello World') AS result; --- 输出:11 -``` - -1. LEFT(str, len) 和 RIGHT(str, len):返回字符串的左边或右边的子串。 - -示例: - -```sql -SELECT LEFT('Hello World', 5) AS result; --- 输出:Hello - -SELECT RIGHT('Hello World', 5) AS result; --- 输出:World -``` - -MySQL还提供了其他一些字符串函数,包括: - -1. REPLACE(str, find_string, replace_with):用新的字符串替换字符串中的子串。 - 示例: - SELECT REPLACE('Hello World', 'World', 'Universe') AS result; - -- 输出:Hello Universe -2. UPPER(str):将字符串转换为大写。 - 示例: - SELECT UPPER('Hello World') AS result; - -- 输出:HELLO WORLD -3. LOWER(str):将字符串转换为小写。 - 示例: - SELECT LOWER('Hello World') AS result; - -- 输出:hello world -4. LENGTH(str):返回字符串的长度。 - 示例: - SELECT LENGTH('Hello World') AS result; - -- 输出:11 - 可以从字符串str的第n个字符开始,截取m个字符。不区分大小写 - 示例: - SELECT SUBSTRING_INDEX('A-B-C-D-E', '-', 2) AS result; - -- 输出:A-B -5. CONCAT(str1, str2, ...):将多个字符串连接成一个字符串。 - 示例: - SELECT CONCAT('Hello', ' ', 'World') AS result; - -- 输出:Hello World -6. INSERT(str, pos, len, newstr):在指定位置插入新的子串。 - 示例: - SELECT INSERT('Hello World', 7, 0, 'Beautiful ') AS result; - -- 输出:Hello Beautiful World - -## mysql日期函数使用和说明 - -MySQL提供了许多日期函数,用于处理和操作日期和时间值。下面是一些常用的日期函数及其说明: - -1. NOW(): 返回当前日期和时间。 - 示例:SELECT NOW(); -2. CURDATE(): 返回当前日期。 - 示例:SELECT CURDATE(); -3. CURTIME(): 返回当前时间。 - 示例:SELECT CURTIME(); -4. UNIX_TIMESTAMP(): 返回当前的Unix时间戳。 - 示例:SELECT UNIX_TIMESTAMP(); -5. FROM_UNIXTIME(): 将Unix时间戳转换为日期和时间。 - 示例:SELECT FROM_UNIXTIME(1615897200); -6. DATE_FORMAT(): 按照指定格式格式化日期和时间。 - 示例:SELECT DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%s'); -7. STR_TO_DATE(): 将字符串转换为日期和时间,按照指定的格式。 - 示例:SELECT STR_TO_DATE('2021-03-15 10:30:00', '%Y-%m-%d %H:%i:%s'); -8. ADDDATE() 或 DATE_ADD(): 给指定的日期添加天数或间隔。 - 示例:SELECT ADDDATE(CURDATE(), INTERVAL 7 DAY); -9. SUBDATE() 或 DATE_SUB(): 从指定的日期减去天数或间隔。 - 示例:SELECT SUBDATE(CURDATE(), INTERVAL 7 DAY); -10. DATEDIFF(): 返回两个日期之间的天数差。 - 示例:SELECT DATEDIFF(CURDATE(), '2021-03-15'); -11. DAY(): 返回给定日期的日。 - 示例:SELECT DAY(CURDATE()); -12. MONTH(): 返回给定日期的月。 - 示例:SELECT MONTH(CURDATE()); -13. YEAR(): 返回给定日期的年。 - 示例:SELECT YEAR(CURDATE()); -14. WEEK(): 返回给定日期所在的周次。 - 示例:SELECT WEEK(CURDATE()); -15. WEEKDAY(): 返回给定日期是星期几,从0(星期一)到6(星期日)。 - 示例:SELECT WEEKDAY(CURDATE()); - ---------------------------- - - - -1. 计算两个日期之间的天数差: - -```sql -sql -SELECT DATEDIFF('2023-07-15', '2023-07-10'); -``` - -输出结果为5,表示两个日期之间相差5天。 - -1. 给定日期加上指定天数: - -```sql -sql -SELECT ADDDATE('2023-07-10', INTERVAL 7 DAY); -``` - -输出结果为'2023-07-17',表示给定日期加上7天后的结果。 - -1. 给定日期减去指定天数: - -```sql -sql -SELECT SUBDATE('2023-07-10', INTERVAL 3 DAY); -``` - -输出结果为'2023-07-07',表示给定日期减去3天后的结果。 - -1. 获取当前日期并格式化为特定格式: - -```sql -sql -SELECT DATE_FORMAT(CURDATE(), '%Y-%m-%d'); -``` - -输出结果为'2023-07-10',表示将当前日期格式化为'年-月-日'的形式。 - -1. 将字符串转换为日期格式: - -```sql -sql -SELECT STR_TO_DATE('2023-07-10', '%Y-%m-%d'); -``` - -输出结果为'2023-07-10',表示将字符串'2023-07-10'转换为日期格式。 - -1. 计算给定日期是该年的第几周: - -```sql -sql -SELECT WEEK('2023-07-10'); -``` - -输出结果为28,表示给定日期是该年的第28周。 - ----------------- - -## MySQL窗口函数的使用和说明 - -MySQL引入了窗口函数(Window Functions),它们允许在结果集的窗口或子集上执行聚合、排序和分析操作,而不需要将查询结果分成多个子查询或使用复杂的连接。窗口函数在处理复杂的分析查询时非常有用,可以在同一查询中计算行内和行间的聚合值。 - ---------- - - - -1. 基本语法: - 窗口函数的基本语法如下: - - ```sql - <窗口函数>(<表达式>) OVER ( - [PARTITION BY <列1>, <列2>, ...] - [ORDER BY <排序列1> [ASC|DESC], <排序列2> [ASC|DESC], ...] - [ROWS {PRECEDING|FOLLOWING}] - ) AS <别名> - ``` - - - `<窗口函数>`:要使用的窗口函数,如SUM、AVG、RANK、DENSE_RANK等。 - - `<表达式>`:应用窗口函数的列或表达式。 - - `PARTITION BY`:可选项,定义窗口的分区,将结果集分成不同的分组以进行窗口函数的计算。 - - `ORDER BY`:可选项,定义窗口内行的排序方式。 - - `ROWS`:可选项,指定窗口中的行数范围。 - - ``:行数范围的大小,可以是具体的行数或特定的关键词(例如,UNBOUNDED PRECEDING表示从分区的开头到当前行,FOLLOWING表示从当前行到分区的结尾)。 - -2. 示例: - 让我们看一个示例,假设有一个名为`sales`的表,包含销售订单的信息。我们想要计算每个销售员的销售总额,并按照销售总额降序排列,同时显示销售员的排名。 - - ```sql - SELECT - salesperson_id, - total_sales, - RANK() OVER (ORDER BY total_sales DESC) AS rank - FROM ( - SELECT - salesperson_id, - SUM(sale_amount) AS total_sales - FROM sales - GROUP BY salesperson_id - ) AS subquery; - ``` - - 在这个示例中,`RANK()` 是一个窗口函数,它计算每个销售员的销售总额,并根据销售总额进行排序,然后为每个销售员分配一个排名(rank)。 - -窗口函数是SQL中非常强大的工具,可以用于解决各种分析问题,包括排名、累积、移动平均等。你可以根据具体的需求来选择合适的窗口函数和窗口规范(PARTITION BY、ORDER BY、ROWS)来构建查询。确保在使用窗口函数时查阅MySQL版本的文档,因为窗口函数的支持在不同的MySQL版本中可能会有所不同。 - - - ---------- - -当涉及到MySQL中的窗口函数时,还有一些额外的注意事项和常见的窗口函数,如下所示: - -1. 常见的窗口函数: - - `ROW_NUMBER()`:为每一行分配一个唯一的整数值,通常用于生成行号。 - - `RANK()`:为每一行分配一个排名,如果有相同的值,则会跳过相同的排名。 - - `DENSE_RANK()`:为每一行分配一个排名,如果有相同的值,则不会跳过相同的排名。 - - `NTILE(n)`:将结果集分成n个大致相等的部分,并为每个部分的行分配一个标识号。 - - `LEAD()`和`LAG()`:分别用于访问当前行之后和之前的行,通常用于计算行与前/后行之间的差异。 - -2. 窗口函数和聚合函数的区别: - 窗口函数和聚合函数(如SUM、AVG、COUNT等)都可以用于数据分析,但有一个重要的区别。聚合函数将整个结果集作为输入,并生成一个单一的值,而窗口函数将结果集分成多个窗口(窗口可以重叠)并对每个窗口内的行执行计算。 - -3. 窗口函数的性能注意事项: - - 窗口函数可能需要更多的计算资源,因此在处理大型数据集时要谨慎使用。 - - 使用合适的索引和分区策略可以提高窗口函数的性能。 - - 在需要窗口函数的情况下,尽量在数据库层面执行计算,而不是在应用程序中进行后处理。 - -4. 窗口函数的应用场景: - - 排名和百分位数计算。 - - 移动平均和累积求和。 - - 前N或后N行的分析。 - - 数据分布分析。 - -窗口函数是SQL中强大且灵活的功能,可以大大简化复杂查询的编写,同时提供了丰富的数据分析和报告功能。不同的窗口函数可以用于不同的分析任务,根据具体需求选择适当的函数和窗口规范来构建查询。 - ----- - -当使用MySQL的窗口函数时,示例通常是最有帮助的。以下是一些示例,演示了如何使用一些常见的窗口函数: - -1. **RANK() 和 DENSE_RANK() 示例**: - 假设您有一个名为`scores`的表,记录了学生的成绩,以及他们所属的班级。您想要为每个班级的学生排名,并显示排名: - - ```sql - SELECT - student_name, - score, - class_name, - RANK() OVER (PARTITION BY class_name ORDER BY score DESC) AS rank, - DENSE_RANK() OVER (PARTITION BY class_name ORDER BY score DESC) AS dense_rank - FROM scores; - ``` - - 在此示例中,`RANK()` 和 `DENSE_RANK()` 窗口函数分别计算每个班级中学生的排名,根据成绩降序排列。`PARTITION BY` 子句将结果集分成不同的班级。 - -2. **NTILE() 示例**: - 假设您有一个名为`sales`的表,记录了销售员的销售额,您希望将销售员分成三个销售额范围,并为每个销售员分配一个范围标识号: - - ```sql - SELECT - salesperson_name, - sales_amount, - NTILE(3) OVER (ORDER BY sales_amount) AS ntile - FROM sales; - ``` - - 在此示例中,`NTILE(3)` 将销售员分成三个大致相等的部分,并为每个部分的销售员分配一个标识号。 - -3. **PERCENT_RANK() 和 CUME_DIST() 示例**: - 假设您有一个名为`scores`的表,记录了学生的成绩,您想要计算每个学生的百分位排名和累积分布值: - - ```sql - SELECT - student_name, - score, - PERCENT_RANK() OVER (ORDER BY score) AS percent_rank, - CUME_DIST() OVER (ORDER BY score) AS cume_dist - FROM scores; - ``` - - 在此示例中,`PERCENT_RANK()` 计算每个学生的百分位排名,`CUME_DIST()` 计算每个学生的累积分布值,都根据成绩排序。 - -这些示例展示了如何使用不同的窗口函数来执行各种分析操作,包括排名、分位数计算和累积分布。您可以根据您的具体需求和数据结构来选择和自定义窗口函数。 - --------- - -除了前面提到的常见窗口函数,MySQL还支持其他一些窗口函数,这些函数可以用于不同类型的数据分析和报告。以下是一些其他常见的窗口函数: - -1. **FIRST_VALUE() 和 LAST_VALUE()**: - - `FIRST_VALUE(column)`:返回窗口内第一行的指定列的值。 - - `LAST_VALUE(column)`:返回窗口内最后一行的指定列的值。 - 这些函数通常用于查找窗口内的首行或末行,并获取其特定列的值。 - -2. **CUME_DIST()**: - - `CUME_DIST()`:返回当前行的累积分布值,即在排序后的结果集中,当前行前面的行所占的比例。 - 该函数用于计算当前行在整个排序结果中的相对位置。 - -3. **PERCENT_RANK()**: - - `PERCENT_RANK()`:返回当前行的百分位排名值,表示在排序后的结果集中,当前行前面的行所占的比例(0到1之间的值)。 - 这通常与百分位数计算一起使用。 - -4. **NTH_VALUE()**: - - `NTH_VALUE(column, n)`:返回窗口内指定列的第n个值,其中n是一个整数。 - 该函数允许您查找窗口内的第n个值。 - -5. **LISTAGG()**: - - `LISTAGG(column, delimiter)`:将窗口内的值连接为一个字符串,使用指定的分隔符。 - 这对于将多个值合并成一个逗号分隔的列表非常有用。 - -6. **STDDEV_POP() 和 STDDEV_SAMP()**: - - `STDDEV_POP(column)`:计算窗口内指定列的总体标准差。 - - `STDDEV_SAMP(column)`:计算窗口内指定列的样本标准差。 - 这些函数用于计算数据集的标准差,可用于了解数据的分散程度。 - -这些窗口函数可以根据具体的分析需求来选择。它们扩展了SQL的分析和聚合能力,使得能够更轻松地执行复杂的数据分析操作,从而生成有价值的报告和洞察。根据您的具体需求,可以使用这些函数来构建查询以获取所需的分析结果。 - -MySQL窗口函数的行数范围可以通过`ROWS`子句进行指定。`ROWS`子句定义了窗口的行范围。以下是`ROWS`子句的一些选项: - -1. `ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW`:从窗口的开始到当前行,包括当前行。这是默认选项。 -2. `ROWS BETWEEN 1 PRECEDING AND CURRENT ROW`:从当前行的前一行到当前行,包括当前行。 -3. `ROWS BETWEEN CURRENT ROW AND UNBOUNDED FOLLOWING`:从当前行到窗口的结束,包括当前行。 -4. `ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING`:从当前行到当前行的下一行,包括当前行。 -5. `ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING`:整个窗口范围,包括所有行。 - -你可以根据具体的需求选择适当的选项来指定窗口函数的行数范围。 - ----------------- - -### MySQL储存过程 - ---------------- - -MySQL储存过程是一组预编译的SQL语句,可以接受参数、执行特定任务并返回结果。储存过程可以减少网络传输、提高执行效率、增强代码可重用性和安全性。 - -使用储存过程的好处: - -1. 提高性能:储存过程在首次执行时被编译,之后再次调用时只需直接执行,避免了重复编译的开销。 -2. 减少网络传输:储存过程可以把多个SQL语句封装成一个单独的过程,减少了客户端和服务器之间的通信次数。 -3. 代码重用:储存过程可以重复使用,只需调用不同的参数即可。 -4. 安全性:储存过程可以限制用户的权限,只允许用户执行特定的储存过程,防止用户直接访问数据库。 - -如何创建和使用储存过程: - -1. 创建储存过程:使用CREATE PROCEDURE语句创建储存过程。 - -```sql -CREATE PROCEDURE procedure_name ([parameter1 datatype1, parameter2 datatype2, ...]) -BEGIN - -- 编写储存过程的逻辑 -END; -``` - -1. 调用储存过程:使用CALL语句调用储存过程,并传递参数。 - -```sql -CALL procedure_name (argument1, argument2, ...); -``` - -1. 查看储存过程:使用SHOW PROCEDURE STATUS语句查看所有储存过程的列表。 - -```sql -SHOW PROCEDURE STATUS; -``` - -1. 修改储存过程:使用ALTER PROCEDURE语句修改已存在的储存过程。 - -```sql -ALTER PROCEDURE procedure_name ([parameter1 datatype1, parameter2 datatype2, ...]) -BEGIN - -- 修改储存过程的逻辑 -END; -``` - -1. 删除储存过程:使用DROP PROCEDURE语句删除已存在的储存过程。 - -```mysql -DROP PROCEDURE procedure_name; -``` - ------------------ - -MySQL存储过程是一组预编译的SQL语句,可以在数据库中保存并调用。以下是MySQL存储过程的基本语法: - -```sql -DELIMITER // - -CREATE PROCEDURE procedure_name ([parameter1 datatype1, parameter2 datatype2, ...]) - [characteristics] - BEGIN - -- 声明变量 - DECLARE variable_name datatype [DEFAULT initial_value]; - - -- 处理程序逻辑 - -- 可以包含SQL语句、条件判断、循环等 - - -- 如果有OUT参数,需要在END之前赋值 - SET parameter_name = value; - - END // - -DELIMITER ; -``` - -​ 详细解释一下这个语法: - -1. `DELIMITER //`:定义自定义分隔符,以便在存储过程中使用。通常情况下,默认分隔符为`;`,但在存储过程中使用`;`会导致语法错误。因此,我们在定义存储过程之前,将分隔符设置为`//`。在结束存储过程的定义之后,我们将分隔符设置回`;`。 -2. `CREATE PROCEDURE procedure_name ([parameter1 datatype1, parameter2 datatype2, ...])`:创建名为`procedure_name`的存储过程,并指定参数及其数据类型。参数是可选的。 -3. `[characteristics]`:存储过程的特性,例如`DETERMINISTIC`、`CONTAINS SQL`、`NO SQL`等。这些特性用于优化和调试存储过程。 -4. `BEGIN ... END`:存储过程的主体部分,用于编写存储过程的逻辑。 -5. `DECLARE variable_name datatype [DEFAULT initial_value]`:在存储过程中声明变量,并指定其数据类型和初始值。 -6. 在存储过程的主体中,您可以编写SQL语句、条件判断、循环等逻辑。 -7. 如果存储过程有OUT参数,您需要在`END`之前使用`SET`语句为参数赋值。 -8. `DELIMITER ;`:将分隔符设置回默认值`;`。 - -这是一个简单的MySQL存储过程的示例,它接受一个整数参数并返回该整数的平方: - -```sql -DELIMITER // - -CREATE PROCEDURE square_number (IN num INT, OUT result INT) - BEGIN - SET result = num * num; - END // - -DELIMITER ; -``` - -要调用这个存储过程,您可以使用以下语法: - -```mysql -CALL square_number (5, @result); -SELECT @result; -``` - ------------ - -## MySQL控制流函数的使用和说明 - - - -1. **IF() 函数**: - - - 用法:`IF(expr, true_value, false_value)` - - 说明:根据条件表达式 `expr` 的结果返回两个不同的值。如果 `expr` 为真,则返回 `true_value`,否则返回 `false_value`。 - - 示例: - - ```sql - SELECT IF(score >= 60, '通过', '不通过') AS result FROM student_scores; - ``` - -2. **CASE 表达式**: - - - 用法:`CASE WHEN condition1 THEN result1 WHEN condition2 THEN result2 ELSE else_result END` - - 说明:根据条件执行不同的操作。可以使用多个 `WHEN` 子句来处理多个条件,还可以使用 `ELSE` 子句定义默认值。 - - 示例: - - ```sql - SELECT - CASE - WHEN age < 18 THEN '未成年' - WHEN age >= 18 AND age < 65 THEN '成年' - ELSE '退休' - END AS age_group - FROM people; - ``` - -3. **COALESCE() 函数**: - - - 用法:`COALESCE(value1, value2, ...)` - - 说明:返回参数列表中的第一个非 NULL 值。用于处理可能为 NULL 的字段。 - - 示例: - - ```sql - SELECT COALESCE(first_name, '未知') AS name FROM users; - ``` - -4. **NULLIF() 函数**: - - - 用法:`NULLIF(expr1, expr2)` - - 说明:如果 `expr1` 和 `expr2` 的值相等,则返回 NULL;否则返回 `expr1` 的值。 - - 示例: - - ```sql - SELECT NULLIF(salary, 0) AS valid_salary FROM employees; - ``` - -5. **IFNULL() 函数**: - - - 用法:`IFNULL(expr1, expr2)` - - 说明:如果 `expr1` 不为 NULL,则返回 `expr1` 的值;否则返回 `expr2` 的值。 - - 示例: - - ```sql - SELECT IFNULL(email, '无邮箱') AS user_email FROM users; - ``` - --------------------- - - - -6. **CASE 函数的简化写法**: - - - 用法:可以使用简化的 CASE 函数形式,例如: - - ```sql - CASE age - WHEN 0 THEN '婴儿' - WHEN 1 THEN '幼儿' - WHEN 2 THEN '学前儿童' - ELSE '其他' - END AS age_group - ``` - - 这种形式在处理相等条件时更简洁。 - -7. **IF() 函数的 NULL 安全版本**: - - - 用法:`IFNULL(expr, default)` - - 说明:与 IF() 函数类似,但是更适合处理 NULL 值,如果 `expr` 为 NULL,则返回 `default`。 - - 示例: - - ```sql - SELECT IFNULL(salary, 0) AS safe_salary FROM employees; - ``` - -8. **CASE 表达式的搜索形式**: - - - 用法:`CASE WHEN condition1 THEN result1 WHEN condition2 THEN result2 ELSE else_result END` - - 说明:在不同条件下返回不同的结果,适用于复杂的条件逻辑。可以嵌套 CASE 表达式以处理更复杂的情况。 - - 示例: - - ```sql - SELECT - CASE - WHEN grade = 'A' THEN '优秀' - WHEN grade = 'B' THEN '良好' - WHEN grade = 'C' THEN '及格' - ELSE '不及格' - END AS result - FROM exam_scores; - ``` - diff --git "a/21 \345\215\242\344\272\250\350\200\200/SKU.md" "b/21 \345\215\242\344\272\250\350\200\200/SKU.md" deleted file mode 100644 index 21b615cffb298865c752b0de4b9e6fec9a7c7e73..0000000000000000000000000000000000000000 --- "a/21 \345\215\242\344\272\250\350\200\200/SKU.md" +++ /dev/null @@ -1,284 +0,0 @@ -### SKU SPU的认识 - -### 什么是SKU - -SKU: 英文全称为Stock Keeping Unit,简称SKU,是产品入库后一种编码归类方法,也是库存控制的最小单位。库存进出计量的单位, 可以是以件、盒、托盘等为单位。在服装、鞋类商品中使用最多最普遍。 例如纺织品中一个SKU通常表示:规格、颜色、款式。 - -### 什么是SPU - -SPU: 是商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个产品的特性。通俗点讲,属性值、特性相同的商品就可以称为一个SPU。 - -##### 总结:SPU是标准化产品单元,区分品种;SKU是库存量单位,区分单品;商品特指与商家有关的商品,可对应多个SKU。 - -![](https://s2.loli.net/2023/09/21/lKpkowzh5P8mygq.png) - -```mysql -create database t2_db charset utf8; -use t2_db; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/21 21:13:48 */ -/*==============================================================*/ - - -drop table if exists attribute; - -drop table if exists goods; - -drop table if exists goods_content; - -drop table if exists mid; - -drop table if exists "values"; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table attribute -( - attribute_id int not null auto_increment, - attribute_name varchar(10) not null, - primary key (attribute_id) -); - -/*==============================================================*/ -/* Table: goods */ -/*==============================================================*/ -create table goods -( - goods_id int not null auto_increment, - goods_name varchar(20) not null, - primary key (goods_id) -); - -/*==============================================================*/ -/* Table: goods_content */ -/*==============================================================*/ -create table goods_content -( - conten_id int not null auto_increment, - goods_id int, - title text not null, - color varchar(7) not null, - RAM_ROM varchar(10) not null, - price decimal(8,2) not null, - inventory int, - primary key (conten_id) -); - -/*==============================================================*/ -/* Table: mid */ -/*==============================================================*/ -create table mid -( - mid_id int not null auto_increment, - conten_id int not null, - attribute_id int not null, - values_id int not null, - primary key (mid_id) -); - -/*==============================================================*/ -/* Table: "values" */ -/*==============================================================*/ -create table `values` -( - values_id int not null auto_increment, - values_elements varchar(10) not null, - primary key (values_id) -); - -alter table goods_content add constraint FK_Relationship_1 foreign key (goods_id) - references goods (goods_id) on delete restrict on update restrict; - -alter table mid add constraint FK_Relationship_2 foreign key (conten_id) - references goods_content (conten_id) on delete restrict on update restrict; - -alter table mid add constraint FK_Relationship_3 foreign key (attribute_id) - references attribute (attribute_id) on delete restrict on update restrict; - -alter table mid add constraint FK_Relationship_4 foreign key (values_id) - references `values` (values_id) on delete restrict on update restrict; - - - - -INSERT INTO `goods` VALUES (1, '华为 Mate 60 Pro'); - -INSERT INTO `attribute` VALUES (1, '颜色'); -INSERT INTO `attribute` VALUES (2, '容量'); - -INSERT INTO `values` VALUE (1, '雅川青'); -INSERT INTO `values` VALUE (2, '雅丹黑'); -INSERT INTO `values` VALUE (3, '南糯紫'); -INSERT INTO `values` VALUE (4, '白沙银'); -INSERT INTO `values` VALUE (5, '12GB+512GB'); -INSERT INTO `values` VALUE (6, '12GB+1TB'); - -INSERT INTO `goods_content` VALUE (1, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro','雅丹黑', '12GB+1TB', 7999, 2); -INSERT INTO `goods_content` VALUE (2, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro','雅川青', '12GB+1TB', 7999, 324); -INSERT INTO `goods_content` VALUE (3, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro','南糯紫', '12GB+1TB', 7999, 43); -INSERT INTO `goods_content` VALUE (4, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro','白沙银', '12GB+1TB', 7999, 10); -INSERT INTO `goods_content` VALUE (5, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro','雅丹黑','12GB+512TB', 6999, 10); -INSERT INTO `goods_content` VALUE (6, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro','雅川青','12GB+512TB', 6999, 43); -INSERT INTO `goods_content` VALUE (7, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro','南糯紫','12GB+512TB', 6999, 77); -INSERT INTO `goods_content` VALUE (8, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro','白沙银','12GB+512TB', 6999, 0); - -INSERT INTO `mid` VALUES (1, 1, 1, 2); -INSERT INTO `mid` VALUES (2, 1, 2, 6); -INSERT INTO `mid` VALUES (3, 2, 1, 1); -INSERT INTO `mid` VALUES (4, 2, 2, 6); -INSERT INTO `mid` VALUES (5, 3, 1, 3); -INSERT INTO `mid` VALUES (6, 3, 2, 6); -INSERT INTO `mid` VALUES (7, 4, 1, 4); -INSERT INTO `mid` VALUES (8, 4, 2, 6); -INSERT INTO `mid` VALUES (9, 5, 1, 2); -INSERT INTO `mid` VALUES (10, 5, 2, 5); -INSERT INTO `mid` VALUES (11, 6, 1, 1); -INSERT INTO `mid` VALUES (12, 6, 2, 5); -INSERT INTO `mid` VALUES (13, 7, 1, 3); -INSERT INTO `mid` VALUES (14, 7, 2, 5); -INSERT INTO `mid` VALUES (15, 8, 1, 4); -INSERT INTO `mid` VALUES (16, 8, 2, 5); - - - -# 查询全部商品信息 - - -/*select goods.goods_name,title,values_elements,color,RAM_ROM,price,inventory from goods,goods_content,attribute,`values`,mid where goods.goods_id=goods_content.goods_id and attribute.attribute_id=mid.attribute_id and goods_content.conten_id=mid.conten_id and `values`.values_id=mid.values_id; -*/ - -create or replace view view_all as select distinct goods.goods_name,title,color,RAM_ROM,price,inventory from goods,goods_content,attribute,`values`,mid where goods.goods_id=goods_content.goods_id and attribute.attribute_id=mid.attribute_id and goods_content.conten_id=mid.conten_id and `values`.values_id=mid.values_id; - -select * from view_all; - - -######################################################################################################################### - - -drop table if exists attribute; - -drop table if exists goods; - -drop table if exists goods_content; - -drop table if exists mid; - -drop table if exists `values`; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table attribute -( - attribute_id int not null auto_increment, - attribute_name varchar(10) not null, - primary key (attribute_id) -); - -/*==============================================================*/ -/* Table: goods */ -/*==============================================================*/ -create table goods -( - goods_id int not null auto_increment, - goods_name varchar(20) not null, - primary key (goods_id) -); - -/*==============================================================*/ -/* Table: goods_content */ -/*==============================================================*/ -create table goods_content -( - conten_id int not null auto_increment, - goods_id int, - title text not null, - price decimal(8,2) not null, - inventory int, - primary key (conten_id) -); - -/*==============================================================*/ -/* Table: mid */ -/*==============================================================*/ -create table mid -( - mid_id int not null auto_increment, - conten_id int not null, - attribute_id int not null, - values_id int not null, - primary key (mid_id) -); - -/*==============================================================*/ -/* Table: "values" */ -/*==============================================================*/ -create table `values` -( - values_id int not null auto_increment, - values_elements varchar(10) not null, - primary key (values_id) -); - -alter table goods_content add constraint FK_Relationship_1 foreign key (goods_id) - references goods (goods_id) on delete restrict on update restrict; - -alter table mid add constraint FK_Relationship_2 foreign key (conten_id) - references goods_content (conten_id) on delete restrict on update restrict; - -alter table mid add constraint FK_Relationship_3 foreign key (attribute_id) - references attribute (attribute_id) on delete restrict on update restrict; - -alter table mid add constraint FK_Relationship_4 foreign key (values_id) - references `values` (values_id) on delete restrict on update restrict; - - - - - -INSERT INTO `goods` VALUES (1, '华为 Mate 60 Pro'); - -INSERT INTO `attribute` VALUES (1, '颜色'); -INSERT INTO `attribute` VALUES (2, '容量'); - -INSERT INTO `values` VALUE (1, '雅川青'); -INSERT INTO `values` VALUE (2, '雅丹黑'); -INSERT INTO `values` VALUE (3, '南糯紫'); -INSERT INTO `values` VALUE (4, '白沙银'); -INSERT INTO `values` VALUE (5, '12GB+512GB'); -INSERT INTO `values` VALUE (6, '12GB+1TB'); - -INSERT INTO `goods_content` VALUE (1, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro', 7999, 2); -INSERT INTO `goods_content` VALUE (2, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro', 7999, 324); -INSERT INTO `goods_content` VALUE (3, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro', 7999, 43); -INSERT INTO `goods_content` VALUE (4, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro', 7999, 10); -INSERT INTO `goods_content` VALUE (5, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro', 6999, 10); -INSERT INTO `goods_content` VALUE (6, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro', 6999, 43); -INSERT INTO `goods_content` VALUE (7, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro', 6999, 77); -INSERT INTO `goods_content` VALUE (8, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro', 6999, 0); - -INSERT INTO `mid` VALUES (1, 1, 1, 2); -INSERT INTO `mid` VALUES (2, 1, 2, 6); -INSERT INTO `mid` VALUES (3, 2, 1, 1); -INSERT INTO `mid` VALUES (4, 2, 2, 6); -INSERT INTO `mid` VALUES (5, 3, 1, 3); -INSERT INTO `mid` VALUES (6, 3, 2, 6); -INSERT INTO `mid` VALUES (7, 4, 1, 4); -INSERT INTO `mid` VALUES (8, 4, 2, 6); -INSERT INTO `mid` VALUES (9, 5, 1, 2); -INSERT INTO `mid` VALUES (10, 5, 2, 5); -INSERT INTO `mid` VALUES (11, 6, 1, 1); -INSERT INTO `mid` VALUES (12, 6, 2, 5); -INSERT INTO `mid` VALUES (13, 7, 1, 3); -INSERT INTO `mid` VALUES (14, 7, 2, 5); -INSERT INTO `mid` VALUES (15, 8, 1, 4); -INSERT INTO `mid` VALUES (16, 8, 2, 5); - - ------------------------------------- - -create or replace view view_all as select goods.goods_name,title,values_elements,price,inventory from goods,goods_content,attribute,`values`,mid where goods.goods_id=goods_content.goods_id and attribute.attribute_id=mid.attribute_id and goods_content.conten_id=mid.conten_id and `values`.values_id=mid.values_id; -``` - diff --git "a/21 \345\215\242\344\272\250\350\200\200/er\345\233\276\347\232\204\344\275\277\347\224\250.md" "b/21 \345\215\242\344\272\250\350\200\200/er\345\233\276\347\232\204\344\275\277\347\224\250.md" deleted file mode 100644 index 5361fdaed641900525bb5bedb021f8e6932b4c25..0000000000000000000000000000000000000000 --- "a/21 \345\215\242\344\272\250\350\200\200/er\345\233\276\347\232\204\344\275\277\347\224\250.md" +++ /dev/null @@ -1,111 +0,0 @@ -## er图的认识和使用 - -#### 1.关系是相互的 - - 比如,一个学生,可以选多个课程;一个课程可以被多个学生选,必须引用第三张表 - -#### 2.表之间的关系 - -1. 一对一:将其中任一表中的主键,放到另一张表当外键 -2. 一对多:将一所在的表的主键,放在多的表当外键 -3. 多对多:必须有第三张表,将前面两个表的主键放进来当外键 - -#### 3.ER图 - - ER图:实体关系图,简称E-R,用于显示实体集之间的关系。它提供了一种表示实体类型、属性、联系的方法。 - - ER图三要素:实体、属性、联系 - - - ----------------------------------------------------------- - - - -```mysql -CREATE DATABASE stu_db CHARSEt utf8; -use stu_db; - -CREATE TABLE faculties( -fid int, -faculties_name VARCHAR(20) PRIMARY KEY -); - -insert into faculties VALUES -(123,'建筑学院'), -(124,'国际与地区研究院'), -(125,'生物医学交叉研究院'), -(126,'材料院'), -(127,'法学院'); - -CREATE table profession( -`NO` int, -profession_name VARCHAR(20) PRIMARY KEY, -faculties_name VARCHAR(20), -FOREIGN KEY (faculties_name) REFERENCES faculties(faculties_name) -); - -insert into profession VALUES -(1,'建筑技术科学','建筑学院'), -(2,'国际政治','国际与地区研究院'), -(3,'病原生物','生物医学交叉研究院'), -(4,'材料设计','材料院'), -(5,'法学','法学院'); - -CREATE table class( -class_no int, -class_name VARCHAR(20) PRIMARY KEY -); - -insert into class VALUES -(1,'建筑班'), -(2,'国际政治班'), -(3,'生命研究班'), -(4,'材料设计班'), -(5,'法学班'); - -CREATE TABLE classroom( -`NO` int, -classroom_name VARCHAR(20) PRIMARY KEY -); - -insert into classroom values -(101,'1号楼'), -(102,'2号楼'), -(103,'3号楼'), -(105,'4号楼'), -(104,'5号楼'); - -create table teacher( -id int, -name varchar(20), -profession_name VARCHAR(20), -FOREIGN KEY (profession_name) REFERENCES profession(profession_name) -); - -insert into teacher values -(1001,'教师1','建筑技术科学'), -(1002,'教师2','国际政治'), -(1003,'教师3','病原生物'), -(1004,'教师4','材料设计'), -(1005,'教师5','法学'); - -create table student( -`NO` int, -name VARCHAR(20), -faculties_name VARCHAR(20), -profession_name VARCHAR(20), -class_name VARCHAR(20), -FOREIGN KEY (faculties_name) REFERENCES faculties (faculties_name), -FOREIGN KEY (profession_name) REFERENCES profession (profession_name), -FOREIGN KEY (class_name) REFERENCES class (class_name) -); - -insert into student VALUES -(1,'学生1','建筑技术科学','建筑学院','建筑班'), -(2,'学生2','国际政治','国际与地区研究院','国际政治班'), -(3,'学生3','病原生物','生物医学交叉研究院','生命研究班'), -(4,'学生4','材料设计','材料院','材料设计班'), -(5,'学生5','法学','法学院','法学班'); -``` - diff --git "a/21 \345\215\242\344\272\250\350\200\200/er\347\273\230\345\233\276.jpg" "b/21 \345\215\242\344\272\250\350\200\200/er\347\273\230\345\233\276.jpg" deleted file mode 100644 index ee612b2b8a16e81caa9a4199735ad0a09becb7d7..0000000000000000000000000000000000000000 Binary files "a/21 \345\215\242\344\272\250\350\200\200/er\347\273\230\345\233\276.jpg" and /dev/null differ diff --git "a/21 \345\215\242\344\272\250\350\200\200/rbac\350\256\276\350\256\241.md" "b/21 \345\215\242\344\272\250\350\200\200/rbac\350\256\276\350\256\241.md" deleted file mode 100644 index 7dc180ea750d89bd1433a97d070e868b4d34a722..0000000000000000000000000000000000000000 --- "a/21 \345\215\242\344\272\250\350\200\200/rbac\350\256\276\350\256\241.md" +++ /dev/null @@ -1,173 +0,0 @@ -### RBAC (Role-Based Access Control) - -RBAC : 基于角色访问控制权限,是一种数据库设计思想,一个控制模型 - -==RBAC是主流设计模式== - -#### 数据库能存什么 - -1. 业务数据表:用户、商品 -2. 功能资源表:菜单信息表、页面代码 - -#### 权限使用背景 - -菜单权限: 不同用户登录系统后,展示菜单不同 - -按钮权限:不同用户查看同一个对象时,展示按钮不一样 - -数据权限:可见数据不同 - -操作权限:看得到点不着 例如:腾讯视频VIP你可以看到视频但是不可以播放 - -#### RBAC由三个部分组成 - -1. 用户 -2. 角色:是RBAC是的核心 -3. 权限 - -- User(用户):每个用户都有唯一的UID识别,并被授予不同的角色 -- Role(角色):不同角色具有不同的权限 -- Permission(权限):访问权限 -- 用户-角色映射:用户和角色之间的映射关系 -- 角色-权限映射:角色和权限之间的映射 - -权限关联实现授权,给用户分配应当有的对应权限 - -##### RBAC 的优点: - -简化了用户和权限的关系 - -易扩展,易维护 - -##### 缺点: - -RBAC模型没有提供操作顺序的控制机制,这一缺陷得RBAC模型很难适应那些对操作次序有严格要求的系统 - -###### 练习 - -~~~ mysql -create database text03 charset utf8; -use text03; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:27:53 */ -/*==============================================================*/ - - -drop table if exists menu; - -drop table if exists role; - -drop table if exists role_menu; - -drop table if exists `user`; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: menu */ -/*==============================================================*/ -create table menu -( - menu_id int not null auto_increment, - menu_name varchar(10) not null, - menu_address varchar(150) not null, - primary key (menu_id) -); -insert into menu values -(null,'首页','http://www.md.com/'), -(null,'查询学生信息','http://www.md.com/student'), -(null,'查询教师信息','http://www.md.com/teacher'), -(null,'查询教师工资','http://www.md.com/salary'); -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name varchar(10) not null, - primary key (role_id) -); -insert into role values -(null,'校长'), -(null,'老师'), -(null,'学生'); - -/*==============================================================*/ -/* Table: role_menu */ -/*==============================================================*/ -create table role_menu -( - menu_id int not null, - role_id int not null, - primary key (menu_id, role_id) -); -insert into role_menu values -(1,1), -(2,1), -(3,1), -(4,1), -(1,2), -(2,2), -(3,2), -(1,3), -(2,3); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table `user` -( - user_id int not null auto_increment, - user_name varchar(10) not null, - user_paw varchar(10) not null, - primary key (user_id) -); -insert into `user` values -(null,'张三','88888888'), -(null,'丘丘','66666666'), -(null,'小明','12345678'), -(null,'小红','12345678'); - -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - role_id int not null, - user_id int not null, - primary key (role_id, user_id) -); -insert into user_role values -(1,1), -(2,2), -(3,3), -(3,4); - -alter table role_menu add constraint FK_role_menu foreign key (menu_id) - references menu (menu_id) on delete restrict on update restrict; - -alter table role_menu add constraint FK_role_menu2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - - -delimiter $$ -create procedure proc01(in in_name varchar(5),in in_psw varchar(10)) -begin - select user_name,role_name,menu_name,menu_address - from `user` u,user_role ur,role r,role_menu rm,menu m where u.user_id = ur.user_id and ur.role_id = r.role_id and r.role_id = rm.role_id and rm.menu_id = m.menu_id and u.user_name = in_name and u.user_paw = in_psw; -end $$ -delimiter ; - -call proc01('张三','88888888'); -call proc01('丘丘','66666666'); -call proc01('小明','12345678'); -call proc01('小红','12345678'); -~~~ \ No newline at end of file diff --git "a/21 \345\215\242\344\272\250\350\200\200/\345\214\273\351\231\242.markdown" "b/21 \345\215\242\344\272\250\350\200\200/\345\214\273\351\231\242.markdown" deleted file mode 100644 index 3219d46f82ffc7c2a0890aef29d59cc2fc6359ef..0000000000000000000000000000000000000000 --- "a/21 \345\215\242\344\272\250\350\200\200/\345\214\273\351\231\242.markdown" +++ /dev/null @@ -1,124 +0,0 @@ -![](https://s2.loli.net/2023/09/14/Og46FvnekJRrqL8.png) - ---------------------------------- - -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 23:04:41 */ -/*==============================================================*/ - -create database yy_db charset utf8; -use yy_db; -drop table if exists department; - -drop table if exists medicine; - -drop table if exists patients; - -drop table if exists registered; - -drop table if exists staff; - -drop table if exists treatmen_trecords; - -/*==============================================================*/ -/* Table: department */ -/*==============================================================*/ -create table department -( - department_id int not null auto_increment, - department_name varchar(10) not null, - department_directort varchar(10) not null, - primary key (department_id) -); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - medicine_id int not null auto_increment, - medicine_name varchar(10) not null, - medicine_type varchar(10) not null, - medicine_price float(8,2) not null, - medicine_stock int not null, - primary key (medicine_id) -); - -/*==============================================================*/ -/* Table: patients */ -/*==============================================================*/ -create table patients -( - patients_id int not null auto_increment, - patients_name char(10) not null, - patients_gender char(1), - patients_age int not null, - patients_contact varchar(11), - primary key (patients_id) -); - -/*==============================================================*/ -/* Table: registered */ -/*==============================================================*/ -create table registered -( - registered_id int not null auto_increment, - patients_id int, - staff_id int, - registered_time datetime not null, - primary key ( registered_id) -); - - -/*==============================================================*/ -/* Table: staff */ -/*==============================================================*/ -create table staff -( - staff_id int not null auto_increment, - department_id int, - staff_name varchar(10) not null, - staff_gender char(1) not null, - staff_contact char(11) not null, - staff_speciality varchar(10), - primary key (staff_id) -); - -/*==============================================================*/ -/* Table: treatmen_trecords */ -/*==============================================================*/ -create table treatmen_trecords -( - treatmen_trecords_id int not null auto_increment, - staff_id int, - patients_id int, - medicine_id int, - treatmen_trecords_time datetime not null, - treatmen_trecords_diagnosis text not null, - treatmen_trecords_plan text not null, - primary key (treatmen_trecords_id) -); - -alter table registered add constraint FK_patients_registered foreign key (patients_id) - references patients (patients_id) on delete restrict on update restrict; - -alter table registered add constraint FK_staff_registered foreign key (staff_id) - references staff (staff_id) on delete restrict on update restrict; - -alter table staff add constraint FK_department_staff foreign key (department_id) - references department (department_id) on delete restrict on update restrict; - -alter table treatmen_trecords add constraint FK_patients_treatmen foreign key (patients_id) - references patients (patients_id) on delete restrict on update restrict; - -alter table treatmen_trecords add constraint FK_staff_treatmen foreign key (staff_id) - references staff (staff_id) on delete restrict on update restrict; - -alter table treatmen_trecords add constraint FK_take foreign key (medicine_id) - references medicine (medicine_id) on delete restrict on update restrict; - - -``` - diff --git "a/21 \345\215\242\344\272\250\350\200\200/\345\233\276\344\271\246\351\246\206.markdown" "b/21 \345\215\242\344\272\250\350\200\200/\345\233\276\344\271\246\351\246\206.markdown" deleted file mode 100644 index 8397986c9e56218976df6c4d445ccc45a5359b93..0000000000000000000000000000000000000000 --- "a/21 \345\215\242\344\272\250\350\200\200/\345\233\276\344\271\246\351\246\206.markdown" +++ /dev/null @@ -1,68 +0,0 @@ -### 软件:PowerDesigner使用 - -#### 第一步:创建概念模型(类似ER图),以用户的角度。简称 CDM - -#### 第二步:将转概念模型换成逻辑模型,以计算机的角度。简称 LDM - -#### 第三步:将逻辑模型转换成物理模型,以数据库的角度。简称 PDM - -#### 第四步:生成DDL(生成数据库代码) - - - ----------------------------------------------------------------------------------------------------------------------------- - -```mysql -create database library_db charset utf8; -use library_db; - -create table administrator( -ad_id int auto_increment primary key, -ad_name char(10) -); - - - -create table duty( -du_work char(3), -ad_id int, -foreign key (ad_id) references administrator(ad_id) -); - - -create table reader( -r_id int auto_increment primary key, -r_name char(4), -r_tel char(11), -r_yorn char(1) -); - - - -create table book_type( -ty_id int primary key auto_increment, -ty_name char(8) -); - -create table book( -b_id int primary key auto_increment, -b_name varchar(20), -ty_id int, -b_press varchar(20), -foreign key (ty_id) references book_type (ty_id) -); - -create table state( -b_id int, -number int, -r_id int, -foreign key (b_id) references book(b_id), -foreign key (r_id) references reader(r_id) -); - -alter table state add `begin` datetime; -alter table state add `end` datetime; - -``` - -上显代码没有写出表数据插入 \ No newline at end of file diff --git "a/21 \345\215\242\344\272\250\350\200\200/\345\244\247\344\272\214\345\255\246\344\271\240\347\233\256\346\240\207.md" "b/21 \345\215\242\344\272\250\350\200\200/\345\244\247\344\272\214\345\255\246\344\271\240\347\233\256\346\240\207.md" deleted file mode 100644 index 6b8a790d01bfce3eaf45910de57fdfe2a0ad2795..0000000000000000000000000000000000000000 --- "a/21 \345\215\242\344\272\250\350\200\200/\345\244\247\344\272\214\345\255\246\344\271\240\347\233\256\346\240\207.md" +++ /dev/null @@ -1,25 +0,0 @@ -## 大二学习目标 - -1. 深入MySql(索引,sql优化,锁,触发器,事务) -2. Javascript -3. MVC框架 -4. node.js -5. vue - -springBoot(Redis[^1] - -[^1]: 非关系型数据库NO-SQl - -,WebAPI) - -1. 学习使用Linux服务器 - -2. 学习项目中经常出现的技术(中间件,鉴别权限) - -3. 学习制作小程序,移动端开发 - - --------------------------------------------------------------------------------- - -了解项目中需要使用那些技术 - -强化技能树 diff --git "a/21 \345\215\242\344\272\250\350\200\200/\345\244\247\347\273\203\344\271\240.md" "b/21 \345\215\242\344\272\250\350\200\200/\345\244\247\347\273\203\344\271\240.md" deleted file mode 100644 index 513f5a53613635d6dc17940367a31b538c6c2e7d..0000000000000000000000000000000000000000 --- "a/21 \345\215\242\344\272\250\350\200\200/\345\244\247\347\273\203\344\271\240.md" +++ /dev/null @@ -1,846 +0,0 @@ -## mysql复习 - -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不是null,就保持原值 - -limit 起始数,显示数 - -desc 库名:显示表结构 - -length(email):email的字节长度 - -#### 自然连接 - -表,表 where 字段=字段 and 字段=字段 - -#### 联表区间 - -表 left join 表 on 表.字段 between 表.字段 and 表.字段(不支持别名) - -#### 自连接 - -inner join 一张表当作两张表使用 - -not in(条件,条件) - -!(between 20 and 50) - -#### 自然连接 - -自然连接的关键字:**NATURAL JOIN** - -自动匹配相同名称字段, 使用自然连接时,不需要明确指定连接条件,MySQL会根据两个表中名称相同的列自动进行匹配。在自然连接的结果中,只会返回两个表中匹配的行,并且重复的列只会出现一次 - --------------- - -##### MySQL语句 - -``` mysql -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ -create database ku_db charset utf8; -use ku_db; -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - - - - - - - - - - - - - - - - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - -select job_id from employees GROUP BY job_id; -select distinct * from employees; - -# 3.查询工资大于12000的员工姓名和工资 - -select concat_ws('•',first_name,last_name),salary from employees where salary>12000; -# 4.查询员工号为176的员工的姓名和部门号 -select concat_ws('•',first_name,last_name), department_id from employees where employee_id=176; - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments ; select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -select * from employees where salary not between 5000 and 12000; - - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select * from employees where department_id in (20,50); -# 3.选择公司中没有管理者的员工姓名及job_id - -select * from employees where manager_id is null; - - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select salary,j.grade_level from employees e join job_grades j where e.salary BETWEEN j.lowest_sal and j.highest_sal; - - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select * from employees where SUBSTR(last_name,3)='尔'; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -select * from employees where last_name like '%尔%' and last_name like '%特%'; - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select * from employees where RIGHT(last_name,1)='尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select * from employees e join jobs j on e.job_id=j.job_id where e.department_id BETWEEN 80 and 100; -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - - - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select salary*12 年薪 from employees ORDER BY 年薪 desc; -# - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -select salary*12 年薪 from employees where salary not BETWEEN 8000 and 17000 ORDER BY 年薪 desc limit 20,20; - - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -select * from employees WHERE email like concat('%','e','%') ORDER BY CHAR_LENGTH(email) desc,department_id; - - - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门 -select last_name,department_name from employees e join departments d on e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -select e.job_id,d.location_id from employees e join departments d on e.department_id=d.department_id where d.department_id=90; - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select last_name,city from employees e join departments d on e.department_id=d.department_id join locations l on d.location_id=l.location_id where e.commission_pct is not null; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select last_name,e.job_id,e.department_id,department_name from employees e join departments d on e.department_id=d.department_id join locations l on d.location_id=l.location_id where city='牛津'; - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - - -select d.department_name,l.street_address,e.last_name,j.job_title from employees e join departments d join jobs j join locations l where e.department_id=d.department_id and e.job_id=j.job_id and d.location_id= l.location_id; - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select e.last_name,e.employee_id,em.last_name,em.employee_id from employees e join employees em where e.employee_id=em.manager_id; - - -# 7.查询哪些部门没有员工 -select * from employees e join employees em join departments d on em.department_id=d.department_id; -select * from employees e,departments d where d.department_id is null; - - -select * from employees e NATURAL JOIN departments d ; - -# 8. 查询哪个城市没有部门 - -select distinct city from departments d NATURAL JOIN locations; - - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select * from employees e NATURAL join departments d where d.department_name in ('销售部','信息技术部'); - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select min(salary),MAX(salary),AVG(salary),SUM(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -select min(salary),MAX(salary),round(AVG(salary)),SUM(salary) from employees GROUP BY job_id; - -#4.选择各个job_id的员工人数 -SELECT job_id, COUNT(*) from employees GROUP BY job_id; -# 5.查询员工最高工资和最低工资的差距 -SELECT MAX(salary)-MIN(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - - select manager_id,MIN(salary) from employees where manager_id is not null and salary>=6000 GROUP BY manager_id ; - - - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name,d.location_id,count(*),round(avg(salary),2) from departments d join employees e on d.department_id=e.department_id GROUP BY d.department_id; - - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select d.department_name, GROUP_CONCAT(distinct j.job_title), min(e.salary) from departments d join employees e on d.department_id=e.department_id join jobs j on j.job_id=e.job_id GROUP BY d.department_name; - - -select d.department_name, j.job_title, min(e.salary) from departments d join employees e on d.department_id=e.department_id join jobs j on j.job_id=e.job_id GROUP BY d.department_name,j.job_title; - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -select last_name,salary from employees where department_id=(select employees.department_id from employees join departments on employees.department_id=departments.department_id where last_name='兹洛特基'); - - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -select last_name,salary from employees where salary>(select avg(salary) from employees); - - - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - - -select last_name,job_id,salary from employees e where e.salary> all (SELECT em.salary from employees em where em.job_id='sa_man'); - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -SELECT employee_id,last_name -FROM employees ; - - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -select e.employee_id from employees e join departments d on e.department_id=d.department_id where d.location_id=1700; - - -#6.查询管理者是 金 的员工姓名和工资 - - - select last_name 姓名,salary 工资 from employees where manager_id in - (select employee_id from employees where last_name = '金'); - - -#7.查询工资最低的员工信息: last_name, salary - -select last_name,salary from employees where salary = - (select min(salary) from employees); - - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 -select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 1; - - - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -# 连表查 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - # 子查询 - select d.*,a.平均工资 from departments d right join - (select department_id,avg(salary) 平均工资 from employees group by department_id having avg(salary) = - (select avg(salary) 平均工资 from employees group by department_id order by 平均工资 limit 0,1)) a - on d.department_id = a.department_id; - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 -select j.*,avg(e.salary) 平均工资 - from jobs j right join employees e on j.job_id = e.job_id group by j.job_id order by 平均工资 desc limit 1; - - - -#11.查询平均工资高于公司平均工资的部门有哪些? - -select d.department_name 部门名,avg(e.salary) 平均工资 - from departments d right join employees e on d.department_id = e.department_id - group by d.department_id having 平均工资 > (select avg(salary) from employees); - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - -select * from employees where employee_id in - (select distinct(a.employee_id) from - (select e2.* from employees e1 left join employees e2 on e1.manager_id = e2.employee_id) a); -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - - - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - -select min(e.salary) 最低工资 from employees e right join - (select department_id,max(salary) 最高工资 from employees group by department_id order by 最高工资 limit 0,1) a - on e.department_id = a.department_id ; - -#方式: - - - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - -select last_name, department_id, email, salary from employees where employee_id = - (select employee_id from employees e right join - (select department_id,avg(salary) 平均工资 from employees group by department_id order by 平均工资 desc limit 0,1) a - on e.department_id = a.department_id limit 0,1); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - -select job_id from jobs where job_id != 'ST_CLERK'; - - - -#16. 选择所有没有管理者的员工的last_name - -select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - -select * from employees where last_name = 'De Haan' -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - -select e.employee_id 员工号,e.last_name 姓名,e.salary 工资,a.平均工资 from employees e left join - (select department_id,avg(salary) 平均工资 from employees group by department_id) a - on e.department_id = a.department_id and e.salary > a.平均工资; -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -select department_name from departments where department_id in - (select distinct department_id from employees where employee_id in - (select manager_id from employees group by manager_id having count(manager_id)>5)); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) -select country_id from locations where location_id in - (select location_id from departments group by location_id having count(location_id) > 2); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - - - - -``` - diff --git "a/21 \345\215\242\344\272\250\350\200\200/\346\261\275\350\275\246\351\224\200\345\224\256\344\277\241\346\201\257.markdown" "b/21 \345\215\242\344\272\250\350\200\200/\346\261\275\350\275\246\351\224\200\345\224\256\344\277\241\346\201\257.markdown" deleted file mode 100644 index 8f846c8e810ce1894746903dbd6c76a8deb619a6..0000000000000000000000000000000000000000 --- "a/21 \345\215\242\344\272\250\350\200\200/\346\261\275\350\275\246\351\224\200\345\224\256\344\277\241\346\201\257.markdown" +++ /dev/null @@ -1,202 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:56:49 */ -/*==============================================================*/ - -create database car_db charset utf8; - -use car_db; - -drop table if exists brand; - -drop table if exists car; - -drop table if exists salesman; - -drop table if exists user; - -drop table if exists record; - -/*==============================================================*/ -/* Table: brand */ -/*==============================================================*/ -create table brand -( - brand_id int(6) not null auto_increment, - brand_name char(6) not null, - primary key (brand_id) -); - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - brand_id int(6), - Version char(10) not null, - price float(8,2) not null, - car_much char(10), - primary key (car_id) -); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id int not null auto_increment, - salesman_name char(10) not null, - salesman_gender char(1) not null, - salesman_contact char(11) not null, - primary key (salesman_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_name char(10) not null, - user_age int not null, - user_contact char(10) not null, - address varchar(30) not null, - primary key (user_id) -); - -/*==============================================================*/ -/* Table: record */ -/*==============================================================*/ -create table record -( - salesman_id int, - user_id int, - car_id int, - date datetime, - mai_much char(10), - practical char(10) -); - -alter table car add constraint FK_Relationship_6 foreign key (brand_id) - references brand (brand_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_3 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_4 foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_5 foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - --- 品牌表 -insert into brand VALUES -(null,'奥迪'), -(null,'奔驰'), -(null,'宾利'), -(null,'特斯拉'); - --- 汽车表 -insert into car values -(null,1,'a100',1000000,10), -(null,1,'a200',2000000,6), -(null,2,'super1',1042300,2), -(null,2,'super2',5424230,4), -(null,3,'Yapotato1',9999999,100), -(null,3,'Yapotato2',9999999,1), -(null,4,'ssss1',5432456,11), -(null,4,'ssss11',123456,10); - --- 销售员 -insert into salesman VALUES -(null,'销售员1','男','12315431345'), -(null,'销售员2','男','15435476864'), -(null,'销售员3','男','16576835567'), -(null,'销售员4','男','14324554667'); - --- 客户 -insert into `user` VALUES -(null,'客户1',20,'14546546547','胡建省蓝屏市jjjjj'), -(null,'客户2',22,'14356556786','是是是省蓝屏市jjjjj'), -(null,'客户3',33,'14798878989','我问问省蓝屏市jjjjj'), -(null,'客户4',34,'18767534533','梵蒂冈省蓝屏市jjjjj'), -(null,'客户5',37,'17675634547','官方省蓝屏市jjjjj'); - --- 记录表 -insert into record values -(1,1,1,'2023-03-03',1,(select price from car where car_id=1)), -(3,3,3,'2023-02-03',1,(select price from car where car_id=3)), -(1,2,5,'2023-04-03',1,(select price from car where car_id=5)), -(2,1,5,'2023-08-03',1,(select price from car where car_id=5)), -(2,4,2,'2023-04-03',1,(select price from car where car_id=2)), -(1,4,2,'2023-11-12',1,(select price from car where car_id=2)); - - - --- 1.查询特定销售员的销售记录 - -``` MySQL -select s.* from record r RIGHT JOIN salesman s on r.salesman_id=s.salesman_id where r.user_id is null; -``` - - -​ -- 2.查找销售记录中销售价格最高的汽车 -``` MySQL -SELECT r.*, c.Version, c.price -FROM record r -JOIN car c ON r.car_id = c.car_id -ORDER BY c.price DESC -LIMIT 1; -``` - - - -```mysql --- 3.统计某个销售员的销售总额 -SELECT salesman_id, SUM(mai_much * practical) AS 销售总额 FROM record -WHERE salesman_id = 2; -``` - - -```mysq --- 4.根据客户3信息查询其购买过的汽车 -SELECT r.*, c.Version, c.price -FROM record r -JOIN car c ON r.car_id = c.car_id -WHERE r.user_id = 3; -``` - - - -```mysql --- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 -SELECT b.brand_name, COUNT(r.car_id) AS 数量, SUM(c.price) AS 总额FROM record r -JOIN car c ON r.car_id = c.car_id -JOIN brand b ON c.brand_id = b.brand_id -GROUP BY b.brand_name; -``` - - -```mysql --- 6.检索特定日期范围内的销售了哪些汽车 -SELECT r.*, c.Version, c.priceFROM record r -JOIN car c ON r.car_id = c.car_id -WHERE DATE(r.date) BETWEEN '2023-02-01' AND '2023-08-31'; -``` - - -```mysql --- 7.查找某车型的销售历史。 -SELECT r.*, c.Version, c.price FROM record r -JOIN car c ON r.car_id = c.car_id -WHERE c.Version = 'a100'; -``` - - -```mysql --- 8.统计每个销售员的销售数量 -SELECT s.salesman_name, COUNT(r.car_id) AS 数量 FROM record r -JOIN salesman s ON r.salesman_id = s.salesman_id -GROUP BY s.salesman_name; -``` diff --git "a/21 \345\215\242\344\272\250\350\200\200/\347\224\265\345\275\261\347\275\221\347\253\231\346\225\260\346\215\256\345\272\223.markdown" "b/21 \345\215\242\344\272\250\350\200\200/\347\224\265\345\275\261\347\275\221\347\253\231\346\225\260\346\215\256\345\272\223.markdown" deleted file mode 100644 index 9ef32cc97a3d868649eba5c3a4cc613e62a359c8..0000000000000000000000000000000000000000 --- "a/21 \345\215\242\344\272\250\350\200\200/\347\224\265\345\275\261\347\275\221\347\253\231\346\225\260\346\215\256\345\272\223.markdown" +++ /dev/null @@ -1,137 +0,0 @@ -![](https://s2.loli.net/2023/09/13/qR8Qv3GLXerBpS1.png) - ----------------------------------------------------------------------------------------------------------- - -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 12:34:05 */ -/*==============================================================*/ - -create database movie_db charset utf8; -use movie_db; - -drop table if exists account; - -drop table if exists film_review; - -drop table if exists member; - -drop table if exists movie; - -drop table if exists scomment; - -drop table if exists type; - -drop table if exists watch; - -/*==============================================================*/ -/* Table: account */ -/*==============================================================*/ -create table account -( - account_id int not null auto_increment, - account_name varchar(20) not null, - primary key (account_id) -); - -/*==============================================================*/ -/* Table: film_review */ -/*==============================================================*/ -create table film_review -( - account_id int, - movie_id int, - film_review_Score decimal(2), - film_review_caption char(10), - film_review_comment char(10), - film_review_datetime datetime -); - -/*==============================================================*/ -/* Table: member */ -/*==============================================================*/ -create table member -( - member_director char(10) not null, - member_screenwriter char(10) not null, - member_actor char(10) not null, - movie_id int, - primary key (member_director, member_screenwriter, member_actor) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_id int not null auto_increment, - movie_name varchar(20) not null, - movie_country varchar(10) not null, - movie_language varchar(10) not null, - movie_release_date char(10) not null, - movie_time int not null, - movie_alternate_name varchar(20) not null, - IMDb varchar(20) not null, - movie_introduce text, - primary key (movie_id) -); - -/*==============================================================*/ -/* Table: scomment */ -/*==============================================================*/ -create table scomment -( - scoment_lable varchar(20), - scomment_review text, - scomment_time datetime, - scomment_id int not null auto_increment, - account_id int, - watch_id int, - primary key (scomment_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - movie_id int, - tyoe_name char(2) not null, - primary key (type_id) -); - -/*==============================================================*/ -/* Table: watch */ -/*==============================================================*/ -create table watch -( - watch_id int not null auto_increment, - watch_type char(2) not null, - primary key (watch_id) -); - -alter table film_review add constraint FK_影评 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table film_review add constraint FK_评论 foreign key (account_id) - references account (account_id) on delete restrict on update restrict; - -alter table member add constraint FK_制作 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table scomment add constraint FK_短评账户 foreign key (account_id) - references account (account_id) on delete restrict on update restrict; - -alter table scomment add constraint FK_观看情况 foreign key (watch_id) - references watch (watch_id) on delete restrict on update restrict; - -alter table type add constraint FK_属于 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - - -``` - - - diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230906 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230906 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" deleted file mode 100644 index f2bb136210b3d314ee5bcf09e7b1f9380d383d9d..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230906 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" +++ /dev/null @@ -1,46 +0,0 @@ -## 开学第一课 - -#### 总结大一以及大二的学需要学的知识以及方向 - -​ $\textcolor{red}{大一:主打理论知识,学习基础知识,打下大二的基础}$ - -​ $\textcolor{red}{大二:实际应用(实操)}$ - -​ $\textcolor{red}{}$1、学习MySQL高级语言 - -​ 2、JavaScript(Ajax) - -​ 3、MVC框架(全称:model view controller) - -​ 以上为大二上学期所需要学习的内容 - -​ $\textcolor{red}{大二下:}$ - -​ 1、node.js - -​ 2、Vue.js ----简化开发,有UI框架配合 - -​ (1,2为前端) - -​ 3、Spring boot框架 - -​ $\textcolor{red}{大二下实训:}$ - -​ 1、Linux服务器 - -​ 2、项目周可能实现的技术:中间件、签权:鉴别权限 - -​ 3、小程序:app移动端开发 - -​ $\textcolor{red}{知识普及}$ - -​ 技术栈: - -​ 一个项目要求用什么技术实现,可以称为技术选型(选方案) - -​ 技能树: - -​ 一个人具备的技能,称为技能树(通俗来讲就是一个人的天赋加点) - - - diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241 E-R\345\233\276.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241 E-R\345\233\276.md" deleted file mode 100644 index 2afdb17c451aa6d8e18f36c97385586f1dfac30a..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241 E-R\345\233\276.md" +++ /dev/null @@ -1,123 +0,0 @@ -## 数据库设计 - -​ $\textcolor{red}{表与表之间的关系:}$ - -​ 表之间的关系是相互的,多对多的关系就得引入第三张功能表 - -​ 1、一对一:将其中任意一表中的主键放到另一张表中当外键 - -​ 2、一对多:将一所在的表的主键放到多的表当外键 - -​ 3、多对多:必须有第三张表,将前面两张表的主键放到第三张表中来当外键 - -​ (功能表与其它表之间的关系都是一对多) - -​ $\textcolor{red}{数据库设计方法:}$ - -​ 1、直观设计法(手工试凑发) - -​ 2、规范设计法 - -​ 3、计算机辅助设计法 - -​ $\textcolor{red}{E-R图}$ - -​ (1)概念: - -​ 实体关系图:是指以实体、关系、属性三个基础概念概括的基本结构,从而描述静态数据结构的概念 - -​ (2)要素: - -​ 3要素: - -​ 实体(表)、属性(字段)和关系(类似外键) - -​ (3)表示: - -​ 实体型:用矩形表示,矩形框内写明实体名 - -​ 属性: - -​ 1、用椭圆形或圆角矩形表示,与相应的实体连接起来; - -​ 2、主属性名称下加下划线 - -​ 联系(关系): - -​ 1、用菱形表示,菱形框内写明联系的名称 - -​ 2、用线与实体相连,可标上联系的类型 - -​ 3、联系也可以有自己的属性 - - - - - -## 作业 - -~~~ mysql -CREATE DATABASE student charset utf8; -use student; -create table department( -- 院系表 - d_id int primary key unique, -- 院系编号 - name varchar(50) -- 院系名称 -); -create table major( -- 专业表 - m_id int primary key unique, -- 专业编号 - name varchar(50), -- 专业名称 - d_id int, -- 院系编号 - FOREIGN key (d_id) references department(d_id) -- 外键 -); -create table class( -- 班级表 - c_id int PRIMARY key unique, -- 班级编号 - name varchar(50), -- 班级名称 - grade varchar(50), -- 年级 - m_id int, -- 专业编号 - foreign key (m_id) REFERENCES major(m_id) -- 外键 -); -create table student_01( -- 学生表 - number int primary key unique, -- 学号 - name varchar(50), -- 姓名 - age int, -- 年龄 - sex varchar(5), -- 性别 - c_id int, -- 班级编号 - foreign key (c_id) references class(c_id) -- 外键 -); -create table course( -- 课程 - co_id int PRIMARY key unique, -- 课程编号 - name varchar(50) -- 课程名称 -); -create table result( -- 成绩表 - n_id int, -- 学生编号 - co_id int, -- 课程编号 - result_01 double, -- 成绩 - foreign key (n_id) references student_01(number), -- 外键 - foreign key (co_id) references course(co_id) -- 外键 -); -create table terchar( -- 教师表 - g_id int primary key unique, -- 工号 - name varchar(50), -- 教师名称 - co_id int, -- 课程编号 - foreign key (co_id) references course(co_id) -- 外键 -); -create table classroom( -- 教室表 - r_id int primary key unique, -- 教室编号 - name varchar(50), -- 教室名称 - site varchar(50) -- 教室地址 -); -create table class_schedule( -- 课程表 - week varchar(50), -- 星期 - co_id int, -- 课程编号 - g_id int, -- 教师工号 - r_id int, -- 教室编号 - FOREIGN key (co_id) references course(co_id), -- 外键 - FOREIGN key (g_id) references terchar(g_id), -- 外键 - FOREIGN key (r_id) references classroom(r_id) -- 外键 -); - -~~~ - -![表格](C:\Users\XR\Desktop\表格.png) - -![E-R图](C:\Users\XR\Desktop\E-R图.png) \ No newline at end of file diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230907 \346\225\260\346\215\256\345\272\223\347\232\204\350\214\203\345\274\217.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230907 \346\225\260\346\215\256\345\272\223\347\232\204\350\214\203\345\274\217.md" deleted file mode 100644 index 9cb5c46a7d304cb4fc14289300a6690a3c42bd18..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230907 \346\225\260\346\215\256\345\272\223\347\232\204\350\214\203\345\274\217.md" +++ /dev/null @@ -1,19 +0,0 @@ -## 数据库的范式 - -2023年9月7日 - -1.第一范式: - 要求字段的内容,不可再分割,为的是保证数据的原子性 - -2.第二范式: - -​ 要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键,要依赖整个联合主键)而不能只依赖部分 - -3.第三范式: - -​ 满足第二范式的前提上,要求,非主键属性要直接依赖于主键,而不能出现传递依赖 - -#### 注意 - -实际开发不会完全按照范式来设计,因为需求不一样,有时会故意反范式 - diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230908 \346\225\260\346\215\256\343\200\201\351\200\273\350\276\221\343\200\201\347\211\251\347\220\206\346\250\241\345\236\213.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230908 \346\225\260\346\215\256\343\200\201\351\200\273\350\276\221\343\200\201\347\211\251\347\220\206\346\250\241\345\236\213.md" deleted file mode 100644 index 799606b8575c7c43c3c33b7ce65393f3612102b0..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230908 \346\225\260\346\215\256\343\200\201\351\200\273\350\276\221\343\200\201\347\211\251\347\220\206\346\250\241\345\236\213.md" +++ /dev/null @@ -1,158 +0,0 @@ -## 数据、逻辑、物理模型 - -2023年9月8日 - -软件:PowerDesigner - -概念数据模型:CMD(Concept Data Model) - -逻辑数据模型:LDM(Logical Data Model) - -物理数据模型:PDM(Physical Data Model) - -#### 作用 - -1、概念数据模型 - -概念数据模型的目标是统一业务概念,作为业务人员和技术人员之间沟通的桥梁,确定不同实体之间的最高层次的关系 - -2、逻辑数据模型 - -逻辑模型是概念模型从真实世界向计算机世界的转换,加入了系统设计的相关内容。 - -3、物理数据模型 - -物理数据模型的目标是指定如何用具体的数据库模式来实现逻辑数据模型,以及真正的保存数据。 - -#### 步骤 - -第一步: - -​ 创建概念数据模型(E-R图)(以用户的角度) - -第二步: - -​ 转换成逻辑数据模型(LDM)(以计算机的角度)[快捷方式:Ctrl+shift+L] - -第三步: - -​ 转换成物理模型(PDM)(以数据库角度)[快捷方式:Ctrl+shift+P] - -第四步: - -​ 生成DDL[快捷方式:Ctrl+G] - - - - - -## 作业 - -~~~mysql - -create database books_01; -use books_01; - -drop table if exists Administrator; - -drop table if exists BookReturn; - -drop table if exists Borrow; - -drop table if exists books; - -drop table if exists bookshelf; - -drop table if exists borrower; - -drop table if exists floor; - -drop table if exists library; - - -create table Administrator -( - a_id int not null auto_increment, - l_id int not null, - a_job char(10) not null, - a_name char(5) not null, - a_age int not null, - a_sex char(1) not null, - a_tel char(11) not null, - primary key (a_id) -); - - -create table BookReturn -( - a_id int not null, - bor_id int not null, - bos_id int not null, - bo_id int not null, - f_id int not null, - ɕǚ date not null, - ʱݤ time not null -); - - -create table Borrow -( - bor_id int not null auto_increment, - bor_name char(5) not null, - bor_tel char(11) not null, - primary key (bor_id) -); - - -create table books -( - bos_id int not null auto_increment, - bo_id int not null, - bos_name char(20) not null, - bos_price decimal(5,2) not null, - bos_press char(10) not null, - primary key (bos_id) -); - -create table bookshelf -( - bo_id int not null auto_increment, - f_id int not null, - bo_name char(10) not null, - primary key (bo_id) -); - - -create table borrower -( - bos_id int not null, - bor_id int not null, - primary key (bos_id, bor_id) -); - - -create table floor -( - f_id int not null auto_increment, - l_id int not null, - f_floor int not null, - f_name char(10) not null, - primary key (f_id) -); - - -create table library -( - l_id int not null auto_increment, - l_name char(10) not null, - l_address varchar(50) not null, - l_p varchar(255) not null, - l_tel char(11) not null, - primary key (l_id) -); - - - -~~~ - -![img](https://s2.loli.net/2023/09/11/wusfkoh2pJimdLA.png) diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230912 \347\224\265\345\275\261\344\277\241\346\201\257.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230912 \347\224\265\345\275\261\344\277\241\346\201\257.md" deleted file mode 100644 index cbff1f630bd84e15f5a864b78cf967b875481bdc..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230912 \347\224\265\345\275\261\344\277\241\346\201\257.md" +++ /dev/null @@ -1,151 +0,0 @@ -今天没有什么笔记,写一点自己的感受 - -通过上周写的图书馆管理系统er图,到今天的电影信息er图,明显的感觉到了比刚开始写的时候思路、表与表之间的关系都更加清晰了,所以还是得多看、多写、多练。 - -## 作业 - -~~~ mysql -create database movie charset utf8; -use movie; - -/*==============================================================*/ -/* Table: commentary */ -/*==============================================================*/ -create table commentary -( - commentary_id int not null auto_increment, - user_id int not null, - movie_id int not null, - commentary varchar(255) not null, - primary key (commentary_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - language_id int not null auto_increment, - language_name char(5) not null, - primary key (language_id) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_id int not null auto_increment, - type_id int not null, - region_id int not null, - language_id int not null, - movie_name varchar(20) not null, - movie_duration int not null, - movie_release int not null, - movie_briefing varchar(255) not null, - primary key (movie_id) -); - -/*==============================================================*/ -/* Table: movie2cast */ -/*==============================================================*/ -create table movie2cast -( - participant_id char(10) not null, - movie_id int not null, - actor_name char(10) not null, - primary key (participant_id, movie_id) -); - -/*==============================================================*/ -/* Table: movie2participant */ -/*==============================================================*/ -create table movie2participant -( - participant_id char(10) not null, - movie_id int not null, - director_name char(10) not null, - primary key (participant_id, movie_id) -); - -/*==============================================================*/ -/* Table: movie2scriptwriter */ -/*==============================================================*/ -create table movie2scriptwriter -( - participant_id char(10) not null, - movie_id int not null, - scriptwriter_name char(10) not null, - primary key (participant_id, movie_id) -); - -/*==============================================================*/ -/* Table: participant */ -/*==============================================================*/ -create table participant -( - participant_id char(10) not null, - participant_name char(10) not null, - participant_gender char(1) not null, - participant_age int not null, - participant_briefing varchar(255) not null, - primary key (participant_id) -); - -/*==============================================================*/ -/* Table: recommend */ -/*==============================================================*/ -create table recommend -( - recommend_id int not null auto_increment, - recommend_name char(10) not null, - primary key (recommend_id) -); - -/*==============================================================*/ -/* Table: region */ -/*==============================================================*/ -create table region -( - region_id int not null auto_increment, - region_name char(5) not null, - primary key (region_id) -); - -/*==============================================================*/ -/* Table: score */ -/*==============================================================*/ -create table score -( - movie_id int not null, - user_id int not null, - score int not null, - primary key (movie_id, user_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name char(5) not null, - primary key (type_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - recommend_id int not null, - user_name char(6) not null, - user_gende char(1) not null, - user_age int not null, - user_area char(2) not null, - primary key (user_id) -); -~~~ - -![img](https://s2.loli.net/2023/09/12/qTD9dupAHtnIWUR.png) \ No newline at end of file diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230914.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230914.md" deleted file mode 100644 index c7d39f1e69c9cf4d377e03fd030d793786959be3..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230914.md" +++ /dev/null @@ -1,222 +0,0 @@ -## 笔记 - -如果一个主体的属性有多个值,那这个属性就可以拆成一个新的主体 - -## 作业 - -![img](https://s2.loli.net/2023/09/14/oTW4nt8yMiLVQN2.png) - -![img](https://s2.loli.net/2023/09/14/TLfw4g3YmxZQ7Fb.png) - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 3:40:22 */ -/*==============================================================*/ -create database yiyuan charset utf8; -use yiyuan; - -/*==============================================================*/ -/* Table: binli --- 病例 */ -/*==============================================================*/ -create table binli -( - patient_id int not null, - case_content varchar(255) not null, - case_time datetime not null, - doctor_id int not null, - primary key (patient_id, doctor_id) -); - -/*==============================================================*/ -/* Table: charge ---收费处 */ -/*==============================================================*/ -create table charge -( - charge_id int not null auto_increment, - hospital_id int not null, - charge_name char(5) not null, - charge_money decimal(8,2) not null, - primary key (charge_id) -); - -/*==============================================================*/ -/* Table: doctor ---医生 */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - doctor_name char(5) not null, - doctor_age int not null, - doctor_gender char(1) not null, - doctor_post char(20) not null, - education char(20) not null, - doctor_tel char(11) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: drug ---药品 */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - pharmacy_id int not null, - drug_name char(10) not null, - drug_date datetime not null, - drug_warranty datetime not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: give_off ---出库 */ -/*==============================================================*/ -create table give_off -( - drug_id int not null, - patient_id int not null, - give_off_time date not null, - primary key (drug_id, patient_id) -); - -/*==============================================================*/ -/* Table: hospital ---医院 */ -/*==============================================================*/ -create table hospital -( - hospital_id int not null auto_increment, - hospital_name char(10) not null, - hospital_introduce varchar(255) not null, - hospital_address varchar(100) not null, - hospital_time varchar(30) not null, - hospital_tel char(11) not null, - primary key (hospital_id) -); - -/*==============================================================*/ -/* Table: inpatient_ward ---病房 */ -/*==============================================================*/ -create table inpatient_ward -( - patient_id int not null, - doctor_id int not null, - be_hospitalized char(1), - primary key (patient_id, doctor_id) -); - -/*==============================================================*/ -/* Table: patient ---患者 */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name char(5) not null, - patient_age int not null, - patient_gender char(1) not null, - patient_number char(18) not null, - patient_tel char(11) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: pay_the_fees ---缴费 */ -/*==============================================================*/ -create table pay_the_fees -( - pay_id char(6) not null, - patient_id int not null, - charge_id int not null, - primary key (patient_id, charge_id) -); - -/*==============================================================*/ -/* Table: pharmacy ---药房 */ -/*==============================================================*/ -create table pharmacy -( - pharmacy_id int not null auto_increment, - pharmacy_type char(5) not null, - primary key (pharmacy_id) -); - -/*==============================================================*/ -/* Table: prescription ---处方 */ -/*==============================================================*/ -create table prescription -( - patient_id int not null, - doctor_id int not null, - prescription_content varchar(255) not null, - primary key (patient_id, doctor_id) -); - -/*==============================================================*/ -/* Table: registration ---挂号 */ -/*==============================================================*/ -create table registration -( - patient_id int not null, - registration_section char(10) not null, - registration_date datetime not null, - doctor_id int not null, - primary key (patient_id, doctor_id) -); - -/*==============================================================*/ -/* Table: scheme ---治疗方案 */ -/*==============================================================*/ -create table scheme -( - patient_id int not null, - scheme_content varchar(255) not null, - scheme_time date not null, - doctor_id int not null, - primary key (patient_id, doctor_id) -); - -/*==============================================================*/ -/* Table: section ---科室 */ -/*==============================================================*/ -create table section -( - section_id int not null auto_increment, - hospital_id int not null, - section_name char(10) not null, - primary key (section_id) -); - -/*==============================================================*/ -/* Table: storage ---入库 */ -/*==============================================================*/ -create table storage -( - storage_time date not null, - pharmacy_id int not null, - hospital_id int not null, - primary key (pharmacy_id, hospital_id) -); - -/*==============================================================*/ -/* Table: symptom ---症状 */ -/*==============================================================*/ -create table symptom -( - patient_id int not null, - doctor_id int not null, - "describe" varchar(255) not null, - primary key (patient_id, doctor_id) -); - -/*==============================================================*/ -/* Table: working_time ---工作时间 */ -/*==============================================================*/ -create table working_time -( - doctor_id int not null, - section_id int not null, - working_date date not null, - working_time time not null, - primary key (doctor_id, section_id) -); -~~~ - diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230915 MySQL\345\244\215\344\271\240.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230915 MySQL\345\244\215\344\271\240.md" deleted file mode 100644 index 25dd030ae1de46c5b47f346d2e858afadcd8f24d..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230915 MySQL\345\244\215\344\271\240.md" +++ /dev/null @@ -1,37 +0,0 @@ -## 复习 - -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不null,就保持原值 - -#### ifnull - -计算时,ifnull(xx,代替值)当xx是null时,用代替值计算 - -使用方式:ifnull(字段名) - - - -limit 起始数,显示数 - -desc 库名:显示表结构 - -length(email):email的字节长度 - -#### 自然连接 - -表,表 where 字段=字段 and 字段=字段 - -#### 联表区间 - -表 left join 表 on 表.字段 between 表.字段 and 表.字段(不支持别名) - -#### 自连接 - -inner join - -not in(条件,条件) - -!(between 20 and 50) \ No newline at end of file diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230917 \346\261\275\350\275\246\351\224\200\345\224\256.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230917 \346\261\275\350\275\246\351\224\200\345\224\256.md" deleted file mode 100644 index 47ef9f85b38ecfcad8908cb3f0df03c8fff994c4..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230917 \346\261\275\350\275\246\351\224\200\345\224\256.md" +++ /dev/null @@ -1,113 +0,0 @@ -## 作业 - -汽车销售 - -~~~ mysql -create database car charset utf8; -use car; -CREATE TABLE `car` ( - `car_id` int NOT NULL AUTO_INCREMENT, - `car_brand` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `car_model` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`car_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of car --- ---------------------------- -INSERT INTO `car` VALUES (1, '宝马', 'X5'); -INSERT INTO `car` VALUES (2, '奔驰', 'E200L'); -INSERT INTO `car` VALUES (3, '奥迪', 'A8'); -INSERT INTO `car` VALUES (4, '法拉利', '990'); - --- ---------------------------- --- Table structure for client --- ---------------------------- -DROP TABLE IF EXISTS `client`; -CREATE TABLE `client` ( - `client_id` int NOT NULL AUTO_INCREMENT, - `client_name` char(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `client_age` int NOT NULL, - `client_gender` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `client_tel` char(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `client_address` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`client_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of client --- ---------------------------- -INSERT INTO `client` VALUES (1, '张三', 23, '男', '12345678910', '缅甸'); -INSERT INTO `client` VALUES (2, '李四', 24, '女', '12345678910', '福建泉州'); -INSERT INTO `client` VALUES (3, '王五', 22, '男', '12345678910', '福建龙岩'); -INSERT INTO `client` VALUES (4, '赵六', 26, '男', '12345678910', '福建福州'); - --- ---------------------------- --- Table structure for sales --- ---------------------------- -DROP TABLE IF EXISTS `sales`; -CREATE TABLE `sales` ( - `sell_id` int NULL DEFAULT NULL, - `client_id` int NULL DEFAULT NULL, - `car_id` int NULL DEFAULT NULL, - `sales_date` date NOT NULL, - `sales_price` double(10, 2) NOT NULL, - INDEX `FK_Relationship_1`(`sell_id` ASC) USING BTREE, - INDEX `FK_Relationship_2`(`client_id` ASC) USING BTREE, - INDEX `FK_Relationship_3`(`car_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`sell_id`) REFERENCES `sell` (`sell_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`client_id`) REFERENCES `client` (`client_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`car_id`) REFERENCES `car` (`car_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of sales --- ---------------------------- -INSERT INTO `sales` VALUES (1, 2, 3, '2023-09-19', 990000.00); -INSERT INTO `sales` VALUES (2, 1, 1, '2023-07-20', 450000.00); -INSERT INTO `sales` VALUES (2, 4, 4, '2023-08-21', 1500000.00); -INSERT INTO `sales` VALUES (3, 3, 2, '2023-10-22', 500000.00); - --- ---------------------------- --- Table structure for sell --- ---------------------------- -DROP TABLE IF EXISTS `sell`; -CREATE TABLE `sell` ( - `sell_id` int NOT NULL AUTO_INCREMENT, - `sell_name` char(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `sell_age` int NOT NULL, - `sell_gender` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `sell_tel` char(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `sell_address` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`sell_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of sell --- ---------------------------- -INSERT INTO `sell` VALUES (1, '官文诚', 28, '男', '12345678910', '缅甸'); -INSERT INTO `sell` VALUES (2, '陈佳炜', 26, '男', '98765432100', '老挝'); -INSERT INTO `sell` VALUES (3, '程舜', 29, '男', '85274196320', '缅北'); -INSERT INTO `sell` VALUES (4, '李俊兴', 30, '男', '96374185212', '柬埔寨'); - -SET FOREIGN_KEY_CHECKS = 1; - --- 1.查询特定销售员的销售记录 - select * from sell s join sales a on s.sell_id=a.sell_id where s.sell_name='官文诚'; - -- 2.查找销售记录中销售价格最高的汽车 - select c.car_brand,s.sales_price from sales s join car c on s.car_id=c.car_id where s.sales_price=(select max(sales_price) from sales); - -- 3.统计某个销售员的销售总额 - select sum(a.sales_price),s.sell_name from sell s join sales a on s.sell_id=a.sell_id where s.sell_name='陈佳炜'; - -- 4.根据客户信息查询其购买过的汽车 - select c.client_name,r.car_brand,r.car_model from client c left join sales s on c.client_id=s.client_id left join car r on s.car_id=r.car_id where c.client_name='张三'; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - select sum(s.sales_price),count(c.car_id) from car c left join sales s on c.car_id=s.car_id group by c.car_brand; - -- 6.检索特定日期范围内的销售了哪些汽车 - select * from car c join sales s on c.car_id=s.car_id where s.sales_date between '2023-07-20' and '2023-10-01'; - -- 7.查找某车型的销售历史。 - select * from car c join sales s on c.car_id=s.car_id where c.car_model='X5'; - -- 8.统计每个销售员的销售数量 - select s.sell_name,count(a.car_id) from sell s join sales a on s.sell_id=a.sell_id group by s.sell_id; -~~~ - -![img](https://s2.loli.net/2023/09/17/89FPkKZLNhowmvq.png) diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230920 RBAC.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230920 RBAC.md" deleted file mode 100644 index f03270dcef319126057069efc472558502f47f6e..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230920 RBAC.md" +++ /dev/null @@ -1,197 +0,0 @@ -## 笔记 - -#### RBAC(Role-Based Access Control) 基于角色的权限访问控制 - -控制权限是现在的主流方案 - -角色是RBAC的主要核心 - -##### 概念: - -RBAC是基于角色的访问控制,在RBAC中,权限与角色相关联,用户通过成为适当的角色成员而得到这些角色的权限(简单理解就是给角色分成几个等级,每个等级权限不同,从而实现更细微化的权限管理) - -![img](https://s2.loli.net/2023/09/21/mdxt4rOh2pnevLS.png) - -##### 数据库存储: - -1、业务数据表 - -2、功能资源表 - -##### 权限的使用情景: - -| 菜单权限: | 不同的用户登入系统后,展示的菜单不一样 | -| ---------- | ------------------------------------------ | -| 按钮权限: | 不同的用户查看同一个对象时,按钮权限不一样 | -| 数据权限: | 不同用户查看同一个对象,可见的数据不一样 | -| 操作权限: | 看得到,点不了 | - -##### RBAC优缺点 - -优点: - -1、简化了用户和权限的关系 - -2、易扩展、易维护 - -缺点: - -RBAC模型没有提供操作顺序的控制机制,这一缺陷使得RBAC模型很难适应哪些对操作次序有严格要求的系统 - - - - - -## 练习 - -~~~ mysql -/* - Navicat Premium Data Transfer - - Source Server : localhost_3306_1 - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : role_text - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 20/09/2023 16:40:17 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for jurisdiction --- ---------------------------- -DROP TABLE IF EXISTS `jurisdiction`; -CREATE TABLE `jurisdiction` ( - `jurisdiction_id` int NOT NULL AUTO_INCREMENT, - `jurisdiction_name` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `jurisdiction_url` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`jurisdiction_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of jurisdiction --- ---------------------------- -INSERT INTO `jurisdiction` VALUES (1, '神秘四奥信息', 'http://m78.com'); -INSERT INTO `jurisdiction` VALUES (2, '光之国地址', 'http://m78/guangzhiguo.com'); -INSERT INTO `jurisdiction` VALUES (3, '宇宙警备队', 'http://m78/guangzhiguo/jinbeidui.com'); -INSERT INTO `jurisdiction` VALUES (4, '奥特曼信息', 'http://m78/guangzhiguo/message.com'); - --- ---------------------------- --- Table structure for relationship_1 --- ---------------------------- -DROP TABLE IF EXISTS `relationship_1`; -CREATE TABLE `relationship_1` ( - `role_id` int NOT NULL, - `user_id` int NOT NULL, - PRIMARY KEY (`role_id`, `user_id`) USING BTREE, - INDEX `FK_Relationship_3`(`user_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of relationship_1 --- ---------------------------- -INSERT INTO `relationship_1` VALUES (4, 1); -INSERT INTO `relationship_1` VALUES (3, 2); -INSERT INTO `relationship_1` VALUES (4, 3); -INSERT INTO `relationship_1` VALUES (1, 4); -INSERT INTO `relationship_1` VALUES (2, 5); - --- ---------------------------- --- Table structure for relationship_2 --- ---------------------------- -DROP TABLE IF EXISTS `relationship_2`; -CREATE TABLE `relationship_2` ( - `jurisdiction_id` int NOT NULL, - `role_id` int NOT NULL, - PRIMARY KEY (`jurisdiction_id`, `role_id`) USING BTREE, - INDEX `FK_Relationship_4`(`role_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`jurisdiction_id`) REFERENCES `jurisdiction` (`jurisdiction_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of relationship_2 --- ---------------------------- -INSERT INTO `relationship_2` VALUES (1, 1); -INSERT INTO `relationship_2` VALUES (2, 1); -INSERT INTO `relationship_2` VALUES (3, 1); -INSERT INTO `relationship_2` VALUES (4, 1); -INSERT INTO `relationship_2` VALUES (1, 2); -INSERT INTO `relationship_2` VALUES (2, 2); -INSERT INTO `relationship_2` VALUES (2, 3); -INSERT INTO `relationship_2` VALUES (3, 3); -INSERT INTO `relationship_2` VALUES (4, 3); -INSERT INTO `relationship_2` VALUES (3, 4); - --- ---------------------------- --- Table structure for role --- ---------------------------- -DROP TABLE IF EXISTS `role`; -CREATE TABLE `role` ( - `role_id` int NOT NULL AUTO_INCREMENT, - `role_name` char(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`role_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role --- ---------------------------- -INSERT INTO `role` VALUES (1, '第一道光'); -INSERT INTO `role` VALUES (2, '神秘四奥'); -INSERT INTO `role` VALUES (3, '警备队领导'); -INSERT INTO `role` VALUES (4, '警备队'); - --- ---------------------------- --- Table structure for user --- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `user_id` int NOT NULL AUTO_INCREMENT, - `user_name` varchar(8) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `user_pwd` char(8) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`user_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '奥特曼', '11111111'); -INSERT INTO `user` VALUES (2, '奥特之父', '22222222'); -INSERT INTO `user` VALUES (3, '赛罗', '33333333'); -INSERT INTO `user` VALUES (4, '诺亚', '44444444'); -INSERT INTO `user` VALUES (5, '奥特之王', '55555555'); - -SET FOREIGN_KEY_CHECKS = 1; - -SELECT - * -FROM - `user` u, - relationship_1 r1, - role ro, - relationship_2 r2, - jurisdiction j -WHERE - u.user_id = r1.user_id - AND r1.role_id = ro.role_id - AND ro.role_id = r2.role_id - AND r2.jurisdiction_id = j.jurisdiction_id - AND user_name = '奥特曼' - AND user_pwd = '11111111'; - -~~~ - - - - - -![img](https://s2.loli.net/2023/09/21/KjDGHmAUESbag6L.png) \ No newline at end of file diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230920 mysql\345\244\215\344\271\240.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230920 mysql\345\244\215\344\271\240.md" deleted file mode 100644 index faa692994e46946e37fae6e121b64bbe78ed889f..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230920 mysql\345\244\215\344\271\240.md" +++ /dev/null @@ -1,1403 +0,0 @@ -## 作业 - -~~~ mysql -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ CREATE DATABASE db1 charset utf8; -USE db1; - -SET NAMES utf8mb4; - -SET FOREIGN_KEY_CHECKS = 0;-- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE -IF - EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` CHAR ( 2 ) NOT NULL, - `country_name` VARCHAR ( 40 ) DEFAULT NULL, - `region_id` INT DEFAULT NULL, - PRIMARY KEY ( `country_id` ), - KEY `countr_reg_fk` ( `region_id` ), - CONSTRAINT `countr_reg_fk` FOREIGN KEY ( `region_id` ) REFERENCES `regions` ( `region_id` ) -) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'AR', '阿根廷', 2 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'AU', '澳大利亚', 3 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'BE', '比利时', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'BR', '巴西', 2 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'CA', '加拿大', 2 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'CH', '瑞士', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'CN', '中国', 3 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'DE', '德国', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'DK', '丹麦', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'EG', '埃及', 4 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'FR', '法国', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'HK', '香港', 3 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'IL', '以色列', 4 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'IN', '印度', 3 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'IT', '意大利', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'JP', '日本', 3 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'KW', '科威特', 4 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'MX', '墨西哥', 2 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'NG', '尼日利亚', 4 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'NL', '荷兰', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'SG', '新加坡', 3 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'UK', '英国', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'US', '美国', 2 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'ZM', '赞比亚', 4 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'ZW', '津巴布韦', 4 ); - COMMIT;-- ---------------------------- --- Table structure for departments --- ---------------------------- - DROP TABLE - IF - EXISTS `departments`; - CREATE TABLE `departments` ( - `department_id` INT NOT NULL DEFAULT '0', - `department_name` VARCHAR ( 30 ) NOT NULL, - `manager_id` INT DEFAULT NULL, - `location_id` INT DEFAULT NULL, - PRIMARY KEY ( `department_id` ), - UNIQUE KEY `dept_id_pk` ( `department_id` ), - KEY `dept_loc_fk` ( `location_id` ), - KEY `dept_mgr_fk` ( `manager_id` ), - CONSTRAINT `dept_loc_fk` FOREIGN KEY ( `location_id` ) REFERENCES `locations` ( `location_id` ), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY ( `manager_id` ) REFERENCES `employees` ( `employee_id` ) - ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of departments --- ---------------------------- - BEGIN; - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 10, '行政部', 200, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 20, '营销部', 201, 1800 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 30, '采购部', 114, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 40, '人力资源部', 203, 2400 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 50, '物流部', 121, 1500 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 60, '信息技术部', 103, 1400 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 70, '公共关系部', 204, 2700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 80, '销售部', 145, 2500 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 90, '执行部门', 100, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 100, '财务部', 108, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 110, '会计部', 205, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 120, '财务部门1', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 130, '企业税务部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 140, '控制和信用部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 150, '股东服务部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 160, '员工福利部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 170, '制造部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 180, '建筑部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 190, '承包部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 200, '运营部', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 210, '信息技术支持部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 220, '网络运营中心', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 230, '信息技术帮助台', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 240, '政府销售部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 250, '零售销售部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 260, '招聘部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 270, '工资单部门', NULL, 1700 ); - COMMIT;-- ---------------------------- --- Table structure for employees --- ---------------------------- - DROP TABLE - IF - EXISTS `employees`; - CREATE TABLE `employees` ( - `employee_id` INT NOT NULL DEFAULT '0', - `first_name` VARCHAR ( 20 ) DEFAULT NULL, - `last_name` VARCHAR ( 25 ) NOT NULL, - `email` VARCHAR ( 25 ) NOT NULL, - `phone_number` VARCHAR ( 20 ) DEFAULT NULL, - `hire_date` DATE NOT NULL, - `job_id` VARCHAR ( 10 ) NOT NULL, - `salary` DOUBLE ( 8, 2 ) DEFAULT NULL, - `commission_pct` DOUBLE ( 2, 2 ) DEFAULT NULL, - `manager_id` INT DEFAULT NULL, - `department_id` INT DEFAULT NULL, - PRIMARY KEY ( `employee_id` ), - UNIQUE KEY `emp_email_uk` ( `email` ), - UNIQUE KEY `emp_emp_id_pk` ( `employee_id` ), - KEY `emp_dept_fk` ( `department_id` ), - KEY `emp_job_fk` ( `job_id` ), - KEY `emp_manager_fk` ( `manager_id` ), - CONSTRAINT `emp_dept_fk` FOREIGN KEY ( `department_id` ) REFERENCES `departments` ( `department_id` ), - CONSTRAINT `emp_job_fk` FOREIGN KEY ( `job_id` ) REFERENCES `jobs` ( `job_id` ), - CONSTRAINT `emp_manager_fk` FOREIGN KEY ( `manager_id` ) REFERENCES `employees` ( `employee_id` ) - ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of employees --- ---------------------------- - BEGIN; - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110 ); - COMMIT;-- ---------------------------- --- Table structure for job_grades --- ---------------------------- - DROP TABLE - IF - EXISTS `job_grades`; - CREATE TABLE `job_grades` ( `grade_level` VARCHAR ( 3 ) DEFAULT NULL, `lowest_sal` INT DEFAULT NULL, `highest_sal` INT DEFAULT NULL ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of job_grades --- ---------------------------- - BEGIN; - INSERT INTO `job_grades` ( `grade_level`, `lowest_sal`, `highest_sal` ) - VALUES - ( 'A', 1000, 2999 ); - INSERT INTO `job_grades` ( `grade_level`, `lowest_sal`, `highest_sal` ) - VALUES - ( 'B', 3000, 5999 ); - INSERT INTO `job_grades` ( `grade_level`, `lowest_sal`, `highest_sal` ) - VALUES - ( 'C', 6000, 9999 ); - INSERT INTO `job_grades` ( `grade_level`, `lowest_sal`, `highest_sal` ) - VALUES - ( 'D', 10000, 14999 ); - INSERT INTO `job_grades` ( `grade_level`, `lowest_sal`, `highest_sal` ) - VALUES - ( 'E', 15000, 24999 ); - INSERT INTO `job_grades` ( `grade_level`, `lowest_sal`, `highest_sal` ) - VALUES - ( 'F', 25000, 40000 ); - COMMIT;-- ---------------------------- --- Table structure for job_history --- ---------------------------- - DROP TABLE - IF - EXISTS `job_history`; - CREATE TABLE `job_history` ( - `employee_id` INT NOT NULL, - `start_date` DATE NOT NULL, - `end_date` DATE NOT NULL, - `job_id` VARCHAR ( 10 ) NOT NULL, - `department_id` INT DEFAULT NULL, - PRIMARY KEY ( `employee_id`, `start_date` ), - UNIQUE KEY `jhist_emp_id_st_date_pk` ( `employee_id`, `start_date` ), - KEY `jhist_job_fk` ( `job_id` ), - KEY `jhist_dept_fk` ( `department_id` ), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY ( `department_id` ) REFERENCES `departments` ( `department_id` ), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY ( `employee_id` ) REFERENCES `employees` ( `employee_id` ), - CONSTRAINT `jhist_job_fk` FOREIGN KEY ( `job_id` ) REFERENCES `jobs` ( `job_id` ) - ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of job_history --- ---------------------------- - BEGIN; - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 101, '1993-10-28', '1997-03-15', 'AC_MGR', 110 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 102, '1993-01-13', '1998-07-24', 'IT_PROG', 60 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 176, '1998-03-24', '1998-12-31', 'SA_REP', 80 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 176, '1999-01-01', '1999-12-31', 'SA_MAN', 80 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 200, '1987-09-17', '1993-06-17', 'AD_ASST', 90 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 201, '1996-02-17', '1999-12-19', 'MK_REP', 20 ); - COMMIT;-- ---------------------------- --- Table structure for jobs --- ---------------------------- - DROP TABLE - IF - EXISTS `jobs`; - CREATE TABLE `jobs` ( - `job_id` VARCHAR ( 10 ) NOT NULL DEFAULT '', - `job_title` VARCHAR ( 35 ) NOT NULL, - `min_salary` INT DEFAULT NULL, - `max_salary` INT DEFAULT NULL, - PRIMARY KEY ( `job_id` ), - UNIQUE KEY `job_id_pk` ( `job_id` ) - ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of jobs --- ---------------------------- - BEGIN; - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'AC_ACCOUNT', '公共会计师', 4200, 9000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'AC_MGR', '会计经理', 8200, 16000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'AD_ASST', '行政助理', 3000, 6000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'AD_PRES', '总裁', 20000, 40000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'AD_VP', '行政副总裁', 15000, 30000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'FI_ACCOUNT', '会计', 4200, 9000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'FI_MGR', '财务经理', 8200, 16000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'HR_REP', '人力资源代表', 4000, 9000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'IT_PROG', '程序员', 4000, 10000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'MK_MAN', '市场营销经理', 9000, 15000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'MK_REP', '市场营销代表', 4000, 9000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'PR_REP', '公共关系代表', 4500, 10500 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'PU_CLERK', '采购文员', 2500, 5500 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'PU_MAN', '采购经理', 8000, 15000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'SA_MAN', '销售经理', 10000, 20000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'SA_REP', '销售代表', 6000, 12000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'SH_CLERK', '发货文员', 2500, 5500 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'ST_CLERK', '库存文员', 2000, 5000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'ST_MAN', '库存经理', 5500, 8500 ); - COMMIT;-- ---------------------------- --- Table structure for locations --- ---------------------------- - DROP TABLE - IF - EXISTS `locations`; - CREATE TABLE `locations` ( - `location_id` INT NOT NULL DEFAULT '0', - `street_address` VARCHAR ( 40 ) DEFAULT NULL, - `postal_code` VARCHAR ( 12 ) DEFAULT NULL, - `city` VARCHAR ( 30 ) NOT NULL, - `state_province` VARCHAR ( 25 ) DEFAULT NULL, - `country_id` CHAR ( 2 ) DEFAULT NULL, - PRIMARY KEY ( `location_id` ), - UNIQUE KEY `loc_id_pk` ( `location_id` ), - KEY `loc_c_id_fk` ( `country_id` ), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY ( `country_id` ) REFERENCES `countries` ( `country_id` ) - ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of locations --- ---------------------------- - BEGIN; - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX' ); - COMMIT;-- ---------------------------- --- Table structure for order --- ---------------------------- - DROP TABLE - IF - EXISTS `order`; - CREATE TABLE `order` ( `order_id` INT DEFAULT NULL, `order_name` VARCHAR ( 15 ) DEFAULT NULL ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of order --- ---------------------------- - BEGIN; - INSERT INTO `order` ( `order_id`, `order_name` ) - VALUES - ( 1, 'shkstart' ); - INSERT INTO `order` ( `order_id`, `order_name` ) - VALUES - ( 2, 'tomcat' ); - INSERT INTO `order` ( `order_id`, `order_name` ) - VALUES - ( 3, 'dubbo' ); - COMMIT;-- ---------------------------- --- Table structure for regions --- ---------------------------- - DROP TABLE - IF - EXISTS `regions`; - CREATE TABLE `regions` ( `region_id` INT NOT NULL, `region_name` VARCHAR ( 25 ) DEFAULT NULL, PRIMARY KEY ( `region_id` ), UNIQUE KEY `reg_id_pk` ( `region_id` ) ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of regions --- ---------------------------- - BEGIN; - INSERT INTO `regions` ( `region_id`, `region_name` ) - VALUES - ( 1, '欧洲' ); - INSERT INTO `regions` ( `region_id`, `region_name` ) - VALUES - ( 2, '美洲' ); - INSERT INTO `regions` ( `region_id`, `region_name` ) - VALUES - ( 3, '亚洲' ); - INSERT INTO `regions` ( `region_id`, `region_name` ) - VALUES - ( 4, '中东和非洲' ); - COMMIT;-- ---------------------------- --- View structure for emp_details_view --- ---------------------------- - DROP VIEW - IF - EXISTS `emp_details_view`; - CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS SELECT - `e`.`employee_id` AS `employee_id`, - `e`.`job_id` AS `job_id`, - `e`.`manager_id` AS `manager_id`, - `e`.`department_id` AS `department_id`, - `d`.`location_id` AS `location_id`, - `l`.`country_id` AS `country_id`, - `e`.`first_name` AS `first_name`, - `e`.`last_name` AS `last_name`, - `e`.`salary` AS `salary`, - `e`.`commission_pct` AS `commission_pct`, - `d`.`department_name` AS `department_name`, - `j`.`job_title` AS `job_title`, - `l`.`city` AS `city`, - `l`.`state_province` AS `state_province`, - `c`.`country_name` AS `country_name`, - `r`.`region_name` AS `region_name` - FROM - ((((( `employees` `e` JOIN `departments` `d` ) JOIN `jobs` `j` ) JOIN `locations` `l` ) JOIN `countries` `c` ) JOIN `regions` `r` ) - WHERE - (( - `e`.`department_id` = `d`.`department_id` - ) - AND ( `d`.`location_id` = `l`.`location_id` ) - AND ( `l`.`country_id` = `c`.`country_id` ) - AND ( `c`.`region_id` = `r`.`region_id` ) - AND ( `j`.`job_id` = `e`.`job_id` )); - - SET FOREIGN_KEY_CHECKS = 1;#第03章_基本的SELECT语句的课后练习 -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - SELECT - sum( salary * 12 ) 工资总和 - FROM - employees; -#理解1:计算12月的基本工资 -#SELECT sum(salary*12) as 工资总和 FROM employees; -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - SELECT - sum( salary * 12 ), - sum( - ifnull( salary * 12 * commission_pct, 0 )) - FROM - employees; -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - SELECT DISTINCT - job_id - FROM - employees; -# 3.查询工资大于12000的员工姓名和工资 - SELECT - last_name, - salary - FROM - employees - WHERE - salary > 12000; -# 4.查询员工号为176的员工的姓名和部门号 - SELECT - last_name, - department_id - FROM - employees - WHERE - employee_id = 176; -#; -# 5.显示表 departments 的结构,并查询其中的全部数据 - DESC departments; - SELECT - * - FROM - departments; -# 第04章_运算符课后练习 -# 1.选择工资不在5000到12000的员工的姓名和工资 - SELECT - last_name, - salary - FROM - employees - WHERE - salary NOT BETWEEN 5000 - AND 12000; -# 2.选择在20或50号部门工作的员工姓名和部门号 - SELECT - last_name, - department_id - FROM - employees - WHERE - department_id = 20 - OR department_id = 50; -# 3.选择公司中没有管理者的员工姓名及job_id - SELECT - last_name, - job_id - FROM - employees - WHERE - manager_id IS NULL; -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - SELECT - last_name, - salary, - salary * commission_pct, - g.grade_level - FROM - employees e - JOIN job_grades g ON e.salary * commission_pct BETWEEN g.lowest_sal - AND g.highest_sal - WHERE - commission_pct IS NOT NULL; -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - SELECT - * - FROM - employees - WHERE - last_name LIKE '__尔'; -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - SELECT - * - FROM - employees - WHERE - last_name LIKE '%尔%特%' - OR last_name LIKE '%特%尔%'; -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - SELECT - * - FROM - employees - WHERE - first_name LIKE '%尔'; -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - SELECT - * - FROM - employees - WHERE - department_id BETWEEN 80 - AND 100; -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - SELECT - * - FROM - employees - WHERE - manager_id IN ( 100, 101, 110 ); -#第05章_排序与分页的课后练习 -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - SELECT - salary * 12 - FROM - employees - ORDER BY - salary * 12 DESC; - # -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - SELECT - * - FROM - employees - WHERE - salary NOT BETWEEN 8000 - AND 17000 - ORDER BY - salary DESC - LIMIT 2, - 20; -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - SELECT - * - FROM - employees - WHERE - email LIKE '%e%' - ORDER BY - length( email ) DESC, - department_id ASC; -# 第06章_多表查询的课后练习 -# 1.显示所有员工的姓名,部门号和部门名称。 - SELECT - e.last_name, - d.department_id, - d.department_name - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id; -# 2.查询90号部门员工的job_id和90号部门的location_id - SELECT - * - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - WHERE - d.department_id = 90; -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - SELECT - e.last_name, - d.department_name, - l.location_id, - l.city - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - LEFT JOIN locations l ON d.location_id = l.location_id - WHERE - e.commission_pct IS NOT NULL; -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - SELECT - e.last_name, - e.job_id, - d.department_id, - d.department_name - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - LEFT JOIN locations l ON d.location_id = l.location_id - WHERE - l.city = '多伦多'; -#sql92语法(自然连接): -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - SELECT - * - FROM - departments d - LEFT JOIN employees e ON d.department_id = e.department_id - WHERE - d.department_name = '行政部'; - SELECT - * - FROM - departments d, - employees e - WHERE - d.department_id = e.department_id - AND d.department_name = '行政部'; -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - SELECT - e.first_name 员工姓名, - e.employee_id 员工号, - s.last_name 上级姓名, - s.employee_id 上级员工号 - FROM - employees e - INNER JOIN employees s ON e.employee_id = s.employee_id; -# 7.查询哪些部门没有员工 - SELECT - * - FROM - departments d - LEFT JOIN employees e ON d.department_id = e.department_id - WHERE - d.manager_id IS NULL; -# 8. 查询哪个城市没有部门 - SELECT - * - FROM - locations l - LEFT JOIN departments d ON l.location_id = d.location_id - WHERE - d.department_id IS NULL; -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - SELECT - * - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - WHERE - d.department_name = '销售部' - OR d.department_name = '信息技术部'; -# 第08章_聚合函数的课后练习 -#2.查询公司员工工资的最大值,最小值,平均值,总和 - SELECT - max( salary ), - min( salary ), - avg( salary ), - sum( salary ) - FROM - employees; -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - SELECT - max( salary ), - min( salary ), - avg( salary ), - sum( salary ), - job_id - FROM - employees - GROUP BY - job_id; -#4.选择各个job_id的员工人数 - SELECT - count( job_id ) - FROM - employees; -# 5.查询员工最高工资和最低工资的差距 - SELECT - max( salary )- min( salary ) differnce - FROM - employees; -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - SELECT - min( salary ) 最低工资, - manager_id - FROM - employees - GROUP BY - manager_id - HAVING - 最低工资 >= 6000 - AND manager_id IS NOT NULL; -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - SELECT - department_id, - count( employee_id ), - avg( salary ) - FROM - employees - GROUP BY - department_id - ORDER BY - avg( salary ) DESC; -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - SELECT - min( salary ), - d.department_id, - d.department_name, - e.job_id - FROM - employees e - INNER JOIN departments d ON e.department_id = d.department_id - GROUP BY - department_id, - job_id; -# 第09章_子查询的课后练习 -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - SELECT - last_name, - salary - FROM - employees - WHERE - department_id =( - SELECT - department_id - FROM - employees - WHERE - last_name = '兹洛特基' - ); -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - SELECT - * - FROM - employees - WHERE - salary >( - SELECT - avg( salary ) - FROM - employees - ); -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - SELECT - last_name, - job_id, - salary - FROM - employees - WHERE - salary > ALL ( SELECT salary FROM employees WHERE job_id = 'SA_MAN' ); -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - SELECT - employee_id, - last_name - FROM - employees - WHERE - department_id = ANY ( SELECT department_id FROM employees WHERE email LIKE '%u%' ); -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - SELECT - department_id - FROM - employees - WHERE - department_id IN ( SELECT department_id FROM departments WHERE location_id = 1700 ); -#6.查询管理者是 金 的员工姓名和工资 - SELECT - last_name, - salary - FROM - employees - WHERE - manager_id IN ( SELECT employee_id FROM employees WHERE last_name = '金' ); -#7.查询工资最低的员工信息: last_name, salary - SELECT - last_name, - salary - FROM - employees - WHERE - salary = ( SELECT min( salary ) FROM employees ) -#8.查询平均工资最低的部门信息 - SELECT - * - FROM - departments - WHERE - department_id = ( SELECT department_id FROM employees GROUP BY department_id HAVING AVG( salary ) <= ALL ( SELECT AVG( salary ) FROM employees GROUP BY department_id ) ); - #方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - SELECT - d.*,( - SELECT - AVG( salary ) - FROM - employees - WHERE - department_id = d.department_id - ) avg_sal - FROM - departments d - WHERE - department_id = ( - SELECT - department_id - FROM - employees - GROUP BY - department_id - HAVING - AVG( salary ) <= ALL ( SELECT AVG( salary ) avg_sal FROM employees GROUP BY department_id ) - ); -#10.查询平均工资最高的 job 信息 - SELECT - * - FROM - jobs - WHERE - job_id = ( SELECT job_id FROM employees GROUP BY job_id HAVING AVG( salary ) >= ALL ( SELECT AVG( salary ) FROM employees GROUP BY job_id ) );#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 -#11.查询平均工资高于公司平均工资的部门有哪些? - SELECT - department_id - FROM - employees - WHERE - department_id IS NOT NULL - GROUP BY - department_id - HAVING - AVG( salary ) > ( SELECT AVG( salary ) FROM employees ); -#12.查询出公司中所有 manager 的详细信息 - SELECT - employee_id, - last_name, - salary - FROM - employees - WHERE - employee_id IN ( SELECT DISTINCT manager_id FROM employees ); -#方式1:自连接 自己连自己 -#方式2:子查询 -#员工编号=(管理员编号有哪些) -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - SELECT - * - FROM - employees - WHERE - department_id = 10; - #方式: -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - SELECT - department_id - FROM - departments - WHERE - department_id NOT IN ( SELECT DISTINCT department_id FROM employees WHERE job_id = 'ST_CLERK' ); -#16. 选择所有没有管理者的员工的last_name - SELECT - last_name - FROM - employees e1 - WHERE - NOT EXISTS ( SELECT * FROM employees e2 WHERE e1.manager_id = e2.employee_id ); -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - SELECT - employee_id, - last_name, - hire_date, - salary - FROM - employees - WHERE - manager_id = ( SELECT employee_id FROM employees WHERE last_name = 'De Haan' ); - #方式2: -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) -#方式1:使用相关子查询 -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - SELECT - department_name, - department_id - FROM - departments d - WHERE - 5 < ( SELECT COUNT(*) FROM employees e WHERE d.department_id = e.department_id ); -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - SELECT - country_id - FROM - locations l - WHERE - 2 < ( SELECT COUNT(*) FROM departments d WHERE l.`location_id` = d.`location_id` ); -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -~~~ - diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230921 sku.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230921 sku.md" deleted file mode 100644 index 8481094389d677109d301e8ac447be63801450f5..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230921 sku.md" +++ /dev/null @@ -1,181 +0,0 @@ -## 笔记 - -sku:规格 - -(最小库存的单位) - -一个spu有多个规格的sku - -SKU是指一款商品,每款都有出现一个SKU。一款商品多色,则是有多个SKU, - -例:一件衣服,有红色、白色、蓝色。 - -对一种商品而言,当其品牌、型号、配置、等级、花色、包装容量、单位、生产日期、保质期、用途、价格、产地等属性与其他商品存在不同时,可称为一个单品。 - -## SPU与SKU的区别 - -一般SPU 与SKU 是一对一,或者一对多的关系;如果一对多的话就是不同的规格 - -例子:SPU就是商品的“款”;SKU就是商品的“件” - -SPU指一个商品集合,一般来说就是一个集合链。一个服装的集合链会包括相似款式和不同的尺码,SKU则是最小品类单元,同一个款式的衣服不同的尺码也算不同的SKU。SKU多见于前台的商品编号,SPU多见于后台的商品管理 - - - - - -## 作业 - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:27:24 */ -/*==============================================================*/ -create database cn_csgo charset utf8; -use cn_csgo; - - -drop table if exists attribute; - -drop table if exists attribute_value; - -drop table if exists sku; - -drop table if exists spu; - -drop table if exists value; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table attribute -( - attribute_id int not null auto_increment, - attribute_name varchar(50) not null, - primary key (attribute_id) -); - -/*==============================================================*/ -/* Table: attribute_value */ -/*==============================================================*/ -create table attribute_value -( - attribute_value_id int not null auto_increment, - sku_id int, - attribute_id int, - value_id int, - primary key (attribute_value_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(100) not null, - sku_pirce decimal(8,2) not null, - sku_stock int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_detail text not null, - primary key (spu_id) -); - -/*==============================================================*/ -/* Table: value */ -/*==============================================================*/ -create table value -( - value_id int not null auto_increment, - value_content varchar(100) not null, - primary key (value_id) -); - -alter table attribute_value add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table attribute_value add constraint FK_Relationship_3 foreign key (attribute_id) - references attribute (attribute_id) on delete restrict on update restrict; - -alter table attribute_value add constraint FK_Relationship_5 foreign key (value_id) - references value (value_id) on delete restrict on update restrict; - -alter table sku add constraint FK_Relationship_4 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -INSERT INTO `attribute` VALUES (1, '皮肤'); -INSERT INTO `attribute` VALUES (2, '磨损'); - -INSERT INTO `sku` VALUES (1, 1, 'PP-野牛 红苹果 崭新出厂', 1.69, 1000); -INSERT INTO `sku` VALUES (2, 1, 'PP-野牛 红苹果 战痕累累', 1.00, 1000); -INSERT INTO `sku` VALUES (3, 1, 'PP-野牛 红苹果 久经沙场', 0.99, 1000); -INSERT INTO `sku` VALUES (4, 1, 'PP-野牛 速写图 崭新出场', 0.97, 1000); -INSERT INTO `sku` VALUES (5, 1, 'PP-野牛 速写图 略有磨损', 0.65, 1000); -INSERT INTO `sku` VALUES (6, 1, 'PP-野牛 午夜行动 战痕累累', 999.99, 3); -INSERT INTO `sku` VALUES (7, 1, 'pp-野牛 现代猎手 崭新出厂', 2000.00, 5); - -INSERT INTO `spu` VALUES (1, 'PP-野牛', 'rush b'); - -INSERT INTO `value` VALUES (1, '红苹果'); -INSERT INTO `value` VALUES (2, '速写图'); -INSERT INTO `value` VALUES (3, '午夜行动'); -INSERT INTO `value` VALUES (4, '现代猎手'); -INSERT INTO `value` VALUES (5, '崭新出厂'); -INSERT INTO `value` VALUES (6, '略有磨损'); -INSERT INTO `value` VALUES (7, '久经沙场'); -INSERT INTO `value` VALUES (8, '战痕累累'); - -INSERT INTO `attribute_value` VALUES (1, 1, 1, 1); -INSERT INTO `attribute_value` VALUES (2, 1, 2, 5); -INSERT INTO `attribute_value` VALUES (3, 2, 1, 1); -INSERT INTO `attribute_value` VALUES (4, 3, 1, 1); -INSERT INTO `attribute_value` VALUES (5, 3, 2, 7); -INSERT INTO `attribute_value` VALUES (6, 4, 1, 2); -INSERT INTO `attribute_value` VALUES (7, 4, 2, 5); -INSERT INTO `attribute_value` VALUES (8, 5, 1, 2); -INSERT INTO `attribute_value` VALUES (9, 5, 2, 5); -INSERT INTO `attribute_value` VALUES (10, 6, 1, 3); -INSERT INTO `attribute_value` VALUES (11, 6, 2, 8); -INSERT INTO `attribute_value` VALUES (12, 7, 1, 4); -INSERT INTO `attribute_value` VALUES (13, 7, 2, 5); - -SELECT - u.sku_id, - u.sku_name, - u.sku_pirce, - ae.attribute_name, - v.value_content, - spu_detail -FROM - spu s, - sku u, - attribute_value av, - attribute ae, - `value` v -WHERE - s.spu_id = u.spu_id - AND u.sku_id = av.sku_id - AND av.attribute_id = ae.attribute_id - AND av.value_id = v.value_id - AND u.sku_id =( - SELECT - a.sku_id - FROM - ( SELECT sku_id, value_content FROM attribute_value av, `value` v WHERE av.value_id = v.value_id AND value_content = '午夜行动' ) a, - ( SELECT sku_id, value_content FROM attribute_value av, `value` v WHERE av.value_id = v.value_id AND value_content = '战痕累累' ) b - WHERE - a.sku_id = b.sku_id - ); -~~~ - -![img](https://s2.loli.net/2023/09/21/CZSVlQxh5ofWbHd.png) \ No newline at end of file diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230924 .md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230924 .md" deleted file mode 100644 index 0c2d4a00d80841fddc36ce6caf664b2bcc1a1bd5..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230924 .md" +++ /dev/null @@ -1,71 +0,0 @@ -## MySQL8.0 安装步骤 - -1. - -![img](https://s2.loli.net/2023/09/24/8k4hVTld9wrAKvz.png) - -2. - -![img](https://s2.loli.net/2023/09/24/KYjHitcfNZMCPk8.png) - -3. - -![img](https://s2.loli.net/2023/09/24/frV6ycJmG47bigS.png) - -4. - -![img](https://s2.loli.net/2023/09/24/nXxMrY7CsBGgQIS.png) - -5. - -![img](https://s2.loli.net/2023/09/24/H2AqsycM63gODX1.png) - -6. - -![img](https://s2.loli.net/2023/09/24/BRYEDTC8hekvHUy.png) - -7. - -![img](https://s2.loli.net/2023/09/24/x4tcykCwg9aW3VR.png) - -8. - -![img](https://s2.loli.net/2023/09/24/UA6hj7IEnCiXM5Q.png) - -9. - -![img](https://s2.loli.net/2023/09/24/uN4xaBsUetwd2Ap.png) - -10. - -![img](https://s2.loli.net/2023/09/24/s5zAvgb3429EoVf.png) - -11.![img](https://s2.loli.net/2023/09/24/HMlE42kV6hJpb9o.png) - -12. - -![img](https://s2.loli.net/2023/09/24/Xa9PuKVTId7Z3iw.png) - -13. - -![img](https://s2.loli.net/2023/09/24/9ExVmArNwGz8Svf.png) - -14. - -![img](https://s2.loli.net/2023/09/24/FDZbN6rsQaVMyc1.png) - -15. - -![img](https://s2.loli.net/2023/09/24/ZuxKMsHQ6w9bITW.png) - -16. - -![img](https://s2.loli.net/2023/09/24/ZzIA8oCynsjdiPO.png) - -17. - -![img](https://s2.loli.net/2023/09/24/J3ObAW7Hd5VyDpE.png) - -18. - -![img](https://s2.loli.net/2023/09/24/vxqPGNteZF8ScaW.png) \ No newline at end of file diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230925 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230925 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" deleted file mode 100644 index 40e22363dd9bc15477c22ee5cff75f2b57eb9774..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230925 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" +++ /dev/null @@ -1,97 +0,0 @@ -## 笔记 - -### 1.事务 - (1)什么是事务? - - 为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - - (2)事务的四个特性 - -原子性:事务包含的这一系列操作,要么全部成功,要么全部失败。 -一致性:事务完成之后,不会将非法的数据写入数据库。 -隔离性:多个事务可以在一定程度上并发执行。 -持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上)。 - -| 原子性 | (由DBMS的事务管理子系统来实现); | -| ------ | -------------------------------------- | -| 一致性 | (由DBMS的完整性子系统执行测试任务); | -| 隔离性 | (由DBMS的并发控制子系统实现); | -| 持久性 | (由DBMS的恢复管理子系统实现的); | - -### 2.视图 - -### · (1)什么是视图? - - 在已有的表或者视图上创建的虚拟表。 - - (2)创建视图 - - create view 视图名 as select - -(可以对单表或者多表进行查询,数据库会将视图的定义保存下来。) - -可以对(单表)视图进行一些增删改查操作,这些操作会影响到原始的表。 - -(3)删除视图 - - drop view 视图名 - -### 3.索引 - -#### (1)什么是索引 - - 为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - - 注:索引类似于一本书的目录 - -#### (2)创建索引 - - create index 索引名 on 表名(字段列表) - -### 4.存储过程 - - (1)什么是存储过程? - - 存储在数据库端的一组为了完成特定功能的sql语句。 - -(2)如何创建存储过程? - - create procedure 存储过程名([参数]) - - 参数格式 (参数类型 参数名 数据类型) - - 参数类型有三种: - - IN: 输入参数,该参数的值必须在调用该存储过程时指定,在存储过程内部使用, 不能返回。 - - 缺省值是IN。 - - OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - - INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回。 -注意:小海豚SQLyog中对delimiter的识别略有不同,修改结尾符时两个都要写。 - -### 5.约束 - - (1)什么约束? - - 是一种限制,通过对表的行或者列的数据做出限制来确保数据的完整性和一致性。 - - (2)有哪些约束? - - 主键:相当于唯一性约束 + 非空约束的组合。 - - 注:一张表只能一个主键,数据库会为主键添加主键索引 - - 外键:用于确保两个表之间的参照完整性。 - -**插入记录时,要先插入主表中的记录。 -删除记录时,要先删除从表中的记录。** - - 非空: not null - - 唯一性:unique - - 检查(了解): - - 注:检查约束跟数据库版本有关系,mysql8.0.16之后才支持。 \ No newline at end of file diff --git "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230926 \350\247\206\345\233\276.md" "b/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230926 \350\247\206\345\233\276.md" deleted file mode 100644 index 0166a2ba254b434eab90bb626cacc8daf6ed5145..0000000000000000000000000000000000000000 --- "a/22 \350\202\226\351\222\237\345\207\257\351\237\251/20230926 \350\247\206\345\233\276.md" +++ /dev/null @@ -1,377 +0,0 @@ -## 笔记 - -**视图(常见的数据库对象)** - -数据字典:就是一个系统表,存放数据库相关信息的表 - -视图是一种虚拟表,本身是不具有数据的,占很少的内存 - -建立在已有的基础上,视图赖以建立的这个表称为基表(基表更新了,视图表就会自动更新) - -**建视图的语法** - -(**create view 视图名 as**(可以在视图名后面加(别名),但数量要相同) - -​ **select 字段名 from 表名** )一起运行 - -**基于视图创建视图** - -建立好一个视图后,在这个视图的基础上,继续建视图(语法同上,将查询语句的表名改成视图名,字段名改成视图中的字段名) - -**查看表格的创建过程** - -**show create table 表名** - -**show create table 视图名** - -**删除视图:** - -语法: - -drop view 视图名; - -drop view if exists 视图名 - -**更新视图数据** - -​ 视图中的行和底层基本表中的行之间必须存在一对一的关系 - - (视图虽然可以进行更新,但总的来说,视图作为虚拟表,不建议进行更新) - -**修改视图** - -​ 语法: - -​ 方法一: - -​ create or replace view 视图名 as - -​ select 字段名或别名 from 视图名 - -​ (有这个视图更新,没有就创建) - -​ 方法二: - -​ alter view 视图名 as - -​ select 字段名或别名 from 视图名 - -​ (前提是这个修改的视图一定存在) - -注意:将过滤后的数据保存成一个视图,有利于数据的安全性 - -视图优点: - -1.操作简单 2.减少数据沉余 3.灵活多变 - -**约束** - -check约束:检查约束 - -作用: - -​ 检查某个字段的值是否符合xx要求,一般指值的范围 - -语法: - -​ check(表达式)(age>0) - -​ sex char(1) - -​ check(sex in(‘男’,‘女’)) - -补充: - -​ utf8中,一个汉字是一个字符,一个字符等于3个字节(使用length()函数时)) - -~~~ mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ -USE dbtest14; - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - - - - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -create view employee_vu(姓名,员工号,部门号) as -select last_name,employee_id,department_id from employees; - -select * from employees; - -#2. 显示视图的结构 -show create table employee_vu; - -#3. 查询视图中的全部内容 - -select * from employee_vu; -#4. 将视图中的数据限定在部门号是80的范围内 -select * from employee_vu where 部门号>=0 and 部门号<=80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -create view emp_v1(员工姓名,工资,邮箱) as -select last_name,salary,email from employees where phone_number like '011%'; - -select * from emp_v1; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -create or replace view emp_v1(员工姓名,工资,邮箱,电话号码) as -select last_name,salary,email,phone_number from employees where phone_number like '011%' and email like '%e%'; - -select * from emp_v1; - -#3. 向 emp_v1 插入一条记录,是否可以? --- INSERT INTO employees VALUES (208, '文诚', '官小丑', 'EMASES', '011.515.235.568945', '2023-09-27', 'AD_PRES', 0.20, NULL, 106, 30); --- 不可以,有的情况可以插,有的情况可以插; -#4. 修改emp_v1中员工的工资,每人涨薪1000 -update emp_v1 set 工资=工资+1000; -#5. 删除emp_v1中姓名为Olsen的员工 -delete from emp_v1 where 员工姓名='Olsen'; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create view emp_v2 as -select department_id,max(salary) from employees where salary>12000 GROUP BY department_id; - - -select * from emp_v2; - -#7. 向 emp_v2 中插入一条记录,是否可以? - --- 不可以,有的情况可以插,有的情况可以插; - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view if exists emp_v1,emp_v2; -~~~ - diff --git "a/16 \351\230\231\350\213\217\346\226\207/\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260 .md" "b/23 \345\220\264\345\277\227\347\277\224/20230905\347\254\224\350\256\260.md" similarity index 38% rename from "16 \351\230\231\350\213\217\346\226\207/\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260 .md" rename to "23 \345\220\264\345\277\227\347\277\224/20230905\347\254\224\350\256\260.md" index 2b95d7fb638a51276dda685c96a4efb27eb60e68..afbf8fdebffaab21acfaa40fc1110df2b5eef410 100644 --- "a/16 \351\230\231\350\213\217\346\226\207/\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260 .md" +++ "b/23 \345\220\264\345\277\227\347\277\224/20230905\347\254\224\350\256\260.md" @@ -1,20 +1,10 @@ # 笔记 -## 一, +大一是大概学习理论知识 -大一:理论,打突牢基础,学基础知况为大二铺路; +大二是更深入的学习与实践操作 -大二:实际应用(实操).学习MySQL高级Janascript(Aiax)、MVC框架(全称:model view controller) - -大二下实训:{ - -1.linux服务器;nginx - -2.项目中可能实现的技术:中间件,签权:鉴别权限 - -3.小程序:uniapp移动端开发, - -} +新学期意味着新的目标与新的努力,需要多关注招聘网站等,了解所需的技术,以此为目标,才能更好的融入社会 课后知识普及: diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230906 \346\225\260\346\215\256\345\272\223\345\205\263\347\263\273.md" "b/23 \345\220\264\345\277\227\347\277\224/20230906\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" similarity index 58% rename from "03 \350\265\226\345\277\203\345\246\215/20230906 \346\225\260\346\215\256\345\272\223\345\205\263\347\263\273.md" rename to "23 \345\220\264\345\277\227\347\277\224/20230906\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" index 9d11a8224ce3222c99826ba615d5a45e113e8e84..9a30de468ee52b0617c7f6156cc1c0bd1c2ef0b1 100644 --- "a/03 \350\265\226\345\277\203\345\246\215/20230906 \346\225\260\346\215\256\345\272\223\345\205\263\347\263\273.md" +++ "b/23 \345\220\264\345\277\227\347\277\224/20230906\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" @@ -1,38 +1,39 @@ -## 数据库关系 +# 数据库设计 -表与表:一对一、一对多、多对多 +根据用户需求和开发的软件,设计出符合又对应的DBMS的数据库结构,使其能有效的存储和管理数据 -### 一对一 +### 表与表之间的关系 -例如:身份证与学生(任意放在一个表外键,此外键是另一个表的主键) +一对一:将其中任一表的主键放到另一表当外键 -### 一对多 +一对多:将一所在表的主键放到多的表当外键 -例如:教师与课程(一的主键放在多的外键) +多对多:有第三张表,将两个表的主键放进来当外键 -### 多对多 +### E-R图 -例如:课程与学生(要引入第三张表,第三张表的外键要有前两张表的主键) +要素:实体(表),属性(字段),关系(外键) -### ER图 +实体:用矩形表示,相当于表 -E实体(表)、R关系(字段)、实体关系图 +属性:用椭圆表示,相当于字段 + +关系:用菱形表示,写明联系关系,同时标上联系类型,相当于外键 ```mysql create database school charset utf8; use school; - -- 院系 create table department( d_id int primary key, d_name varchar(10), d_address varchar(10) -); -insert into department values -(1,'软件工程学院','望云楼'); - --- 专业 + insert into department values +(101,'软件工程学院','望云楼'); +(102,'信息工程学院','万源楼'), +(103,'建筑工程学院','辛耕楼'); + -- 专业 create table speciality( s_id int primary key, s_name varchar(10), @@ -40,10 +41,10 @@ create table speciality( foreign key (d_id) references department(d_id) ); insert into speciality values -(101,'软件技术',1); - - --- 教室 +(1,'软件技术与开发',01), +(2,'信息技术',02), +(3,'建筑设计',03); + -- 教室 create table classroom( r_id int PRIMARY KEY, r_name varchar(10) @@ -51,8 +52,8 @@ r_name varchar(10) insert into classroom values (1,'实训一'), (2,'实训二'); - --- 班级 +(3,'实训三'); + -- 班级 create table class( c_id int primary key, c_name varchar(10), @@ -61,9 +62,9 @@ create table class( ); insert into class values (1,'软件技术1班',101), -(2,'软件技术2班',101); - --- 课程 +(2,'信息工程2班',102); +(3,'建组工程3班',103); + -- 课程 CREATE TABLE course( couseId int PRIMARY key, courseName varchar(10), @@ -73,10 +74,9 @@ CREATE TABLE course( foreign key (r_id) references classroom(r_id) ); insert into course VALUES -(1,'Java',1,1), +(1,'MySQL',1,1), (2,'MySQL',2,2); - --- 教师 + -- 教师 create table teacher( t_id int primary key, t_name varchar(10), @@ -84,10 +84,9 @@ create table teacher( foreign key (couseId) references course(couseId) ); insert into teacher values -(1,'一一',1), -(2,'阿九',2); - --- 课程表 +(1,'顺丰',1), +(2,'阿贝多',2); + -- 课程表 create table `select` ( selectId int primary key, couseId int, @@ -101,7 +100,6 @@ create table `select` ( insert into `select` values (1,1,'周一8:00-11:40',2,1), (2,2,'周一14:00-17:40',1,2); - -- 学生 create table student ( id int primary key, @@ -112,8 +110,8 @@ create table student ( foreign key (selectId) references `select`(selectId) ); insert into student values -(2201,'张三',1,1), -(2202,'李四',2,2), -(2203,'王五',1,1); +(1001,'可莉',1,1), +(1002,'王权无墓',2,2), +(1003,'东方月初',1,1); ``` diff --git "a/23 \345\220\264\345\277\227\347\277\224/20230907\350\214\203\345\274\217.md" "b/23 \345\220\264\345\277\227\347\277\224/20230907\350\214\203\345\274\217.md" new file mode 100644 index 0000000000000000000000000000000000000000..4106fb8b805fdc8af82cff705897403da81233bf --- /dev/null +++ "b/23 \345\220\264\345\277\227\347\277\224/20230907\350\214\203\345\274\217.md" @@ -0,0 +1,13 @@ +### 第一范式 + +要求字段内容不可再分割,为保证数据原子性 + +例如地址信息表,一个地址可以拆分为省、市、区、街道和详细地址 + +### 第二范式 + +要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 + +### 第三范式 + +满足第二范式的前提,要求非主键属性要直接依赖于主键 \ No newline at end of file diff --git "a/16 \351\230\231\350\213\217\346\226\207/\347\254\254\344\270\211\346\254\241\344\275\234\344\270\232\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/23 \345\220\264\345\277\227\347\277\224/20230908\346\246\202\345\277\265\345\233\276.md" similarity index 91% rename from "16 \351\230\231\350\213\217\346\226\207/\347\254\254\344\270\211\346\254\241\344\275\234\344\270\232\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" rename to "23 \345\220\264\345\277\227\347\277\224/20230908\346\246\202\345\277\265\345\233\276.md" index 4d192ce88e685fea421c71c6213a1bc608e889da..4b2f48ceec755bfa83e78e335268eccb8dfb791b 100644 --- "a/16 \351\230\231\350\213\217\346\226\207/\347\254\254\344\270\211\346\254\241\344\275\234\344\270\232\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ "b/23 \345\220\264\345\277\227\347\277\224/20230908\346\246\202\345\277\265\345\233\276.md" @@ -1,11 +1,18 @@ -# 笔记 +## powerdesigner -1、创建概念模型(类似ER图)CDM(用户角度) -2、转换成逻辑模型LDM(计算机角度) -3、转换成物理模型PDM(数据库角度) -4、生成DDL +第一步:创建概念模型图(CDM)以用户角度 -```mysql +第二步:转换逻辑模型图(LDM)以计算机角度 + +第三步:转换物理模型图(PDM)以数据角度 + +第四步:生成DDL + +表与表的关系:一个表里的几条记录对应另一个表的几条记录 + +数据库范式在实际中不会完全按照范式,根据需求实际操作 + +``` /*==============================================================*/ /* DBMS name: MySQL 5.0 */ /* Created on: 2023/9/11 14:58:55 */ @@ -128,7 +135,5 @@ alter table bowor add constraint FK_bowor2 foreign key (bo_id) alter table stack add constraint FK_Relationship_5 foreign key (ad_id) references administrators (ad_id) on delete restrict on update restrict; - - ``` diff --git "a/16 \351\230\231\350\213\217\346\226\207/20230912\347\224\265\345\275\261\347\263\273\347\273\237er\345\233\276.md" "b/23 \345\220\264\345\277\227\347\277\224/20230912\347\224\265\345\275\261.md" similarity index 94% rename from "16 \351\230\231\350\213\217\346\226\207/20230912\347\224\265\345\275\261\347\263\273\347\273\237er\345\233\276.md" rename to "23 \345\220\264\345\277\227\347\277\224/20230912\347\224\265\345\275\261.md" index a63137b5553432ce3f8f85380d5c4027571d94f0..af634a58ad4943210dc65a8f1e6b97b6225c8366 100644 --- "a/16 \351\230\231\350\213\217\346\226\207/20230912\347\224\265\345\275\261\347\263\273\347\273\237er\345\233\276.md" +++ "b/23 \345\220\264\345\277\227\347\277\224/20230912\347\224\265\345\275\261.md" @@ -1,10 +1,4 @@ -![屏幕截图 2023-09-12 190051](https://s2.loli.net/2023/09/12/YDnb3xZvwmM258z.png) - -![屏幕截图 2023-09-12 190221](https://s2.loli.net/2023/09/12/yiR5D4sTdkVwMAN.png) - -![屏幕截图 2023-09-12 190244](https://s2.loli.net/2023/09/12/BKOGZ5gfSk7qU2D.png) - -```mysql +``` /*==============================================================*/ /* DBMS name: MySQL 5.0 */ /* Created on: 2023/9/12 18:53:12 */ @@ -140,7 +134,4 @@ alter table ranking add constraint FK_ranking foreign key (film_id) alter table ranking add constraint FK_ranking2 foreign key (silce_id) references silce (silce_id) on delete restrict on update restrict; - - -``` - +``` \ No newline at end of file diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230913 \345\214\273\351\231\242.md" "b/23 \345\220\264\345\277\227\347\277\224/20230913\345\214\273\351\231\242.md" similarity index 98% rename from "03 \350\265\226\345\277\203\345\246\215/20230913 \345\214\273\351\231\242.md" rename to "23 \345\220\264\345\277\227\347\277\224/20230913\345\214\273\351\231\242.md" index e26bd0e954d75f216ca218d05cb18308e7e115f2..4df439b67db8d890f686e4835e37087b64c3915a 100644 --- "a/03 \350\265\226\345\277\203\345\246\215/20230913 \345\214\273\351\231\242.md" +++ "b/23 \345\220\264\345\277\227\347\277\224/20230913\345\214\273\351\231\242.md" @@ -1,8 +1,4 @@ -如果一个主体的属性有多个值,那这个属性就可以拆成一个新主体 - -## 医院 - -```mysql +``` create database hospital_1 charset utf8; use hospital_1; @@ -169,6 +165,4 @@ INSERT INTO `patient` VALUES (1, 'isa', 21, '女'); INSERT INTO `doctor_patient_registered` VALUES (1, 1, 3, '2020-11-12 10:52:16', 50); INSERT INTO `doctor_patient_diagnosis` VALUES (1, 1, 3, 8, 110.00); - -``` - +``` \ No newline at end of file diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230915 \346\261\275\350\275\246\351\224\200\345\224\256.md" "b/23 \345\220\264\345\277\227\347\277\224/20230915\346\261\275\350\275\246.md" similarity index 98% rename from "03 \350\265\226\345\277\203\345\246\215/20230915 \346\261\275\350\275\246\351\224\200\345\224\256.md" rename to "23 \345\220\264\345\277\227\347\277\224/20230915\346\261\275\350\275\246.md" index c8ef428dc4d8e7d3a2216968d278a51989d8ed70..697d8c47a3fab106ec171161e1429327ea3af463 100644 --- "a/03 \350\265\226\345\277\203\345\246\215/20230915 \346\261\275\350\275\246\351\224\200\345\224\256.md" +++ "b/23 \345\220\264\345\277\227\347\277\224/20230915\346\261\275\350\275\246.md" @@ -1,4 +1,4 @@ -ER模型中包含3种相互关联的信息:数据对象、数据对象彼此之间相互连接的关系以及属性(属性包括数据对象的属性以及关系的属性。 +ER模型中包含3种相互关联的信息:数据对象、数据对象彼此之间相互连接的关系以及属性(属性包括数据对象的属性以及关系的属性。 1. 数据对象 @@ -8,7 +8,7 @@ ER模型中包含3种相互关联的信息:数据对象、数据对象彼此 总可以由一组属性来定义的实体都可以被认为是数据对象。 -2. 联系or关系 +1. 联系or关系 客观世界中的事物彼此之间往往是有联系的,数据对象之间也不例外。如,教师在某课室“上课”,学生在“学习”,上课和学习表示老师和课程或学生与课程之间的一种特定的连接。 @@ -20,13 +20,11 @@ ER模型中包含3种相互关联的信息:数据对象、数据对象彼此 多对多的关系 -3. 属性 +1. 属性 属性定义了数据对象的性质。必须把一个或多个属性定义为“标识符”,也就是说,当人们希望找到数据对象的一个实例时,用标识属性作为“关键字”(通常简称为“Key”键)。应该根据对所要解决的问题的理解,来确定特定数据对象的一组合适的属性。 -## 汽车销售 - -```mysql +``` /*==============================================================*/ /* DBMS name: MySQL 5.0 */ /* Created on: 2023/9/15 20:48:18 */ @@ -152,5 +150,4 @@ INSERT INTO `car_sale_record` VALUES (2, 2, 1, 2, '2023-09-15', 302900.00, 30000 -- 8.统计每个销售员的销售数量 select count(sale_id) from car_sale_record where sale_id = (select sale_id from sale where sale_name="二二"); -``` - +``` \ No newline at end of file diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230919 Mysql\345\244\215\344\271\240.md" "b/23 \345\220\264\345\277\227\347\277\224/20230919\345\244\215\344\271\240.md" similarity index 99% rename from "14 \346\235\216\344\277\212\345\205\264/20230919 Mysql\345\244\215\344\271\240.md" rename to "23 \345\220\264\345\277\227\347\277\224/20230919\345\244\215\344\271\240.md" index a67717484de50bbada6132484398c0de3ed1a6a5..f819843ea1554b4cbf72b601caabb5fbf2b04ffb 100644 --- "a/14 \346\235\216\344\277\212\345\205\264/20230919 Mysql\345\244\215\344\271\240.md" +++ "b/23 \345\220\264\345\277\227\347\277\224/20230919\345\244\215\344\271\240.md" @@ -1,5 +1,3 @@ -## mysql复习 - 如果值是null,那么所有null参与运算,返回的结果也都是null 所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) @@ -28,9 +26,9 @@ not in(条件,条件) !(between 20 and 50) -### 建库建表 +### -```mysql +``` create database db1 charset utf8; use db1; @@ -476,9 +474,9 @@ CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS sel SET FOREIGN_KEY_CHECKS = 1; ``` -### 查询语句 +查询语句 -```mysql +``` #第03章_基本的SELECT语句的课后练习 # 1.查询所有员工12个月的工资总和,并起别名为工资总和 @@ -760,6 +758,4 @@ select country_id from locations l where 2 < (select count(*) from departments d ② 如果是相关子查询的话,通常都是从外往里写。 */ - -``` - +``` \ No newline at end of file diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230920 RBAC\346\225\260\346\215\256\346\250\241\345\236\213.md" "b/23 \345\220\264\345\277\227\347\277\224/20230920RABC.md" similarity index 92% rename from "14 \346\235\216\344\277\212\345\205\264/20230920 RBAC\346\225\260\346\215\256\346\250\241\345\236\213.md" rename to "23 \345\220\264\345\277\227\347\277\224/20230920RABC.md" index 5dfa90bc7bf314b44635f35e8082b155b5a93a04..f4aac4086047d6d4001c4aae7a2c7404e4bcb2a3 100644 --- "a/14 \346\235\216\344\277\212\345\205\264/20230920 RBAC\346\225\260\346\215\256\346\250\241\345\236\213.md" +++ "b/23 \345\220\264\345\277\227\347\277\224/20230920RABC.md" @@ -6,7 +6,7 @@ RBAC : 基于角色访问控制权限 **角色**是RBAC是的核心 - RBAC是主流设计模式 +RBAC是主流设计模式 #### 数据库能存什么 @@ -21,7 +21,7 @@ RBAC : 基于角色访问控制权限 数据权限:可见数据不同 -操作权限:看得到点不着 例如:腾讯视频VIP你可以看到视频但是不可以播放 +操作权限:看得到点不着 例如:腾讯视频VIP你可以看到视频但是不可以播放 #### RBAC由三个部分组成 @@ -47,9 +47,7 @@ RBAC : 基于角色访问控制权限 RBAC模型没有提供操作顺序的控制机制,这一缺陷得RBAC模型很难适应那些对操作次序有严格要求的系统 -###### 表结构 - -~~~mysql +``` /* Navicat Premium Data Transfer @@ -172,31 +170,4 @@ INSERT INTO `user_role` VALUES (1, 3); INSERT INTO `user_role` VALUES (3, 4); SET FOREIGN_KEY_CHECKS = 1; - -~~~ - - - -###### 查询 - -~~~mysql -SELECT u.user_name,ro.role_name, aut.author_vip, aut.author_address FROM -`user` u, -user_role us, -role ro, -role_authority au, -authority aut -WHERE -u.user_id=us.user_id -AND -us.role_id=ro.role_id -AND -ro.role_id=au.role_id -AND -au.author_id=aut.author_id -AND -u.user_name='丘丘' -AND -u.user_pwd='123456'; -~~~ - +``` \ No newline at end of file diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230921 STUSKU.md" "b/23 \345\220\264\345\277\227\347\277\224/20230921SKU.md" similarity index 91% rename from "14 \346\235\216\344\277\212\345\205\264/20230921 STUSKU.md" rename to "23 \345\220\264\345\277\227\347\277\224/20230921SKU.md" index 01ffef2617dd3fb959f55b07bdc6645c3e6aecf7..6a329114773b6af75559df32332d2658b0669f25 100644 --- "a/14 \346\235\216\344\277\212\345\205\264/20230921 STUSKU.md" +++ "b/23 \345\220\264\345\277\227\347\277\224/20230921SKU.md" @@ -1,12 +1,10 @@ -### STU +### STU SKU: 英文全称为Stock Keeping Unit,简称SKU,是产品入库后一种编码归类方法,也是库存控制的最小单位。库存进出计量的单位, 可以是以件、盒、托盘等为单位。在服装、鞋类商品中使用最多最普遍。 例如纺织品中一个SKU通常表示:规格、颜色、款式。 SPU: 是商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个产品的特性。通俗点讲,属性值、特性相同的商品就可以称为一个SPU。 -##### 表结构 - -~~~mysql +``` /* Navicat Premium Data Transfer @@ -146,31 +144,4 @@ INSERT INTO `value` VALUES (6, '512G'); INSERT INTO `value` VALUES (7, '1TB'); SET FOREIGN_KEY_CHECKS = 1; - -~~~ - -~~~mysql -SELECT - s.sku_id,s.sku_tlite,s.sku_price,attribute_name,value_v,st.stu_details -FROM -sku s, -stu st, -`value` v, -attribute att, -attribute_value attr -WHERE -s.sku_id=st.stu_id -AND -attr.attribute_id=att.attribute_id -AND -attr.sku_id = s.sku_id -AND -attr.value_id = v.value_id -AND -s.sku_id=(SELECT attr.sku_id FROM (SELECT sku_id,value_v FROM attribute_value av,`value` v WHERE av.value_id=v.value_id AND value_v='雅丹黑') AS a, -(SELECT sku_id,value_v FROM attribute_value av,`value` v WHERE av.value_id=v.value_id -AND v.value_v ='256G') as b -WHERE -a.sku_id = b.sku_id); -~~~ - +``` \ No newline at end of file diff --git "a/14 \346\235\216\344\277\212\345\205\264/20230924 \351\242\204\344\271\240.md" "b/23 \345\220\264\345\277\227\347\277\224/20230922\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" similarity index 77% rename from "14 \346\235\216\344\277\212\345\205\264/20230924 \351\242\204\344\271\240.md" rename to "23 \345\220\264\345\277\227\347\277\224/20230922\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" index 38ba81f3a04cb1bf08e318a15846044b06baa12a..be371ac805ea57ad9c57370ee2c514d590ff4b22 100644 --- "a/14 \346\235\216\344\277\212\345\205\264/20230924 \351\242\204\344\271\240.md" +++ "b/23 \345\220\264\345\277\227\347\277\224/20230922\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" @@ -1,4 +1,4 @@ -## 数据库高级预习 +## 数据库高级预习 当数据库复杂需要多条 SQL 语句查询时,可以使用存储过程去完成这个需求。 @@ -8,7 +8,7 @@ #### 声明语句结束符 -```mysql +``` delimiter $$ delimiter // @@ -16,19 +16,19 @@ delimiter // #### 创建 mysql 存储过程、存储函数 -```mysql +``` create procedure 存储过程名(参数) ``` #### 存储过程体 -```mysql +``` create function 存储函数名(参数) ``` #### 参数类型有三种: -```mysql +``` IN: 输入参数,该参数的值必须在调用该存储过程时指定,在存储过程内部使用, 不能返回。 缺省值是IN。 @@ -40,7 +40,7 @@ INOUT:输入输出参数,该参数需要在调用时指定,并且可以返 ### 事务 - 为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 +为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 #### 事务的四个特性 @@ -54,7 +54,7 @@ INOUT:输入输出参数,该参数需要在调用时指定,并且可以返 #### 隔离级别 - 隔离级别从低到高依次是"读未提交"、“读已提交”、“可重复读取”和“序列化”,隔离级别越高,性能越低。mysql 数据库默认隔离级别是“可重复读取”,oracle是“读已提交”。数据库底层使用的“加锁”的机制来实现不同的隔离级别,包括对整个表加锁,对表中的行加锁。 +隔离级别从低到高依次是"读未提交"、“读已提交”、“可重复读取”和“序列化”,隔离级别越高,性能越低。mysql 数据库默认隔离级别是“可重复读取”,oracle是“读已提交”。数据库底层使用的“加锁”的机制来实现不同的隔离级别,包括对整个表加锁,对表中的行加锁。 ### 视图 @@ -62,7 +62,7 @@ INOUT:输入输出参数,该参数需要在调用时指定,并且可以返 #### 创建视图 -```mysql +``` create view 视图名 as select ``` @@ -72,19 +72,19 @@ create view 视图名 as select #### 删除视图 -```mysql +``` drop view 视图名 ``` ### 索引 - 为了提高查询的速度而在数据库端创建的一种排序的数据结构。 +为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - 注:索引类似于一本书的目录 +注:索引类似于一本书的目录 #### 创建索引 -```mysql +``` create index 索引名 on 表名(字段列表) ``` @@ -92,7 +92,7 @@ create index 索引名 on 表名(字段列表) #### 删除索引 -```mysql +``` drop index 索引名 on 表名 ``` @@ -109,19 +109,18 @@ drop index 索引名 on 表名 数据库中 1. 数据库中进行增,删,改操作时,会自动给行添加排他锁,行数据添加上了排他锁,不允许其他事务对该行数据加任何锁 + 2. 数据库中进行查(select)操作时,对数据不加任何锁 -1. 给行数据手动添加共享锁: +3. 给行数据手动添加共享锁: - ```mysql + ``` select ..from..lock in share mode select..from .. for share ``` -2. 添加排他锁: +4. 添加排他锁: - ```mysql - select...from...for update ``` - - \ No newline at end of file + select...from...for update + ``` \ No newline at end of file diff --git "a/03 \350\265\226\345\277\203\345\246\215/20230926 \350\247\206\345\233\276.md" "b/23 \345\220\264\345\277\227\347\277\224/20230926\350\247\206\345\233\276.md" similarity index 99% rename from "03 \350\265\226\345\277\203\345\246\215/20230926 \350\247\206\345\233\276.md" rename to "23 \345\220\264\345\277\227\347\277\224/20230926\350\247\206\345\233\276.md" index 74562b7c4d94dad296bf705e9a016960c4ba6539..5dc0a4bdde6f1facba097c07af5d46525d3cea1d 100644 --- "a/03 \350\265\226\345\277\203\345\246\215/20230926 \350\247\206\345\233\276.md" +++ "b/23 \345\220\264\345\277\227\347\277\224/20230926\350\247\206\345\233\276.md" @@ -1,60 +1,60 @@ -## 视图 +## 视图 #### check 检查约束 检查某个字段的值是否符合值的范围 -```mysql +``` gender char(1) , /*逗号留不留都可以*/ check(gender in ('男','女')) ``` MySQL 5.7不支持使用,MySQL8.0 可以使用 -```mysql +``` /*在utf8中,一个汉字等于一个字符,等于3个字节*/ check(length(name)>6) /*6指的是6个字节*/ ``` 视图是一种虚拟表,本身不具有数据,占用很少的内存空间 -```mysql +``` concat(last_name,' ',first_name) /*拼接字段*/ ``` 创建视图语句 -```mysql +``` create view 视图名 as select语句 ``` 删除视图语句 -```mysql +``` drop view 视图名1,视图名2 ``` 修改视图语句 -```mysql +``` create or replace view 视图名 as select 语句 ``` 使用视图 -```mysql +``` select * from 视图名 [where 条件] ``` 查看创建语句 -```mysql +``` show create table 表名 ``` 修改视图语句 -```mysql +``` update 表名 set 条件 insert into 表名 values (值) ``` @@ -67,7 +67,7 @@ insert into 表名 values (值) ### 建表建库 -```mysql +``` /* SQLyog Ultimate v12.08 (64 bit) MySQL - 5.7.28-log : Database - view_db @@ -296,12 +296,6 @@ DROP TABLE IF EXISTS `emp_details_view`; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -``` - -### 题目 - -```mysql #第14章_视图的课后练习 #练习1: @@ -342,7 +336,6 @@ create view emp_v2 as select department_id 部门id,max(salary) 最高工资 fro #7. 向 emp_v2 中插入一条记录,是否可以? 不可以 -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v2 , emp_v1; +#8. 删除刚才的emp_v2 和 emp ``` diff --git "a/54 \345\217\266\345\255\220\350\261\252/9.26\344\275\234\344\270\232.md" "b/23 \345\220\264\345\277\227\347\277\224/20230927\347\254\224\350\256\260\345\207\275\346\225\260.md" similarity index 91% rename from "54 \345\217\266\345\255\220\350\261\252/9.26\344\275\234\344\270\232.md" rename to "23 \345\220\264\345\277\227\347\277\224/20230927\347\254\224\350\256\260\345\207\275\346\225\260.md" index 6f75a63bfd9c8748b3cbdcb5c05b26cbd73c6a99..c65c97653713cd912367074ae7a105a0f817ede0 100644 --- "a/54 \345\217\266\345\255\220\350\261\252/9.26\344\275\234\344\270\232.md" +++ "b/23 \345\220\264\345\277\227\347\277\224/20230927\347\254\224\350\256\260\345\207\275\346\225\260.md" @@ -1,8 +1,30 @@ +# 笔记 + +查询生成随机数 --select floor(rand()* 数字) + +去除字符串两边空格 --trim() 去除右边空格--rtrim() 去除左边空格--ltrim() + +替换--replace(原始字符串,要替换字符串,新字符串 ) + +lower 小写 upder 大写 + +从一个字符串中取出对应字符串 + +select right(字符串,长度)从右边开始取对应长度的字符 + +select left(字符串,长度)从左边开始取对应长度的字符 + +直接从某个字符串中,取指定位置指定长度的字符串有三种 + + + ```mysql /* SQLyog Ultimate v12.08 (64 bit) MySQL - 5.7.28-log : Database - view_db + ********************************************************************* + */ @@ -194,69 +216,6 @@ insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americ DROP TABLE IF EXISTS `emp_details_view`; - - - - -#第14章_视图的课后练习 - -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE VIEW employees_vu as -SELECT last_name,employee_id,department_id FROM employees; - - -#2. 显示视图的结构 - -desc employees_vu; -#3. 查询视图中的全部内容 -SELECT * FROM employees_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 - -SELECT * FROM employees_vu WHERE department_id between 0 AND 80; -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -CREATE VIEW emp_v1 as -SELECT * FROM employees; -SELECT * FROM emp_v1 WHERE phone_number like '011%'; - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -SELECT last_name,email,phone_number,salary FROM emp_v1 WHERE phone_number like '011%' AND email LIKE '%e%'; - - -#3. 向 emp_v1 插入一条记录,是否可以? -不可以 -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE emp_v1 set salary=salary+1000; -#5. 删除emp_v1中姓名为Olsen的员工 -DELETE FROM emp_v1 WHERE last_name like 'olsen'; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -CREATE VIEW emp_v2 as -SELECT * FROM employees; -SELECT department_id,max(salary) FROM emp_v2 WHERE salary>12000 GROUP BY job_id; -#7. 向 emp_v2 中插入一条记录,是否可以? - -不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 - -drop view if EXISTS emp_v2; -drop view if EXISTS emp_v1; - - - - - - - - - /*!50001 DROP VIEW IF EXISTS `emp_details_view` */; /*!50001 DROP TABLE IF EXISTS `emp_details_view` */; @@ -290,6 +249,48 @@ drop view if EXISTS emp_v1; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +#第07章_单行函数的课后练习 + + + + +# 2.查询员工号,姓名,工资,以及工资提高百分之20%后的结果(new salary) + +SELECT employee_id,last_name,salary,salary*1.2 'new salary' FROM employees ; +# 3.将员工的姓名last_name按长度排序,并写出姓名的长度(length) + +SELECT last_name FROM employees +SELECT last_name, LENGTH(last_name) FROM employees ORDER BY LENGTH(last_name) ; + +# 4.查询员工id,last_name,salary,并作为一个列输出,别名为OUT_PUT + +SELECT CONCAT(employee_id,last_name,salary) out_put FROM employees ; -- concat 组合函数 + +# 5.查询公司各员工工作的年数、工作的天数,并按工作年数的降序排序 + +SELECT last_name,DATEDIFF(SYSDATE(),hire_date)/365 work_years, +DATEDIFF(SYSDATE(),hire_date) work_days +FROM employees +ORDER BY work_years DESC; + + +# 6.查询员工姓名,hire_date , department_id,满足以下条件: + +#雇用时间在1997年之后,department_id 为80 或 90 或110, commission_pct不为空 +SELECT last_name,hire_date,department_id FROM employees WHERE hire_date>'1997-01-01' AND department_id in(80,90.110) AND commission_pct IS NOT null; +SELECT * FROM employees + +# 7.查询公司中入职超过10000天的员工姓名、入职时间 + +select last_name,hire_date from employees where DATEDIFF(NOW(),hire_date); + +# 8.做一个查询,产生下面的结果 + +# earns monthly but wants + +SELECT last_name 员工 ,salary 每月赚取,salary*3 想要赚 FROM employees ; ``` + + diff --git "a/25\351\231\210\344\275\263\347\202\234/9.13 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/25\351\231\210\344\275\263\347\202\234/9.13 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index 13f1e40ffdb580313e7d777e0d23e9fe04efcecf..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/9.13 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,114 +0,0 @@ -# 作业 - - - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-13 17:26:56 */ -/*==============================================================*/ - -create database hospital charset utf8; -use hospital; - -drop table if exists cure; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists grab; - -drop table if exists patient; - -/*==============================================================*/ -/* Table: cure */ -/*==============================================================*/ - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor #医生 -( - d_id int(2) not null auto_increment, # 医生编号 - d_name varchar(5) not null, # 医生姓名 - d_type varchar(10) not null, # 医生类型 - d_sex varchar(2) not null, # 医生性别 - d_age varchar(2) not null, # 医生年龄 - primary key (d_id) -); -insert into doctor (d_id,d_name,d_type,d_sex,d_age) values -('1','陈佳炜','胃科','男','18'), -('2','林俊伟','妇产科','女','18'), -('3','代瑞','脑科','男','18'); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug #药品 -( - dr_id int(2) not null auto_increment, # 药品编号 - dr_name varchar(5) not null, # 药品名称 - primary key (dr_id) -); -insert into drug (dr_id,dr_name) values -('1','止泻药'), -('2','阿司匹林'), -('3','胃炎药'); - -/*==============================================================*/ -/* Table: grab */ -/*==============================================================*/ - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient #病人 -( - p_id int(2) not null auto_increment, #病人病号 - p_name varchar(5) not null, #病人姓名 - p_symptom varchar(10) not null, #病人症状 - p_sex varchar(2) not null, #病人性别 - p_age varchar(2) not null, #病人年龄 - primary key (p_id) -); -insert into patient (p_id,p_name,p_symptom,p_sex,p_age) values -('1','张三','头疼','男','18'), -('2','李四','肚子疼','男','18'), -('3','王五','胃炎','男','18'); -create table cure #开药单 -( - p_id int not null, #病人病号 - d_id int not null, #医生编号 - primary key (p_id, d_id) -); - -insert into cure (p_id,d_id)values -('1','2'), -('2','1'), -('3','1'); -create table grab #抓 -( - p_id int not null, #病人病号 - dr_id int not null, #药品编号 - primary key (p_id, dr_id) -); -insert into grab (p_id,dr_id) values -('1','2'), -('2','1'), -('3','3'); -alter table cure add constraint FK_cure foreign key (p_id) - references patient (p_id) on delete restrict on update restrict; - -alter table cure add constraint FK_cure2 foreign key (d_id) - references doctor (d_id) on delete restrict on update restrict; - -alter table grab add constraint FK_grab foreign key (p_id) - references patient (p_id) on delete restrict on update restrict; - -alter table grab add constraint FK_grab2 foreign key (dr_id) - references drug (dr_id) on delete restrict on update restrict; - - -``` - diff --git "a/25\351\231\210\344\275\263\347\202\234/9.17\344\275\234\344\270\232.md" "b/25\351\231\210\344\275\263\347\202\234/9.17\344\275\234\344\270\232.md" deleted file mode 100644 index 0c05e2835758d155ce2a06c7d0b53302120e5068..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/9.17\344\275\234\344\270\232.md" +++ /dev/null @@ -1,113 +0,0 @@ -# 作业 - - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/17 18:36:59 */ -/*==============================================================*/ -CREATE database autohome charset utf8; - -use autohome; - -drop table if exists car; - -drop table if exists client; - -drop table if exists market; - -drop table if exists salesman; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - c_id int not null,-- 型号 - c_color varchar(5) not null,-- 颜色 - c_brand varchar(5) not null,-- 品牌 - c_pride varchar(6) not null,-- 价格 - primary key (c_id) -); -INSERT INTO car VALUES -(1,'白色','比亚迪','123456'), -(2,'黑色','丰田','234567'), -(3,'粉色','QQ飞车','345678'), -(4,'蓝色','奥迪','456789'); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - cl_id int(2) not null auto_increment,-- 顾客编号 - cl_name varchar(5) not null,-- 顾客姓名 - cl_sex varchar(2) not null,-- 顾客性别 - cl_age varchar(2) not null,-- 顾客年龄 - primary key (cl_id) -); -INSERT INTO client VALUES -(1,'刘德华','男','51'), -(2,'王哥','男','66'), -(3,'陈信文','男','31'), -(4,'陈小美','女','21'); -/*==============================================================*/ -/* Table: market */ -/*==============================================================*/ -create table market -( - m_date varchar(8) not null,-- 销售日期 - m_id int(2) not null auto_increment,-- 销售单号 - c_id int not null,-- 型号 - cl_id int not null,-- 顾客编号 - primary key (m_id) -); -INSERT into market VALUES -('20230915',1,1,1), -('20230917',2,2,2), -('20230919',3,3,3), -('20230920',4,4,4); -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - s_id int(2) not null auto_increment,-- 员工编号 - m_id int not null,-- 销售单号 - s_name varchar(5) not null,-- 员工姓名 - s_sex varchar(2) not null,-- 员工性别 - s_age varchar(2) not null,-- 员工年龄 - primary key (s_id) -); -INSERT into salesman VALUES -(1,1,'李少波','男','28'), -(2,2,'曹贼','男','30'), -(3,3,'流氓瑞','女','21'), -(4,4,'陈鸿飞','男','31'); -alter table market add constraint FK_Relationship_1 foreign key (c_id) - references car (c_id) on delete restrict on update restrict; - -alter table market add constraint FK_Relationship_2 foreign key (cl_id) - references client (cl_id) on delete restrict on update restrict; - -alter table salesman add constraint FK_Relationship_3 foreign key (m_id) - references market (m_id) on delete restrict on update restrict; - --- 1.查询特定销售员的销售记录 -select * from salesman s INNER JOIN market m on s.m_id = m.m_id; - -- 2.查找销售记录中销售价格最高的汽车 - SELECT c_brand,c_pride FROM car c INNER JOIN market m left join salesman s on c.c_id=m.c_id where m.m_id=s.m_id and c_pride=(select max(c_pride) from car); - - -- 3.统计某个销售员的销售总额 -SELECT s_name,sum(c_pride) FROM salesman s join market m join car c on s.m_id=m.m_Id and c.c_id=m.c_id GROUP BY s.s_name having s.s_name='曹贼'; - - -- 4.根据客户信息查询其购买过的汽车 - SELECT cl_name,cl_sex,c_pride,c_brand from client cl join market m join car c on cl.cl_id and m.c_id = c.c_id where cl.cl_name = '陈信文'; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - SELECT c_brand,count(m.c_id),sum(c.c_pride) FROM market m join car c on m.c_id GROUP BY c_brand; - -- 6.检索特定日期范围内的销售了哪些汽车 - SELECT - -- 7.查找某车型的销售历史。 - SELECT - -- 8.统计每个销售员的销售数量 - SELECT s_name,count(m.c_id) FROM salesman s JOIN market m join car c on s.m_id=m.m_id and c.c_id=m.c_id GROUP BY s.s_name; \ No newline at end of file diff --git "a/25\351\231\210\344\275\263\347\202\234/9.18\347\273\203\344\271\240.md" "b/25\351\231\210\344\275\263\347\202\234/9.18\347\273\203\344\271\240.md" deleted file mode 100644 index f32a7125c9a21880b09dbdf85ea2ca5a358e5b12..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/9.18\347\273\203\344\271\240.md" +++ /dev/null @@ -1,630 +0,0 @@ -1.查询所有员工12个月的工资总和,并起别名为工资总和 - - -``` - SELECT - sum( salary * 12 ) 工资总和 - FROM - employees; -``` - -#理解1:计算12月的基本工资 -# - -``` -SELECT sum(salary*12) as 工资总和 FROM employees; -``` - -#理解2:计算12月的基本工资和奖金 - -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - SELECT - sum( salary * 12 ), - sum( - ifnull( salary * 12 * commission_pct, 0 )) - FROM - employees; -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - - -``` - SELECT DISTINCT - job_id - FROM - employees; -``` - - -# 3.查询工资大于12000的员工姓名和工资 - SELECT - last_name, - salary - FROM - employees - WHERE - salary > 12000; -# 4.查询员工号为176的员工的姓名和部门号 - SELECT - last_name, - department_id - FROM - employees - WHERE - employee_id = 176; -#; -# 5.显示表 departments 的结构,并查询其中的全部数据 - DESC departments; - SELECT - * - FROM - departments; -# 第04章_运算符课后练习 -# 1.选择工资不在5000到12000的员工的姓名和工资 - SELECT - last_name, - salary - FROM - employees - WHERE - salary NOT BETWEEN 5000 - AND 12000; -# 2.选择在20或50号部门工作的员工姓名和部门号 - SELECT - last_name, - department_id - FROM - employees - WHERE - department_id = 20 - OR department_id = 50; -# 3.选择公司中没有管理者的员工姓名及job_id - SELECT - last_name, - job_id - FROM - employees - WHERE - manager_id IS NULL; -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - SELECT - last_name, - salary, - salary * commission_pct, - g.grade_level - FROM - employees e - JOIN job_grades g ON e.salary * commission_pct BETWEEN g.lowest_sal - AND g.highest_sal - WHERE - commission_pct IS NOT NULL; -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - SELECT - * - FROM - employees - WHERE - last_name LIKE '__尔'; -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - SELECT - * - FROM - employees - WHERE - last_name LIKE '%尔%特%' - OR last_name LIKE '%特%尔%'; -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - SELECT - * - FROM - employees - WHERE - first_name LIKE '%尔'; -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - SELECT - * - FROM - employees - WHERE - department_id BETWEEN 80 - AND 100; -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - SELECT - * - FROM - employees - WHERE - manager_id IN ( 100, 101, 110 ); -#第05章_排序与分页的课后练习 -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - - -``` - SELECT - salary * 12 - FROM - employees - ORDER BY - salary * 12 DESC; -``` - -​ # -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -​ - -``` - SELECT - * - FROM - employees - WHERE - salary NOT BETWEEN 8000 - AND 17000 - ORDER BY - salary DESC - LIMIT 2,20; -``` - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - - -``` - SELECT - * - FROM - employees - WHERE - email LIKE '%e%' - ORDER BY - length( email ) DESC, - department_id ASC; -``` - - -# 第06章_多表查询的课后练习 -# 1.显示所有员工的姓名,部门号和部门名称。 - SELECT - e.last_name, - d.department_id, - d.department_name - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id; -# 2.查询90号部门员工的job_id和90号部门的location_id - SELECT - * - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - WHERE - d.department_id = 90; -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - SELECT - e.last_name, - d.department_name, - l.location_id, - l.city - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - LEFT JOIN locations l ON d.location_id = l.location_id - WHERE - e.commission_pct IS NOT NULL; -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - SELECT - e.last_name, - e.job_id, - d.department_id, - d.department_name - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - LEFT JOIN locations l ON d.location_id = l.location_id - WHERE - l.city = '多伦多'; -#sql92语法(自然连接): -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - SELECT - * - FROM - departments d - LEFT JOIN employees e ON d.department_id = e.department_id - WHERE - d.department_name = '行政部'; - SELECT - * - FROM - departments d, - employees e - WHERE - d.department_id = e.department_id - AND d.department_name = '行政部'; -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - - -``` - SELECT - e.first_name 员工姓名, - e.employee_id 员工号, - s.last_name 上级姓名, - s.employee_id 上级员工号 - FROM - employees e - INNER JOIN employees s ON e.employee_id = s.employee_id; -``` - - -# 7.查询哪些部门没有员工 - SELECT - * - FROM - departments d - LEFT JOIN employees e ON d.department_id = e.department_id - WHERE - d.manager_id IS NULL; -# 8. 查询哪个城市没有部门 - SELECT - * - FROM - locations l - LEFT JOIN departments d ON l.location_id = d.location_id - WHERE - d.department_id IS NULL; -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - SELECT - * - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - WHERE - d.department_name = '销售部' - OR d.department_name = '信息技术部'; -# 第08章_聚合函数的课后练习 -#2.查询公司员工工资的最大值,最小值,平均值,总和 - - -``` - SELECT - max( salary ), - min( salary ), - avg( salary ), - sum( salary ) - FROM - employees; -``` - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - - -``` - SELECT - max( salary ), - min( salary ), - avg( salary ), - sum( salary ), - job_id - FROM - employees - GROUP BY - job_id; -``` - -#4.选择各个job_id的员工人数 - - -``` - SELECT - count( job_id ) - FROM - employees; -``` - - -# 5.查询员工最高工资和最低工资的差距 - SELECT - max( salary )- min( salary ) differnce - FROM - employees; -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - SELECT - min( salary ) 最低工资, - manager_id - FROM - employees - GROUP BY - manager_id - HAVING - 最低工资 >= 6000 - AND manager_id IS NOT NULL; -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - SELECT - department_id, - count( employee_id ), - avg( salary ) - FROM - employees - GROUP BY - department_id - ORDER BY - avg( salary ) DESC; -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - SELECT - min( salary ), - d.department_id, - d.department_name, - e.job_id - FROM - employees e - INNER JOIN departments d ON e.department_id = d.department_id - GROUP BY - department_id, - job_id; -# 第09章_子查询的课后练习 -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - - -``` - SELECT - last_name, - salary - FROM - employees - WHERE - department_id =( - SELECT - department_id - FROM - employees - WHERE - last_name = '兹洛特基' - ); -``` - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - - -``` - SELECT - * - FROM - employees - WHERE - salary >( - SELECT - avg( salary ) - FROM - employees - ); -``` - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - - -``` - SELECT - last_name, - job_id, - salary - FROM - employees - WHERE - salary > ALL ( SELECT salary FROM employees WHERE job_id = 'SA_MAN' ); -``` - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - - -``` - SELECT - employee_id, - last_name - FROM - employees - WHERE - department_id = ANY ( SELECT department_id FROM employees WHERE email LIKE '%u%' ); -``` - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - - -``` - SELECT - department_id - FROM - employees - WHERE - department_id IN ( SELECT department_id FROM departments WHERE location_id = 1700 ); -``` - -#6.查询管理者是 金 的员工姓名和工资 - - -``` - SELECT - last_name, - salary - FROM - employees - WHERE - manager_id IN ( SELECT employee_id FROM employees WHERE last_name = '金' ); -``` - -#7.查询工资最低的员工信息: last_name, salary - - -``` - SELECT - last_name, - salary - FROM - employees - WHERE - salary = ( SELECT min( salary ) FROM employees ) -``` - -#8.查询平均工资最低的部门信息 - - -``` - SELECT - * - FROM - departments - WHERE - department_id = ( SELECT department_id FROM employees GROUP BY department_id HAVING AVG( salary ) <= ALL ( SELECT AVG( salary ) FROM employees GROUP BY department_id ) ); -``` - - -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - -``` - -``` - -#10.查询平均工资最高的 job 信息 - - -``` - SELECT - * - FROM - jobs - WHERE - job_id = ( SELECT job_id FROM employees GROUP BY job_id HAVING AVG( salary ) >= ALL ( SELECT AVG( salary ) FROM employees GROUP BY job_id ) ); -``` - -#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 -#11.查询平均工资高于公司平均工资的部门有哪些? - - -``` - SELECT - department_id - FROM - employees - WHERE - department_id IS NOT NULL - GROUP BY - department_id - HAVING - AVG( salary ) > ( SELECT AVG( salary ) FROM employees ); -``` - -#12.查询出公司中所有 manager 的详细信息 - - -``` - SELECT - employee_id, - last_name, - salary - FROM - employees - WHERE - employee_id IN ( SELECT DISTINCT manager_id FROM employees ); -``` - -#方式1:自连接 自己连自己 -#方式2:子查询 -#员工编号=(管理员编号有哪些) -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - - -``` - SELECT - * - FROM - employees - WHERE - department_id = 10; -``` - -​ #方式: -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - - -``` - SELECT - department_id - FROM - departments - WHERE - department_id NOT IN ( SELECT DISTINCT department_id FROM employees WHERE job_id = 'ST_CLERK' ); -``` - -#16. 选择所有没有管理者的员工的last_name - - -``` - SELECT - last_name - FROM - employees e1 - WHERE - NOT EXISTS ( SELECT * FROM employees e2 WHERE e1.manager_id = e2.employee_id ); -``` - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - - -``` - SELECT - employee_id, - last_name, - hire_date, - salary - FROM - employees - WHERE - manager_id = ( SELECT employee_id FROM employees WHERE last_name = 'De Haan' ); -``` - - -​ #方式2: -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) -#方式1:使用相关子查询 -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - - -``` - SELECT - department_name, - department_id - FROM - departments d - WHERE - 5 < ( SELECT COUNT(*) FROM employees e WHERE d.department_id = e.department_id ); -``` - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - * - -``` - SELECT - country_id - FROM - locations l - WHERE - 2 < ( SELECT COUNT(*) FROM departments d WHERE l.`location_id` = d.`location_id` ); -``` - -* -/* \ No newline at end of file diff --git "a/25\351\231\210\344\275\263\347\202\234/9.21\347\273\203\344\271\240.md" "b/25\351\231\210\344\275\263\347\202\234/9.21\347\273\203\344\271\240.md" deleted file mode 100644 index 58f331805eef107bc01b15dbb2b208db7820aa2e..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/9.21\347\273\203\344\271\240.md" +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:30:59 */ -/*==============================================================*/ -create database homework charset utf8; - -use homework; - -drop table if exists power; - -drop table if exists role; - -drop table if exists role_power; - -drop table if exists user; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: power */ -/*==============================================================*/ -create table power -( - power_id int not null auto_increment, -- 权限编号 - power_name varchar(10) not null, -- 权限名称 - power_add varchar(20) not null, -- 权限地址 - primary key (power_id) -); - -INSERT INTO power VALUES -(1,'首页','www.mxdx.com'), -(2,'学生信息','www.mxdx.com/student'), -(3,'教师信息','www.mxdx.com/teacher'), -(4,'工资信息','www.mxdx.com/salary'); -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, -- 角色编号 - role_name varchar(5) not null, -- 角色名称 - primary key (role_id) -); - -INSERT into role VALUES -(1,'校长'), -(2,'老师'), -(3,'学生'); -/*==============================================================*/ -/* Table: role_power */ -/*==============================================================*/ -create table role_power -( - power_id int not null, -- 权限编号 - role_id int not null, -- 角色编号 - primary key (power_id, role_id) -); - -INSERT into role_power VALUES -(1,1), -(2,1), -(3,1), -(4,1), -(1,2), -(2,2), -(3,2), -(1,3), -(2,3); -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table `user` -( - user_id int not null auto_increment, -- 用户编号 - user_name varchar(10) not null, -- 用户昵称 - user_pwd varchar(10) not null, -- 用户密码 - primary key (user_id) -); - -INSERT into `user` VALUES -(1,'流氓瑞','88888888'), -(2,'曹贼','77777777'), -(3,'富贵','22222222'), -(4,'瓜吻橙','11111111'), -(5,'消肿开焊','33333333'); -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - role_id int not null, -- 角色编号 - user_id int not null, -- 用户编号 - primary key (role_id, user_id) -); - -INSERT into user_role VALUES -(1,1), -(2,2), -(3,3), -(3,4); -alter table role_power add constraint FK_role_power foreign key (power_id) - references power (power_id) on delete restrict on update restrict; - -alter table role_power add constraint FK_role_power2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - - · · - - -​ \ No newline at end of file diff --git "a/25\351\231\210\344\275\263\347\202\234/9.22\344\275\234\344\270\232\347\273\203\344\271\240.md" "b/25\351\231\210\344\275\263\347\202\234/9.22\344\275\234\344\270\232\347\273\203\344\271\240.md" deleted file mode 100644 index 29bfa87a91c2e2f08bdf1373f8e787a684d413ee..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/9.22\344\275\234\344\270\232\347\273\203\344\271\240.md" +++ /dev/null @@ -1,144 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-22 08:44:25 */ -/*==============================================================*/ -create database marui charset utf8; -use marui; - -drop table if exists category; - -drop table if exists host; - -drop table if exists paramete; - -drop table if exists specify; - -drop table if exists together; - -/*==============================================================*/ -/* Table: category */ -/*==============================================================*/ -create table `host` # 主机 -( - host_id int not null auto_increment, #主机编号 - host_name varchar(10) not null, #主机名称 - host_indetail text not null, #主机详细 - primary key (host_id) -); -insert into `host` values -(1,'联想','联想,连想都不敢想'), -(2,'华硕','华硕品质,坚若磐石 感动世界的科技'), -(3,'华为','遥遥领先!遥遥领先!遥遥领先!'); -/*==============================================================*/ -/* Table: host */ -/*==============================================================*/ -create table specify #规格 -( - sp_id int not null auto_increment, #规格编号 - host_id int not null, #主机编号 - sp_title varchar(50) not null, #规格标题 - sp_price DOUBLE(9,2) not null, #规格价格 - sp_stock int not null, #规格库存 - primary key (sp_id) -); -insert into specify values -(1,1,'拯救者Y9000P i9-13900k 4090猛禽 宏碁16×2 雷神1200W',39823.00,1), -(2,1,'小新十四2023 R5-5500 5600xt 海力士8×2 长城65W',4999.00,5), -(3,2,'玩家国度 i9-13900H 4090猛禽 宏碁16×2 酷冷900W',24993.00,0), -(4,3,'MateBoos i7-1360P 核显 宏碁16×2 长城65W',9900.00,100); -/*==============================================================*/ -/* Table: paramete */ -/*==============================================================*/ -create table category #品类 -( - cat_id int not null auto_increment, - cat_name varchar(10) not null, - primary key (cat_id) -); -insert into category values -(1,'CPU'), -(2,'显卡'), -(3,'内存'), -(4,'电源'); -/*==============================================================*/ -/* Table: specify */ -/*==============================================================*/ -create table paramete #参数 -( - pa_id int not null auto_increment, #参数编号 - pa_name varchar(10) not null, #参数名称 - primary key (pa_id) -); -insert into paramete values -(1,'i9-13900k'), -(2,'R5-5500'), -(3,'i9-13900H'), -(4,'i7-1360P'), -(5,'4090猛禽'), -(6,'5600xt'), -(7,'核显'), -(8,'宏碁16×2'), -(9,'海力士8×2'), -(11,'雷神1200W'), -(12,'长城65W'), -(13,'酷冷900W'); -/*==============================================================*/ -/* Table: together */ -/*==============================================================*/ -create table together #关联 -( - to_id int not null auto_increment, #关联编号 - sp_id int not null, #规格编号 - cat_id int not null, #品类编号 - pa_id int not null, #参数编号 - primary key (to_id) -); -insert into together values -(1,1,1,1), -(2,1,2,5), -(3,1,3,8), -(4,1,4,11), -(5,2,1,2), -(6,2,2,6), -(7,2,3,9), -(8,2,4,12), -(9,3,1,3), -(10,3,2,5), -(11,3,3,8), -(12,3,4,13), -(13,4,1,4), -(14,4,2,7), -(15,4,3,8), -(16,4,4,12); - - - -alter table specify add constraint FK_Relationship_1 foreign key (host_id) - references host (host_id) on delete restrict on update restrict; - -alter table together add constraint FK_Relationship_2 foreign key (sp_id) - references specify (sp_id) on delete restrict on update restrict; - -alter table together add constraint FK_Relationship_3 foreign key (pa_id) - references paramete (pa_id) on delete restrict on update restrict; - -alter table together add constraint FK_Relationship_4 foreign key (cat_id) - references category (cat_id) on delete restrict on update restrict; - - -SELECT -DISTINCT h.host_name 品牌, - h.host_indetail 详细, - s.sp_title 电脑名, - s.sp_price 一般售价 -from - `host` h, - specify s, - together t, - paramete p, - category c -where - h.host_id=s.host_id and - s.sp_id=t.sp_id and - t.pa_id=p.pa_id and - t.cat_id=c.cat_id ; \ No newline at end of file diff --git "a/25\351\231\210\344\275\263\347\202\234/9.22\347\254\224\350\256\260.md" "b/25\351\231\210\344\275\263\347\202\234/9.22\347\254\224\350\256\260.md" deleted file mode 100644 index 81be85e559df6901ac5f56599d184f5376b9713b..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/9.22\347\254\224\350\256\260.md" +++ /dev/null @@ -1,11 +0,0 @@ -笔记 - -软件:PowerDesigner 的使用方法 - -1、创建概念模型(类型er图) CDM - -2、将概念模型转换成逻辑模型 LDM - -3、将逻辑模型转换成物理模型 PDM - -4用物理模型生成DDL代码 \ No newline at end of file diff --git "a/25\351\231\210\344\275\263\347\202\234/9.26\344\275\234\344\270\232.md" "b/25\351\231\210\344\275\263\347\202\234/9.26\344\275\234\344\270\232.md" deleted file mode 100644 index 7722ad1e6006868cc1cd14262aed0d766b3f3017..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/9.26\344\275\234\344\270\232.md" +++ /dev/null @@ -1,94 +0,0 @@ - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE VIEW employee_vu(LAST_NAME,EMPLOYEE_ID,DEPARTMENT_ID) as -SELECT LAST_NAME 姓名,EMPLOYEE_ID 员工号,DEPARTMENT_ID 部门号 -from employees; -SELECT * FROM employee_vu; - - -#2. 显示视图的结构 -desc employee_vu; -SELECT * from employee_vu; - -#3. 查询视图中的全部内容 -SELECT * FROM employee_vu; -show TABLES; - -#4. 将视图中的数据限定在部门号是80的范围内 -CREATE or replace view employee_vu(LAST_NAME,EMPLOYEE_ID,DEPARTMENT_ID) as -SELECT LAST_NAME 姓名,EMPLOYEE_ID 员工号,DEPARTMENT_ID 部门号 FROM employees -WHERE DEPARTMENT_ID BETWEEN 0 and 80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -CREATE or replace VIEW emp_v1 as -SELECT last_name 员工姓名,salary 工资,email 邮箱 -FROM employees -WHERE phone_number like '011%' -SELECT * FROM emp_v1; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -CREATE - OR REPLACE VIEW emp_v1 AS SELECT - last_name 员工姓名, - email 邮箱, - phone_number 电话号码, - salary 工资 -FROM - employees -WHERE - phone_number LIKE '011%' - AND email LIKE '%e%'; -SELECT - * -FROM - emp_v1; - -#3. 向 emp_v1 插入一条记录,是否可以? - -INSERT INTO emp_v1 VALUES -(207,'BO','caozei','JRUBSES','011.44.1344.421896','1994-08-17','FI_MGR',15000.00,NULL,101,100); - -#不可以 - - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -SELECT - * -FROM - emp_v1; -UPDATE emp_v1 -SET 工资 = 工资 + 1000; - - - -#5. 删除emp_v1中姓名为Olsen的员工 -DELETE FROM emp_v1 where 员工姓名='Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -CREATE VIEW emp_v2 as -SELECT max(salary) 最高工资,DEPARTMENT_ID 部门id -FROM employees -GROUP BY DEPARTMENT_ID -HAVING max(salary) > 12000; -SELECT * FROM emp_v2; - -#7. 向 emp_v2 中插入一条记录,是否可以? - -#不可以 - - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v2; -drop view emp_v1; diff --git "a/25\351\231\210\344\275\263\347\202\234/9.6\345\274\200\345\255\246\347\254\224\350\256\260.md" "b/25\351\231\210\344\275\263\347\202\234/9.6\345\274\200\345\255\246\347\254\224\350\256\260.md" deleted file mode 100644 index b4640814c65e19d963ccc53ed64ccb13af355aa3..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/9.6\345\274\200\345\255\246\347\254\224\350\256\260.md" +++ /dev/null @@ -1,4 +0,0 @@ -大二学习目标 - -以实践为主要目标,结合大一学习的理论。在大二更加认真听课,不懂及时问。 - diff --git "a/25\351\231\210\344\275\263\347\202\234/9.7\347\254\254\344\270\211\346\254\241\344\275\234\344\270\232\347\254\224\350\256\260.md" "b/25\351\231\210\344\275\263\347\202\234/9.7\347\254\254\344\270\211\346\254\241\344\275\234\344\270\232\347\254\224\350\256\260.md" deleted file mode 100644 index deb5f5b3d4189385bdc186c9540b553d1e0b1341..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/9.7\347\254\254\344\270\211\346\254\241\344\275\234\344\270\232\347\254\224\350\256\260.md" +++ /dev/null @@ -1,79 +0,0 @@ -# 笔记 - -数据库的范式 - -1.第一范式:要求字段的内容,不可分割,为的是保证数据的原子性。 - -2.第二范式:要求满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键要依赖整个联合主键),而不能只依赖部分。 - -3.第三范式:满足第二范式的前提上,要求非主键属性要直接依赖于主键。 - -# 练习 - -CREATE DATABASE task charset utf8; -use task; --- 学校 -CREATE TABLE college( -c_id int PRIMARY KEY auto_increment, -c_name VARCHAR(20), -c_tel char(11), -c_address VARCHAR(20) -); --- 专业 -CREATE TABLE major( -m_id int PRIMARY KEY auto_increment, -m_name VARCHAR(20), -c_id int, -FOREIGN KEY(c_id) REFERENCES college(c_id) -); --- 班级 -CREATE TABLE clazz( -cz_id int PRIMARY KEY auto_increment, -cz_name VARCHAR(20), -cz_grade VARCHAR(20), -m_id int, -FOREIGN KEY(m_id) REFERENCES major(m_id) -); - --- 教室 -CREATE TABLE classroom( -cr_id int PRIMARY KEY auto_increment, -cr_name VARCHAR(20) -); --- 教师 -CREATE TABLE teacher( -t_id int PRIMARY KEY auto_increment, -t_name VARCHAR(20), -c_id int, -FOREIGN KEY(c_id) REFERENCES college(c_id) -); --- 课程信息表 -CREATE TABLE message( -ms_id int PRIMARY KEY auto_increment, -ms_time VARCHAR(20) -); --- 课程表 -CREATE TABLE timetable( -tt_id int PRIMARY KEY auto_increment, -tt_name VARCHAR(20), -tt_credit int, -c_id int, -cr_id int, -t_id int, -ms_id int, -FOREIGN KEY(c_id) REFERENCES college(c_id), -FOREIGN KEY(cr_id) REFERENCES classroom(cr_id), -FOREIGN KEY(t_id) REFERENCES teacher(t_id), -FOREIGN KEY(ms_id) REFERENCES message(ms_id) -); --- 学生 -CREATE TABLE student( -s_id int PRIMARY KEY auto_increment, -s_name VARCHAR(20), -s_tel char(11), -s_grade VARCHAR(20), -cz_id int, -tt_id int, -FOREIGN KEY(cz_id) REFERENCES clazz(cz_id), -FOREIGN KEY(tt_id) REFERENCES timetable(tt_id) -); \ No newline at end of file diff --git "a/25\351\231\210\344\275\263\347\202\234/9.7\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232.md" "b/25\351\231\210\344\275\263\347\202\234/9.7\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232.md" deleted file mode 100644 index d47cec6b7bebed5509ad4a9e3c8406b2a4c7d798..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/9.7\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232.md" +++ /dev/null @@ -1,55 +0,0 @@ -# mysql第二课的笔记 - -建表:多对多的时候,引用第三张表,将前面两张表的主键拿来当第三张表的外键、 -一对多的时候,将一所在的表的主键放在多的表当外键 -一对一的时候,将一张表的主键放在另一张表当外键 -ER图 -概念:实体关系图, 是指以实体,关系,属性三个基本概念概括数据的基本结构,从而描述静态数据结构的概念格式 -要素:实体(表),属性(字段),和关系(类似外键) - -# 作业 - -create database student charset utf8; -use student; - -create table faculties( - fa_id int primary key, - fa_name varchar(20) not null -); - -insert into faculties values -(1,"软件工程学院"), -(2,"医学护理学院"), -(3,"信息工程学院"), -(4,"智能制造学院"); - -create table professional( - pr_id int primary key, - pr_name varchar(20) not null, - fa_id int, - foreign key(fa_id) references faculties(fa_id) -); - -insert into professional values -(1,"前端开发",1), -(2,"后端开发",1), -(3,"临床护理",2), -(4,"大数据技术",3), -(5,"电气自动化技术",4); - -create table classroom( -cl_id int PRIMARY KEY, -cl_name varchar(20) -); - -insert into classroom values -(1,'实训一'), -(2,'实训二'), -(3,'实训三'); - -reate table class( - c_id int primary key, - c_name varchar(20), - pr_id int, - foreign key (pr_id) references professional(pr_id) -); \ No newline at end of file diff --git "a/25\351\231\210\344\275\263\347\202\234/9\346\234\21012\346\227\245\344\275\234\344\270\232.md" "b/25\351\231\210\344\275\263\347\202\234/9\346\234\21012\346\227\245\344\275\234\344\270\232.md" deleted file mode 100644 index 8438cac9118d7288310a167011425036dd239053..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/9\346\234\21012\346\227\245\344\275\234\344\270\232.md" +++ /dev/null @@ -1,221 +0,0 @@ -# 作业 - - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 12:26:16 */ -/*==============================================================*/ -create database sxh charset utf8; - -use sxh; - -drop table if exists Relationship_5; - -drop table if exists Relationship_8; - -drop table if exists Relationship_9; - -drop table if exists address; - -drop table if exists audience; - -drop table if exists comment; - -drop table if exists directortable; - -drop table if exists language; - -drop table if exists list; - -drop table if exists movie; - -drop table if exists profile; - -drop table if exists review; - -drop table if exists type; - -/*==============================================================*/ -/* Table: Relationship_5 */ -/*==============================================================*/ -create table Relationship_5 -( - t_id int not null, - movieId int not null, - primary key (t_id, movieId) -); - -/*==============================================================*/ -/* Table: Relationship_8 */ -/*==============================================================*/ -create table Relationship_8 -( - movieId int not null, - l_id int not null, - primary key (movieId, l_id) -); - -/*==============================================================*/ -/* Table: Relationship_9 */ -/*==============================================================*/ -create table Relationship_9 -( - list_id int not null, - m_id int not null, - primary key (list_id, m_id) -); - -/*==============================================================*/ -/* Table: address */ -/*==============================================================*/ -create table address -( - ad_id int not null, - movieId int not null, - ad_name varchar(20) not null, - primary key (ad_id) -); - -/*==============================================================*/ -/* Table: audience */ -/*==============================================================*/ -create table audience -( - m_id int not null, - a_name varchar(20) not null, - a_tel char(11) not null, - primary key (m_id) -); - -/*==============================================================*/ -/* Table: comment */ -/*==============================================================*/ -create table comment -( - movieId int not null, - c_id char(10), - char(10), - char(10) -); - -/*==============================================================*/ -/* Table: directortable */ -/*==============================================================*/ -create table directortable -( - d_id int not null, - director varchar(20) not null, - d_name varchar(5) not null, - d_age varchar(3) not null, - d_add varchar(50) not null, - primary key (d_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - l_id int not null, - l_type varchar(20) not null, - primary key (l_id) -); - -/*==============================================================*/ -/* Table: list */ -/*==============================================================*/ -create table list -( - list_id int not null, - list_name varchar(20) not null, - recommend varchar(50) not null, - primary key (list_id) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movieId int not null, - m_id int, - director varchar(20) not null, - movieName varchar(20) not null, - "release" date not null, - duration time not null, - primary key (movieId) -); - -/*==============================================================*/ -/* Table: profile */ -/*==============================================================*/ -create table profile -( - director varchar(20) not null, - scripwriter varchar(20) not null, - actor varchar(20) not null, - score int not null, - primary key (director) -); - -/*==============================================================*/ -/* Table: review */ -/*==============================================================*/ -create table review -( - r_id int not null, - movieId int not null, - ranking int not null, - review varchar(100) not null, - primary key (r_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - t_id int not null, - action varchar(20) not null, - love varchar(20) not null, - science varchar(20) not null, - terror varchar(20) not null, - primary key (t_id) -); - -alter table Relationship_5 add constraint FK_Relationship_10 foreign key (movieId) - references movie (movieId) on delete restrict on update restrict; - -alter table Relationship_5 add constraint FK_Relationship_5 foreign key (t_id) - references type (t_id) on delete restrict on update restrict; - -alter table Relationship_8 add constraint FK_Relationship_11 foreign key (l_id) - references language (l_id) on delete restrict on update restrict; - -alter table Relationship_8 add constraint FK_Relationship_8 foreign key (movieId) - references movie (movieId) on delete restrict on update restrict; - -alter table Relationship_9 add constraint FK_Relationship_12 foreign key (m_id) - references audience (m_id) on delete restrict on update restrict; - -alter table Relationship_9 add constraint FK_Relationship_9 foreign key (list_id) - references list (list_id) on delete restrict on update restrict; - -alter table address add constraint FK_Relationship_3 foreign key (movieId) - references movie (movieId) on delete restrict on update restrict; - -alter table comment add constraint FK_Relationship_4 foreign key (movieId) - references movie (movieId) on delete restrict on update restrict; - -alter table directortable add constraint FK_Relationship_7 foreign key (director) - references profile (director) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_1 foreign key (m_id) - references audience (m_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_6 foreign key (director) - references profile (director) on delete restrict on update restrict; - -alter table review add constraint FK_Relationship_2 foreign key (movieId) - references movie (movieId) on delete restrict on update restrict; \ No newline at end of file diff --git "a/25\351\231\210\344\275\263\347\202\234/\344\271\235\346\234\210\344\272\214\345\215\201\344\270\200\344\275\234\344\270\232.md" "b/25\351\231\210\344\275\263\347\202\234/\344\271\235\346\234\210\344\272\214\345\215\201\344\270\200\344\275\234\344\270\232.md" deleted file mode 100644 index e7a6b275f223392aab6c33aab107bbb60b95d868..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/\344\271\235\346\234\210\344\272\214\345\215\201\344\270\200\344\275\234\344\270\232.md" +++ /dev/null @@ -1,97 +0,0 @@ - - -CREATE database jingdon charset utf8; - -use jingdon; - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 17:13:58 */ -/*==============================================================*/ - - -drop table if exists attribute; - -drop table if exists attribute_value; - -drop table if exists sku; - -drop table if exists sku_attribute; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table attribute -- 属性 -( - at_id int not null, -- 属性编号 - at_name varchar(10) not null, -- 属性名称 - primary key (at_id) -); - -/*==============================================================*/ -/* Table: attribute_value */ -/*==============================================================*/ -create table attribute_value -- 参数 -( - value_id int not null, -- 参数编号 - value_content varchar(50) not null, -- 目录 - primary key (value_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -- 产品信息 -( - sku_id int not null, -- 产品编号 - spu_id int not null, -- 关联编号 - sku_name varchar(10) not null, -- 产品名称 - sku_title varchar(10) not null, -- 产品标题 - sku_price varchar(6) not null, -- 产品价格 - sku_stock int not null, -- 产品库存 - primary key (sku_id) -); - -INSERT into sku VALUES -(,,'联想拯救者','拯救者512g黑色','6999',0), -(,,'联想拯救者','拯救者512g白色','6999',0), -(,,'联想拯救者','拯救者1t黑色','7999',10), -(,,'联想拯救者','拯救者1t白色','7999',5); -/*==============================================================*/ -/* Table: sku_attribute */ -/*==============================================================*/ -create table sku_attribute -- 产品属性 -( - re_vance int not null, -- 关联编号 - sku_id int not null, -- 产品编号 - at_id int not null, -- 属性编号 - value_id int not null, -- 参数编号 - primary key (re_vance) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -- 商品信息 -( - spu_id int not null, -- 商品编号 - spu_name varchar(10) not null, -- 产品编号 - spu_detali varchar(10) not null, -- 商品名称 - primary key (spu_id) -); -INSERT INTO spu VALUES -(,,'拯救者y9000p','真他娘好用'), -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -alter table sku_attribute add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table sku_attribute add constraint FK_Relationship_3 foreign key (at_id) - references attribute (at_id) on delete restrict on update restrict; - -alter table sku_attribute add constraint FK_Relationship_4 foreign key (value_id) - references attribute_value (value_id) on delete restrict on update restrict; \ No newline at end of file diff --git "a/25\351\231\210\344\275\263\347\202\234/\345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" "b/25\351\231\210\344\275\263\347\202\234/\345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index 0b3206c250aacc3cac852a1d7f301b3cab1e8f84..0000000000000000000000000000000000000000 --- "a/25\351\231\210\344\275\263\347\202\234/\345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,109 +0,0 @@ -# 笔记 - - 第一步:创建概念模型(类似ER图) CDM (用户角度) - - 第二步:转换成逻辑模型 LDM (计算机角度) - - 第三步:转换成物理模型 PDM (数据库角度) - - 第四步:生成DDL - -# 数据库设计步骤 - - 1.需求分析,了解要开发的系统的需求,明确数据和格式 - - 2.概念结构设计:将需求分析得到的抽象成概念模型,将ER图向关系模型转化 - - 3.逻辑结构设计:将概念结构转化成DBMS所支持的数据模型 - - 4.物理结构设计:将概念模型,转换成选定数据库管理系统需要的物理模型 - - 5.数据库实施:根据物理模型生成对应的DDL - - 6.数据库维护 - -# 作业 - -CREATE DATABASE libary; - -DROP TABLE IF EXISTS Class_User; -CREATE TABLE Class_User( -classNo int NOT NULL PRIMARY KEY, -cname VARCHAR(20) NOT NULL UNIQUE, -term int NOT NULL default 30, -ceilingNum int NOT NULL -); - -DROP TABLE IF EXISTS BookInfo; -CREATE TABLE BookInfo( -ISBN CHAR(13) NOT NULL PRIMARY KEY, -bname VARCHAR(60) NOT NULL, -author VARCHAR(30) NOT NULL, -press VARCHAR(40) NOT NULL, -price FLOAT NOT NULL, -language VARCHAR(20) DEFAULT '中文', -pages int -); - -DROP TABLE IF EXISTS Books; -CREATE TABLE Books( -bookNo CHAR(9) PRIMARY KEY, -ISBN CHAR(13), -location VARCHAR(40) , -bstatus CHAR(1), -ctr_no int, -CHECK(bstatus='0' OR bstatus='1' OR bstatus='2' OR bstatus='3'), -FOREIGN KEY (ISBN) REFERENCES BookInfo(ISBN) -); - -DROP TABLE IF EXISTS Users; -CREATE TABLE Users( -loanNo VARCHAR(16) NOT NULL PRIMARY KEY, -lname VARCHAR(30) NOT NULL, -pwd VARCHAR(16) NOT NULL, -unitName VARCHAR(50) NOT NULL, -registerDate date NOT NULL, -classNo int NOT NULL, -email VARCHAR(40) -); - -DROP TABLE IF EXISTS Loan; -CREATE TABLE Loan( -bookNo CHAR(9) NOT NULL PRIMARY KEY, -loanNo VARCHAR(16)NOT NULL, -borrowDate DATETIME NOT NULL, -FOREIGN KEY(loanNo) REFERENCES Users(loanNo), -FOREIGN KEY(bookNo) REFERENCES Books(bookNo) -); - -DROP TABLE IF EXISTS LoanHist; -CREATE TABLE LoanHist( -loanNo VARCHAR(16) NOT NULL, -bookNo CHAR(9) NOT NULL, -borrowDate DATETIME NOT NULL, -returnDate DATETIME NOT NULL, -primary key(bookNo,loanNo,borrowDate), -foreign key(bookNo) references Books(bookNo), -foreign key(loanNo) references Users(loanNo) -); - -DROP TABLE IF EXISTS Reservation; -CREATE TABLE Reservation( -ISBN CHAR(13) NOT NULL, -loanNo VARCHAR(16) NOT NULL, -reservation_Date DATETIME NOT NULL, -rsratus CHAR(1) NOT NULL, -primary key(ISBN,loanNo,reservation_Date), -foreign key(ISBN) references BookInfo(ISBN), -foreign key(loanNo) references Users(loanNo) -); - -DROP TABLE IF EXISTS Money; -CREATE TABLE Money( -ID int NOT NULL AUTO_INCREMENT PRIMARY KEY, -loanNo VARCHAR(16) NOT NULL, -bookNo CHAR(9), -amount FLOAT , -reason ENUM('过期罚款','损坏赔偿','丢失赔偿','办证费','办证押金'), -billdate DATETIME NOT NULL -); \ No newline at end of file diff --git "a/27 \346\235\250\346\242\205/MySQL\347\232\204\345\244\215\344\271\240.txt" "b/27 \346\235\250\346\242\205/MySQL\347\232\204\345\244\215\344\271\240.txt" deleted file mode 100644 index 96fb66e62367f8538d384340b327a7d873ea655d..0000000000000000000000000000000000000000 --- "a/27 \346\235\250\346\242\205/MySQL\347\232\204\345\244\215\344\271\240.txt" +++ /dev/null @@ -1,267 +0,0 @@ -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -select salary*12 工资总和 from employees; -#理解1:计算12月的基本工资 - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 -select sum(salary*12) as 工资总和 FROM employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct -select distinct job_id,employee*from employees; - -# 3.查询工资大于12000的员工姓名和工资 -select last_name,salary from employees where salary > 12000; - -# 4.查询员工号为176的员工的姓名和部门号 -select last_name,department_id from employees where employee_id = 176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -select last_name,salary from employees where salary < 5000 or salary > 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 -select last_name,department_id from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id -select emp.last_name,emp.job_id from employees emp join departments dep on emp.department_id=dep.department_id where emp.manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -select * from employees where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 -select last_name from employees where last_name like '__尔%'; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -select last_name from employees where last_name like '%特%尔%' or last_name like '%尔%特%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -select * from employees where first_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -select last_name,job_title,department_id from employees join jobs on employees.job_id=jobs.job_id where department_id in (80,100); - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -select last_name,salary,manager_id from employees where manager_id in (100,101,110); - - -#第05章_排序与分页的课后练习 - - -# 1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select last_name,department_id,(salary+salary * IFNULL(commission_pct,0))*12 from employees ; - -# 2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -select last_name,salary from employees where salary <8000 or salary>17000 ORDER BY salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select employees.*,email,length(email) 字节数 from employees where email like '%e%' order by 字节数 desc,department_id asc; - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 -select e.last_name,e.department_id,d.department_name from employees e left join departments d on e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id -select e.job_id,d.location_id,d.department_id from employees e left join departments d on e.department_id=d.department_id where d.department_id=90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city -select e.last_name , d.department_name , l.location_id , city from employees e -left join departments d on e.department_id=d.department_id -left join locations l on l.location_id=d.location_id; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -select e.last_name,e.job_id,d.department_id,d.department_name,city from employees e -left join departments d on e.department_id=d.department_id -left join locations l on l.location_id=d.location_id where city='多伦多'; - -#sql92语法(自然连接): - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 -select dep.department_name 部门名称,loc.street_address 部门地址,emp.last_name 姓名,jobs.job_title 工作, emp.salary 工资 from employees emp -left join jobs on emp.job_id=jobs.job_id -left join departments dep on emp.department_id=dep.department_id -left join locations loc on dep.location_id=loc.location_id -where department_name='行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 -select a.last_name,a.employee_id,b.last_name,b.employee_id from employees a inner join employees b on a.employee_id=b.manager_id; - -# 7.查询哪些部门没有员工 -select d.department_name from employees e right join departments d on e.department_id=d.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 -select city from departments dep right join locations loc on dep.location_id=loc.location_id where department_id is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -select * from employees e join departments d on e.department_id=d.department_id where department_name in ('销售部','信息技术部'); - -# 第08章_聚合函数的课后练习 - - -# 2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees; - -# 3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -select job_id,max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees GROUP BY job_id; - -# 4.查询各个job_id的员工人数 -select job_id,count(job_id) from employees GROUP BY job_id; - -# 5.查询员工最高工资和最低工资的差距 -select max(salary)-min(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 -select * from employees where manager_id is not null group by manager_id having min(salary)>=6000; - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 -select d.department_name 部门名称,d.location_id 地点编号,count(employee_id) 员工数量,avg(salary) 平均工资 from employees e left join departments d on e.department_id=d.department_id GROUP by d.department_id ORDER BY 平均工资 desc; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 -select job_title,department_name,min(salary) from employees emp -left join departments dep on emp.department_id=dep.department_id -left join jobs on emp.job_id=jobs.job_id group by job_title,department_name; - -# 第09章_子查询的课后练习 - - -# 1.查询和 兹洛特基 相同部门的员工姓名和工资 -select department_id from employees where last_name='兹洛特基'; -select last_name,salary from employees where department_id=(select department_id from employees where last_name='兹洛特基'); - -# 2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -select avg(salary) from employees; -select employee_id,last_name,salary from employees where salary>(select avg(salary) from employees); - -# 3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary -select max(salary) from employees left join jobs on employees.job_id=jobs.job_id where jobs.job_id='SA_MAN'; -select employees.last_name, jobs.job_id, employees.salary from employees left join jobs on employees.job_id=jobs.job_id where salary>(select max(salary) from employees left join jobs on employees.job_id=jobs.job_id where jobs.job_id='SA_MAN'); - -# ! 4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 -SELECT department_id FROM employees where last_name like '%u%' or first_name like '%u%'; - - -# 5.查询部门的location_id为1700的部门的工作的员工的员工号 -select d.department_id from employees e right join departments d on e.department_id=d.department_id where location_id=1700 GROUP BY d.department_id; -select employee_id from employees e left join departments d on e.department_id=d.department_id where e.department_id in (select d.department_id from employees e right join departments d on e.department_id=d.department_id where location_id=1700 GROUP BY d.department_id); - -# 6.查询管理者是 金 的员工姓名和工资 -select employee_id from employees where last_name='金'; -select last_name,salary from employees where manager_id in (select employee_id from employees where last_name='金'); - -# 7.查询工资最低的员工信息: last_name, salary -select min(salary) from employees; -select last_name, salary from employees where salary=(select min(salary) from employees); - -# 8.查询平均工资最低的部门信息 -select * from employees a left join departments b on a.department_id=b.department_id where salary=(select min(salary)from employees); - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - -# 9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -select b.*,avg(salary) from employees a left join departments b on a.department_id=b.department_id where salary=(select min(salary) from employees) group by department_id; - -# 10.查询平均工资最高的 job 信息 -select avg(salary) from employees; -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 -select jobs.job_id,avg(salary) from employees left join jobs on employees.job_id=jobs.job_id GROUP BY job_id; -select * from employees a left join jobs b on a.job_id=b.job_id group by b.job_id having salary=(select max(salary) from employees) ; - -# 11.查询平均工资高于公司平均工资的部门有哪些? -select department_id,avg(salary) from employees group by department_id having avg(salary)>(select avg(salary) from employees) ; - -# 12.查询出公司中所有 manager 的详细信息 - -select * from employees a left join employees b on a.employee_id=b.manager_id; -#方式1:自连接 自己连自己 - - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - - - - -# 13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? -select department_id,min(最高工资) from (select max(salary) 最高工资,department_id from employees group by department_id) as a group by department_id; - - -#方式: - - -# 14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -select avg(salary) 平均工资 from employees group by department_id ; -select last_name,department_id,email,salary from employees group by department_id having avg(salary)=(select max(平均工资)from (select avg(salary) 平均工资 from employees group by department_id) as a); - - -# 15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: -select department_id from employees where job_id !='ST_CLERK'; - -# 16. 选择所有没有管理者的员工的last_name -select last_name from employees where manager_id is null; - - -# 17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: -#方式2: - -# 18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 -select avg(salary) 平均工资,department_id from employees group by department_id; -select * from employees a left join (select avg(salary) 平均工资,department_id from employees group by department_id) -b on a.department_id=b.department_id where a.salary>b.平均工资; - -#方式2:在FROM中声明子查询 - - - -# 19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -select department_id from employees group by department_id having count(department_id)>5; -select * from departments where department_id in(select department_id from employees group by department_id having count(department_id)>5); - - -# 20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) -select country_id,count(department_id) from departments a left join locations b on a.location_id=b.location_id group by country_id -having count(department_id)>2; - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - - - - - - - - - - - diff --git "a/27 \346\235\250\346\242\205/RBAC.txt" "b/27 \346\235\250\346\242\205/RBAC.txt" deleted file mode 100644 index bef704eacfdfd961223f923aef716ff1b788f16c..0000000000000000000000000000000000000000 --- "a/27 \346\235\250\346\242\205/RBAC.txt" +++ /dev/null @@ -1,147 +0,0 @@ -什么是RBAC? - 允许通过分配一组权限来创建和实施高级访问。权限基于 -特定用户类别执行其职责所需的访问级别。 - -RBAC中的角色 - 角色是用于构建权限的语义结构 - -RBAC中的权限 - 授予对受保护对象执行操作的批准的权限集。这里的受保 -护对象指的可以是应用中所有的内容,包括数据、模块、菜单、 -页面、字段、操作功能(增删改查)等等 - -RBAC有哪些缺陷 - 需要了解组织结构知识 - 需要深思熟虑的实施 - 缺乏灵活性 - 导致角色爆炸 - -RBAC的好处有哪些 - 降低数据泄露或数据丢失的风险 - 降低高级访问控制的成本 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:59:28 */ -/*==============================================================*/ - - -drop table if exists menu; - -drop table if exists role; - -drop table if exists role_menu; - -drop table if exists user; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: menu */ -/*==============================================================*/ -create table menu -( - menu_id int not null auto_increment, - menu_name char(20) not null, - primary key (menu_id) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name char(20) not null, - primary key (role_id) -); - -/*==============================================================*/ -/* Table: role_menu */ -/*==============================================================*/ -create table role_menu -( - menu_id int not null, - role_id int not null, - primary key (menu_id, role_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_name char(20) not null, - user_password char(20) not null, - primary key (user_id) -); - -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - role_id int not null, - user_id int not null, - primary key (role_id, user_id) -); - -alter table role_menu add constraint FK_role_menu foreign key (menu_id) - references menu (menu_id) on delete restrict on update restrict; - -alter table role_menu add constraint FK_role_menu2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -insert into user - VALUES - (1,'瑞','610141'), - (2,'雪','257677'), - (3,'白','768346'); - -insert into role - values - (1,'校长'), - (2,'教师'), - (3,'学生'); - -insert into menu - values - (1,'查看校长信息'), - (2,'查看教师信息'), - (3,'查看学生信息'), - (4,'查看工资信息'); - -insert into user_role - values - (1,1), - (2,2), - (3,3); - -insert into role_menu - values - (1,1), - (2,1), - (3,1), - (4,1), - (2,2), - (3,2), - (4,2), - (3,3); - -select * from user u,role r,menu m, user_role ur, role_menu rm where -u.user_id=ur.user_id -and r.role_id=ur.role_id -and m.menu_id=rm.menu_id -and user_name = '瑞' -and user_password ='610141'; - -``` - diff --git "a/27 \346\235\250\346\242\205/sku\346\211\213\346\234\272.md" "b/27 \346\235\250\346\242\205/sku\346\211\213\346\234\272.md" deleted file mode 100644 index 4199845276341c50f83624a11d54308a1f0696f2..0000000000000000000000000000000000000000 --- "a/27 \346\235\250\346\242\205/sku\346\211\213\346\234\272.md" +++ /dev/null @@ -1,140 +0,0 @@ -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:53:13 */ -/*==============================================================*/ - - -drop table if exists attributes; - -drop table if exists goods; - -drop table if exists middle; - -drop table if exists size; - -drop table if exists value; - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_id int not null auto_increment, - attributes_name varchar(50) not null, - primary key (attributes_id) -); - -/*==============================================================*/ -/* Table: goods */ -/*==============================================================*/ -create table goods -( - goods_id int not null auto_increment, - goods_name varchar(50) not null, - primary key (goods_id) -); - -/*==============================================================*/ -/* Table: middle */ -/*==============================================================*/ -create table middle -( - middle_id int not null auto_increment, - size_id int, - attributes_id int, - value_id int, - primary key (middle_id) -); - -/*==============================================================*/ -/* Table: size */ -/*==============================================================*/ -create table size -( - size_id int not null auto_increment, - goods_id int, - size_name varchar(50) not null, - size_memory char(50) not null,-- 内存 - size_colour char(50) not null, - size_number numeric(50,0) not null, - primary key (size_id) -); - -/*==============================================================*/ -/* Table: value */ -/*==============================================================*/ -create table value -( - value_id int not null auto_increment, - value_name varchar(50) not null, - primary key (value_id) -); - -alter table middle add constraint FK_Relationship_2 foreign key (size_id) - references size (size_id) on delete restrict on update restrict; - -alter table middle add constraint FK_Relationship_3 foreign key (attributes_id) - references attributes (attributes_id) on delete restrict on update restrict; - -alter table middle add constraint FK_Relationship_4 foreign key (value_id) - references value (value_id) on delete restrict on update restrict; - -alter table size add constraint FK_Relationship_1 foreign key (goods_id) - references goods (goods_id) on delete restrict on update restrict; - -insert into goods - values - (1,"华为"); - - -insert into size - values - (1,1,"华为P30","100GB",'白色',10), - (2,1,"华为P30","100GB",'黑色',10), - (3,1,"华为P30","256GB",'白色',10), - (4,1,"华为P30","256GB",'黑色',10), - (5,1,"华为P20","100GB",'白色',0), - (6,1,"华为P20","256GB",'黑色',5), - (7,1,"华为P20","100GB",'白色',0), - (8,1,"华为P20","256GB",'黑色',5); - -insert into attributes - values - - (222,"手机内存"), - (223,"手机颜色"); - - -insert into `value` - values - - (333,"100GB"), - (334,"256GB"), - (335,"白色"), - (336,"黑色"); - -insert into middle - values - (441,1,222,333), - (442,1,223,335), - (443,2,222,333), - (444,2,223,336), - (445,3,222,334), - (446,3,223,335), - (447,4,222,333), - (448,4,223,336), - (449,5,222,333), - (500,5,223,335), - (501,6,222,334), - (502,6,223,336), - (503,7,222,333), - (504,7,223,335), - (505,8,222,334), - (506,8,223,336); - - - - -``` - diff --git "a/27 \346\235\250\346\242\205/\345\214\273\351\231\242.md." "b/27 \346\235\250\346\242\205/\345\214\273\351\231\242.md." deleted file mode 100644 index dd32ad35c58746ce0971add905ccc4b90f6d1cc9..0000000000000000000000000000000000000000 --- "a/27 \346\235\250\346\242\205/\345\214\273\351\231\242.md." +++ /dev/null @@ -1,168 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-13 19:43:32 */ -/*==============================================================*/ - - -drop table if exists administrative_office; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists inpatient_ward; - -drop table if exists nurse; - -drop table if exists nurse2; - -drop table if exists patient; - -drop table if exists "use"; - -drop table if exists ward_type; - -/*==============================================================*/ -/* Table: administrative_office */ -/*==============================================================*/ -create table administrative_office -( - administrative_office_id int not null auto_increment, - administrative_office_name char(10) not null, - administrative_office_phone numeric(11,0) not null, - administrative_office_address char(100) not null, - primary key (administrative_office_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - administrative_office_id int, - doctor_name char(10) not null, - doctor_sex char(1) not null, - doctor_post char(10) not null, - doctor_age char(10) not null, - doctor_price numeric(6,0) not null, - doctor_phone int not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - drug_name char(10) not null, - drug_manufacturers char(10) not null, - drug_price float(8,2) not null, - drug_date date not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: inpatient_ward */ -/*==============================================================*/ -create table inpatient_ward -( - inpatient_ward_id int not null auto_increment, - ward_type_id int not null, - inpatient_ward_name int not null, - inpatient_ward_floor int not null, - inpatient_ward_sum char(10) not null, - primary key (inpatient_ward_id) -); - -/*==============================================================*/ -/* Table: nurse */ -/*==============================================================*/ -create table nurse -( - nurse_id int not null auto_increment, - nurse_name char(10) not null, - nurse_sex char(1) not null, - nurse_age char(5) not null, - nurse_price numeric(6,0) not null, - primary key (nurse_id) -); - -/*==============================================================*/ -/* Table: nurse2 */ -/*==============================================================*/ -create table nurse2 -( - nurse_id int not null, - patient_id int not null, - primary key (nurse_id, patient_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - doctor_id int, - inpatient_ward_id int, - patient_name char(10) not null, - patient_sex char(1) not null, - patient_age int not null, - patient_history char(100) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: "use" */ -/*==============================================================*/ -create table "use" -( - drug_id int not null, - patient_id int not null, - primary key (drug_id, patient_id) -); - -/*==============================================================*/ -/* Table: ward_type */ -/*==============================================================*/ -create table ward_type -( - ward_type_id int not null auto_increment, - administrative_office_id int, - ward_type_name char(10) not null, - ward_type_price numeric(6,0) not null, - primary key (ward_type_id) -); - -alter table doctor add constraint FK_subordinate foreign key (administrative_office_id) - references administrative_office (administrative_office_id) on delete restrict on update restrict; - -alter table inpatient_ward add constraint FK_set foreign key (ward_type_id) - references ward_type (ward_type_id) on delete restrict on update restrict; - -alter table nurse2 add constraint FK_nurse foreign key (nurse_id) - references nurse (nurse_id) on delete restrict on update restrict; - -alter table nurse2 add constraint FK_nurse2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table patient add constraint FK_Indications foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table patient add constraint FK_check_in foreign key (inpatient_ward_id) - references inpatient_ward (inpatient_ward_id) on delete restrict on update restrict; - -alter table "use" add constraint FK_use foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -alter table "use" add constraint FK_use2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table ward_type add constraint FK_belong foreign key (administrative_office_id) - references administrative_office (administrative_office_id) on delete restrict on update restrict; - - https://s2.loli.net/2023/09/14/IcjJUdgKxQYPpGS.jpg - https://s2.loli.net/2023/09/14/Qn13DYzHcUjpBim.jpg - https://s2.loli.net/2023/09/14/s194ypB2HOmtl5q.jpg \ No newline at end of file diff --git "a/27 \346\235\250\346\242\205/\345\233\276\344\271\246\351\246\206\347\256\241\347\220\206\347\263\273\347\273\237.txt" "b/27 \346\235\250\346\242\205/\345\233\276\344\271\246\351\246\206\347\256\241\347\220\206\347\263\273\347\273\237.txt" deleted file mode 100644 index 361c0f55843fed7a814aaa391a40cfa3777b4c47..0000000000000000000000000000000000000000 --- "a/27 \346\235\250\346\242\205/\345\233\276\344\271\246\351\246\206\347\256\241\347\220\206\347\263\273\347\273\237.txt" +++ /dev/null @@ -1,283 +0,0 @@ -```mysql --- 创建数据库 -create database t_books charset utf8; --- 使用数据库 -use t_books; - - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-11 20:27:33 */ -/*==============================================================*/ - - -drop table if exists bookinfo;-- 书籍具体信息表 - -drop table if exists borrow;-- 借阅信息表 - -drop table if exists floormassage;-- 楼层信息表 - -drop table if exists gett;-- 接收人 - -drop table if exists library;-- 图书馆表 - -drop table if exists put;-- 放置图书 - -drop table if exists return_book;-- 归还信息表 - -drop table if exists user;-- 用户登录表 - -drop table if exists userinfo;-- 用户信息表 - -drop table if exists work;-- 管理员信息表 - -/*==============================================================*/ -/* Table: bookinfo */ -/*==============================================================*/ - --- 书籍具体信息表 -create table bookinfo -( - book_ID int not null auto_increment, -- 书籍编号 - ID int not null, -- 楼层编号 - book_name char(20) not null, -- 书籍名称 - author varchar(15) not null, -- 书籍作者 - publish date not null, -- 出版时间 - book_price numeric(10,2) not null, -- 书籍价格 - primary key (book_ID) -); - -/*==============================================================*/ -/* Table: borrow */ -/*==============================================================*/ - --- 借阅信息表 -create table borrow -( - borrow_ID int not null auto_increment, -- 借阅编号 - book_ID int not null, -- 书籍编号 - borrow_date date not null, -- 借阅时间 - return_date date not null, -- 归还时间 - primary key (borrow_ID) -); - -/*==============================================================*/ -/* Table: floormassage */ -/*==============================================================*/ - --- 楼层信息表 -create table floormassage -( - ID int not null auto_increment, -- 楼层编号 - lib_ID int not null, -- 图书馆编号 - floor char(3) not null, -- 楼层 - shelf_ID int not null, -- 书架编号 - linenum int not null, -- 行号 - type char(10) not null, -- 类型 - primary key (ID) -); - -/*==============================================================*/ -/* Table: get */ -/*==============================================================*/ - --- 接收人 -create table gett -( - worker_ID int not null, -- 管理员编号 - return_ID int not null, -- 归还编号 - primary key (worker_ID, return_ID) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ - --- 图书馆表 -create table library -( - lib_ID int not null auto_increment, -- 图书馆编号 - user_ID int not null, -- 用户编号 - lib_name varchar(10) not null, -- 图书馆名称 - primary key (lib_ID) -); - -/*==============================================================*/ -/* Table: put */ -/*==============================================================*/ - --- 放置图书 -create table put -( - lib_ID int not null, -- 楼层编号 - worker_ID int not null, -- 管理员编号 - primary key (lib_ID, worker_ID) -); - -/*==============================================================*/ -/* Table: "return" */ -/*==============================================================*/ - --- 归还信息表 -create table return_book -( - return_ID int not null auto_increment, -- 归还编号 - user_ID int not null, -- 用户编号 - return_date date not null, -- 归还时间 - primary key (return_ID) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ - --- 用户登录表 -create table user -( - user_ID int not null auto_increment, -- 用户编号 - user_name varchar(5) not null, -- 用户姓名 - password varchar(10) not null, -- 密码 - primary key (user_ID) -); - -/*==============================================================*/ -/* Table: userinfo */ -/*==============================================================*/ - --- 用户信息表 -create table userinfo -( - userinfo_ID int not null auto_increment, -- 用户信息编号 - user_ID int not null, -- 用户编号 - userinfo_name varchar(6) not null, -- 用户姓名 - userinfo_sex char(1) not null, -- 用户性别 - college char(10) not null, -- 学院 - major char(15) not null, -- 专业 - grade char(20) not null, -- 年级 - class char(20) not null, -- 班级 - user_tel char(15) not null, -- 用户电话 - primary key (userinfo_ID) -); - -/*==============================================================*/ -/* Table: work */ -/*==============================================================*/ - --- 管理员信息表 -create table work -( - worker_ID int not null auto_increment, -- 员工编号 - worker_name varchar(5) not null, -- 员工姓名 - worker_sex char(1) not null, -- 员工性别 - worker_tel char(12) not null, -- 员工电话 - worker_salary int not null, -- 员工工资 - primary key (worker_ID) -); - -alter table bookinfo add constraint FK_check_book foreign key (ID) - references floormassage (ID) on delete restrict on update restrict; - -alter table borrow add constraint FK_borrow foreign key (book_ID) - references bookinfo (book_ID) on delete restrict on update restrict; - -alter table floormassage add constraint FK_check_floor foreign key (lib_ID) - references library (lib_ID) on delete restrict on update restrict; - -alter table gett add constraint FK_get foreign key (worker_ID) - references work (worker_ID) on delete restrict on update restrict; - -alter table gett add constraint FK_get2 foreign key (return_ID) - references return_book (return_ID) on delete restrict on update restrict; - -alter table library add constraint FK_check foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - -alter table put add constraint FK_put foreign key (lib_ID) - references library (lib_ID) on delete restrict on update restrict; - -alter table put add constraint FK_put2 foreign key (worker_ID) - references work (worker_ID) on delete restrict on update restrict; - -alter table return_book add constraint FK_return foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - -alter table userinfo add constraint FK_information foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - - ### 用户登录 - -insert into user values -- 用户登录 -(001,'小梅','123'), -(002,'小晶','456'), -(003,'小芳','789'); - - - ### 用户信息表 -insert into userinfo values -(101,001,'韩梅梅','女','软件工程学院','前端','22级','1班','1234567892'), -(102,002,'郭晶晶','女','软件工程学院','后端','22级','2班','2345678925'), -(103,003,'李静芳','女','软件工程学院','新媒体','22级','10班','1234567894'); - - -### 图书馆信息表 -insert into library values -(201,001,'北京市图书馆'), -(202,002,'龙岩市图书馆'), -(203,003,'厦门市图书馆'); - -### 楼层信息表 -insert into floormassage values -(301,201,'四楼',337,1,'外国著作'), -(302,202,'六楼',338,2,'文学经典'), -(303,203,'五楼',339,3,'仙侠类'); - -### 书籍具体信息表 -insert into bookinfo values -- 图书信息 -(401,301,'战争与和平','列夫托尔斯泰','1869-6-6',45), -(402,302,'活着','余华','1992-12-2',60), -(403,303,'花千骨','果果','2018-12-31',80.8); - - - - - -### 借阅信息表 -insert into borrow values -- 图书借阅 -(501,401,'2023-04-16','2023-05-16'), -(502,402,'2023-04-16','2023-05-16'), -(503,403,'2023-04-16','2023-05-16'); - - - - -### 归还信息表 -insert into return_book values -- 归还图书 -(601,001,'2023-04-25'), -(602,002,'2023-05-10'), -(603,003,'2023-05-16'); - - - -### 管理员 -insert into work values -(701,'张三','男','1594628347',5000), -(702,'李四','男','1569821347',4000), -(703,'李雪','女','1634957612',3000); - - --- 接受表 -insert into gett values -(701,601), -(702,602), -(703,603); - --- 放置表 -insert into put values -(201,701), -(202,702), -(203,703); - - -``` - diff --git "a/27 \346\235\250\346\242\205/\345\255\246\346\240\241\347\263\273\347\273\237.md" "b/27 \346\235\250\346\242\205/\345\255\246\346\240\241\347\263\273\347\273\237.md" deleted file mode 100644 index d31b3ded7d7d86a3363e23e42216043ee2545ba9..0000000000000000000000000000000000000000 --- "a/27 \346\235\250\346\242\205/\345\255\246\346\240\241\347\263\273\347\273\237.md" +++ /dev/null @@ -1,100 +0,0 @@ --- 创建一个仓库--系统 -create database SchoolSystem charset utf8; -use SchoolSystem; --- 创建院系表 -create table Department( - Department_ID varchar(30) PRIMARY key, -- 院系编号 - Department_name varchar(50) unique not null -- 院系名称 -); -insert into Department - values - (223344,"软件工程学院"), - (223355,"信息工程学院"), - (223366,"城乡建筑学院"); - --- 创建专业表 -create table Major( - Major_ID varchar(20) PRIMARY key, -- 专业编号 - Major_name varchar(30), -- 专业名称 - Department_ID varchar(40) not null, -- 所属院系编号 - FOREIGN key (Department_ID) REFERENCES Department(Department_ID) - -- 所属院系设置为外键 -); -insert into Major - values - (1122,"开发",223344), - (1133,"多媒体",223355), - (1144,"城市规划与设计",223366); --- 创建班级表 -create table Class( - Class_ID int not null PRIMARY key, -- 班级编号 - Class_name varchar(15), -- 班级名称 - Major_ID varchar(20), -- 专业编号 - foreign key (Major_ID) references Major(Major_ID) - ); - insert into Class - values - (1,"开发班",1122), - (2,"多媒体班",1133), - (3,"城市规划班",1144); --- 学生表 -create table Student( - Student_ID varchar(20) PRIMARY key, -- 学生编号 - Student_name varchar(25), -- 学生姓名 - Class_ID int not null, -- 班级编号 - Class_name varchar(15), - foreign key (Class_ID) references Class(Class_ID) -); -insert into Student - values - (3344,"小雪",1,"开发班"), - (3355,"博仔",2,"多媒体班"), - (3366,"瑞瑞",3,"城市规划班"); --- 课程表 -create table Course( - Course_ID int primary key, - Course_name varchar(5), - Student_ID varchar(20), -- 学生编号 - Student_name varchar(25), - FOREIGN key (Student_ID) REFERENCES Student(Student_ID) -); -insert into Course - values - (40,"数据库",3344,"小雪"), - (50,"微机原理",3355,"博仔"), - (60,"建筑设计",3366,"瑞瑞"); --- 教师表 -create table Teacher( - Teacher_ID int PRIMARY key, - Teacher_name varchar(4), - Course_ID int, - Course_name varchar(5), - FOREIGN key (Course_ID) REFERENCES Course(Course_ID) -); -insert into Teacher - values - (70,"小小",40,"数据库"), - (80,"名夏",50,"微机原理"), - (90,"雪儿",60,"建筑设计"); --- 选修表 -create table Choose( - Choose_ID int(10) PRIMARY key, - Choose_name varchar(5), - Course_ID int, - Course_name varchar(5), - score double(3,2), - FOREIGN key (Course_ID) REFERENCES Course(Course_ID) -); -create table timetable( - Classroom_ID int PRIMARY key, - Classroom_name varchar(5), - Class_ID int not null, -- 班级编号 - Class_name varchar(15), - Course_ID int, - Course_name varchar(5), - Teacher_ID int, - Teacher_name varchar(4), - FOREIGN key (Class_ID) REFERENCES Class(Class_ID), - FOREIGN key (Course_ID) REFERENCES Course(Course_ID), - FOREIGN key (Teacher_ID) REFERENCES Teacher(Teacher_ID) -); \ No newline at end of file diff --git "a/27 \346\235\250\346\242\205/\345\275\261\350\247\206\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/27 \346\235\250\346\242\205/\345\275\261\350\247\206\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index 3ec18685ce15083de775a4972def033e154f43c0..0000000000000000000000000000000000000000 --- "a/27 \346\235\250\346\242\205/\345\275\261\350\247\206\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,383 +0,0 @@ -```mysql --- 创建数据库 -create database film_message charset utf8; --- 使用数据库 -use film_message; - - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 20:13:50 */ -/*==============================================================*/ - - -drop table if exists actor_directors_screenwriters; - -drop table if exists actorr; - -drop table if exists collect; - -drop table if exists country; - -drop table if exists film; - -drop table if exists film_address; - -drop table if exists film_language; - -drop table if exists film_type; - -drop table if exists language; - -drop table if exists personal; - -drop table if exists phone; - -drop table if exists relation; - -drop table if exists short; - -drop table if exists type; - - -/*==============================================================*/ -/* Table: actor_directors_screenwriters */ -/*==============================================================*/ --- 演员,导演,编剧表 -create table actor_directors_screenwriters -( - films_id int not null, -- 影视编号 - actor_id int not null, -- 演员编号 - primary key (films_id, actor_id) -); - -/*==============================================================*/ -/* Table: actorr */ -/*==============================================================*/ --- 演员表 -create table actorr -( - actor_id int not null auto_increment,-- 演员编号 - actor_name char(20) not null, -- 演员姓名 - actor_sex char(1) not null, -- 演员性别 - primary key (actor_id) -); - -/*==============================================================*/ -/* Table: collect */ -/*==============================================================*/ --- 收藏片单表 -create table collect -( - collect_id int not null auto_increment,-- 收藏编号 - collect_time date not null, -- 收藏时间 - collect_language char(50) not null, -- 推荐语 - collect_join char(2) not null, -- 是否加入到豆列 - primary key (collect_id) -); - -/*==============================================================*/ -/* Table: country */ -/*==============================================================*/ --- 国家地区表 -create table country -( - country_id int not null auto_increment,-- 国家编号 - country_name char(15) not null, -- 国家名称 - primary key (country_id) -); - -/*==============================================================*/ -/* Table: film */ -/*==============================================================*/ --- 影视作品表 -create table film -( - films_id int not null auto_increment,-- 影视编号 - collect_id int not null, -- 收藏编号 - films_name char(10) not null, -- 影视名称 - films_date date not null, -- 上映日期 - films_duration int not null, -- 片长 - films_score numeric(4,2) not null, -- 豆瓣评分 - primary key (films_id) -); - -/*==============================================================*/ -/* Table: film_address */ -/*==============================================================*/ --- 影视地区表 -create table film_address -( - country_id int not null,-- 国家编号 - films_id int not null,-- 影视编号 - primary key (country_id, films_id) -); - -/*==============================================================*/ -/* Table: film_language */ -/*==============================================================*/ --- 影视语言表 -create table film_language -( - language_id int not null,-- 语言编号 - films_id int not null,-- 影视编号 - primary key (language_id, films_id) -); - -/*==============================================================*/ -/* Table: film_type */ -/*==============================================================*/ --- 影视类型表 -create table film_type -( - films_id int not null,-- 影视编号 - type_id int not null,-- 类型编号 - primary key (films_id, type_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ --- 语言表 -create table language -( - language_id int not null auto_increment,-- 语言编号 - language_name char(10) not null, -- 语言名称 - primary key (language_id) -); - -/*==============================================================*/ -/* Table: personal */ -/*==============================================================*/ --- 个人信息表 -create table personal -( - personal_id int not null auto_increment,-- 个人信息编号 - personal_name char(20) not null, -- 姓名 - personal_sex char(1) not null, -- 性别 - personal_date date not null, -- 出生日期 - personal_address char(10) not null, -- 出生地 - personal_star char(3) not null, -- 星座 - primary key (personal_id) -); - -/*==============================================================*/ -/* Table: phone */ -/*==============================================================*/ --- 图片表 -create table phone -( - phone_id int not null auto_increment,-- 图片编号 - films_id int not null, -- 影视编号 - phone_name char(50) not null, -- 图片地址 - primary key (phone_id) -); - -/*==============================================================*/ -/* Table: relation */ -/*==============================================================*/ --- 关系表 -create table relation -( - films_id int not null, -- 影视编号 - personal_id int not null, -- 个人信息编号 - primary key (films_id, personal_id) -); - -/*==============================================================*/ -/* Table: short */ -/*==============================================================*/ --- 短评表 -create table short· -( - short_id int not null auto_increment, -- 短评编号 - personal_id int not null, -- 个人信息编号 - films_id int not null, -- 影视编号 - short_want char(2) not null, -- 是否想看 - short_look char(2) not null, -- 是否看过 - short_rating char(10) not null, -- 评价等级 - short_label char(10) not null, -- 标签 - short_comment char(100) not null, -- 简短评论 - short_ilook char(5) not null, -- 是否仅自己可见 - primary key (short_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ --- 类型表 -create table type -( - type_id int not null auto_increment, -- 类型编号 - type_name char(10) not null, -- 类型名称 - primary key (type_id) -); - -alter table actor_directors_screenwriters add constraint FK_actor_directors_screenwriters foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table actor_directors_screenwriters add constraint FK_actor_directors_screenwriters2 foreign key (actor_id) - references actorr (actor_id) on delete restrict on update restrict; - -alter table film add constraint FK_enshrine foreign key (collect_id) - references collect (collect_id) on delete restrict on update restrict; - -alter table film_address add constraint FK_film_address foreign key (country_id) - references country (country_id) on delete restrict on update restrict; - -alter table film_address add constraint FK_film_address2 foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table film_language add constraint FK_film_language foreign key (language_id) - references language (language_id) on delete restrict on update restrict; - -alter table film_language add constraint FK_film_language2 foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table film_type add constraint FK_film_type foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table film_type add constraint FK_film_type2 foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table phone add constraint FK_poster foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table relation add constraint FK_relation foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table relation add constraint FK_relation2 foreign key (personal_id) - references personal (personal_id) on delete restrict on update restrict; - -alter table short add constraint FK_evaluation foreign key (personal_id) - references personal (personal_id) on delete restrict on update restrict; - -alter table short add constraint FK_loading foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - - - - - - --- 电影类型表 -insert into type - values - (111,"剧情"), - (112,"爱情"), - (113,"动作"); - --- 国家地区表 -insert into country - values - (121,"中国"), - (122,"韩国"), - (123,"英国"); - --- 语言表 -insert into language - values - (131,"中文"), - (132,"英语"), - (133,"韩语"); - - --- 演员表actorr -insert into actorr - values - (401,'席琳·宋','女'), - (402,'刘台午','男'), - (403,'约翰·马加罗','男'); - - - - - - - - --- collect -insert into collect - values - (501,'2023-09-30','很好看','加入'), - (502,'2022-08-21','好好看','加入'), - (503,'2023-07-11','好看','加入'); - --- 个人信息表 -insert into personal - values - (221,"小小",'女','2004-06-10','云南','双子座'), - (222,"肖军",'男','2002-04-21','四川','白羊座'), - (223,"瑞芮",'女','2003-01-18','山东','狮子座'); - --- 影视作品表 -insert into film - values - (021,501,'过往人生','2023-01-21',106,7.7), - (022,502,'生化危机','2022-05-12',127,7.8), - (023,503,'八角笼中','2023-06-06',150,7.2); - - --- phone -insert into phone - values - (310,021,'s?id=1775102085983294863&wfr=spider&for=pc'), - (311,022,'s?id=1768674709626395274&wfr=spider&for=pc'), - (312,023,'s?id=1768165498462546544&wfr=spider&for=pc'); - - --- short --- -insert into short - values - (661,221,021,'想看','看过','4颗星','我的观后感','非常好看','仅自己可见'), - (662,222,022,'想看','看过','4颗星','我的观后感','好好看','仅自己可见'), - (663,223,023,'想看','看过','5颗星','我的观后感','值得一看','仅自己可见'); - - - -- actor_directors_screenwriters --- -insert into actor_directors_screenwriters - values - (021,401), - (022,401), - (023,401); - --- film_address --- -insert into film_address - values - (121,021), - (121,022), - (121,023); - - --- film_language --- -insert into film_language - values - (131,021), - (132,022), - (133,023); - --- film_type --- -insert into film_type - values - (021,111), - (022,112), - (023,113); - --- relation --- -insert into relation - values - (021,221), - (022,222), - (023,223); - - - -``` - diff --git "a/27 \346\235\250\346\242\205/\346\261\275\350\275\246\351\224\200\345\224\256.md" "b/27 \346\235\250\346\242\205/\346\261\275\350\275\246\351\224\200\345\224\256.md" deleted file mode 100644 index 80af4da4c18e81c8c115a8266380585e627ecb0e..0000000000000000000000000000000000000000 --- "a/27 \346\235\250\346\242\205/\346\261\275\350\275\246\351\224\200\345\224\256.md" +++ /dev/null @@ -1,296 +0,0 @@ -```mysql -/*==============================================================*/ -/* DBMS name: Sybase SQL Anywhere 12 */ -/* Created on: 2023-09-17 19:21:21 */ -/*==============================================================*/ - - -if exists(select 1 from sys.sysforeignkey where role='FK_RELATION_RELATIONS_WORKER') then - alter table Relationship_3 - delete foreign key FK_RELATION_RELATIONS_WORKER -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_RELATION_RELATIONS_SALE') then - alter table Relationship_3 - delete foreign key FK_RELATION_RELATIONS_SALE -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_SALE_RELATIONS_CUSTOMER') then - alter table sale - delete foreign key FK_SALE_RELATIONS_CUSTOMER -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_SALE_RELATIONS_CAR') then - alter table sale - delete foreign key FK_SALE_RELATIONS_CAR -end if; - -drop index if exists Relationship_3.Relationship_4_FK; - -drop index if exists Relationship_3.Relationship_3_FK; - -drop index if exists Relationship_3.Relationship_3_PK; - -drop table if exists Relationship_3; - -drop index if exists car.car_PK; - -drop table if exists car; - -drop index if exists customer.customer_PK; - -drop table if exists customer; - -drop index if exists sale.Relationship_2_FK; - -drop index if exists sale.Relationship_1_FK; - -drop index if exists sale.sale_PK; - -drop table if exists sale; - -drop index if exists worker.worker_PK; - -drop table if exists worker; - -if exists(select 1 from sys.syssequence s - where sequence_name='S_car') then - drop sequence S_car -end if; - -if exists(select 1 from sys.syssequence s - where sequence_name='S_customer') then - drop sequence S_customer -end if; - -if exists(select 1 from sys.syssequence s - where sequence_name='S_sale') then - drop sequence S_sale -end if; - -if exists(select 1 from sys.syssequence s - where sequence_name='S_worker') then - drop sequence S_worker -end if; - -create sequence S_car; - -create sequence S_customer; - -create sequence S_sale; - -create sequence S_worker; - -/*==============================================================*/ -/* Table: Relationship_3 */ -/*==============================================================*/ -create table Relationship_3 -( - worker_id integer not null, -- 销售员编号 - sale_id integer not null, -- 售出车辆编号 - constraint PK_RELATIONSHIP_3 primary key clustered (worker_id, sale_id) -); - -/*==============================================================*/ -/* Index: Relationship_3_PK */ -/*==============================================================*/ -create unique clustered index Relationship_3_PK on Relationship_3 ( -worker_id ASC, -sale_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_3_FK */ -/*==============================================================*/ -create index Relationship_3_FK on Relationship_3 ( -worker_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_4_FK */ -/*==============================================================*/ -create index Relationship_4_FK on Relationship_3 ( -sale_id ASC -); - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ --- 汽车表 -create table car -( - car_id integer not null default -- 车辆编号 (S_car.nextval), - car_name char(30) not null,-- 汽车名称 - car_price char(30) not null,-- 汽车价格 - car_colour char(30) not null,-- 汽车颜色 - car_type char(30) not null,-- 汽车车型 - constraint PK_CAR primary key (car_id) -); - -/*==============================================================*/ -/* Index: car_PK */ -/*==============================================================*/ -create unique index car_PK on car ( -car_id ASC -); - -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ --- 顾客信息表 -create table customer -( - customer_id integer not null default-- 顾客编号 - (S_customer.nextval), - customer_name char(30) not null,-- 顾客姓名 - customer_sex char(1) not null,-- 顾客性别 - csstomer_tel char(12) not null,-- 顾客电话 - constraint PK_CUSTOMER primary key (customer_id) -); - -/*==============================================================*/ -/* Index: customer_PK */ -/*==============================================================*/ -create unique index customer_PK on customer ( -customer_id ASC -); - -/*==============================================================*/ -/* Table: sale */ -/*==============================================================*/ --- 汽车销售记录表 -create table sale -( - sale_date char(30) not null,-- 销售时间 - sale_price char(30) not null,-- 实际价格 - sale_id integer not null default (S_sale.nextval),-- 销售汽车编号 - customer_id integer null, -- 顾客编号 - car_id integer null, -- 汽车编号 - sale_name char(30) not null,-- 售出汽车名称 - constraint PK_SALE primary key (sale_id) -); - -/*==============================================================*/ -/* Index: sale_PK */ -/*==============================================================*/ -create unique index sale_PK on sale ( -sale_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_1_FK */ -/*==============================================================*/ -create index Relationship_1_FK on sale ( -customer_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_2_FK */ -/*==============================================================*/ -create index Relationship_2_FK on sale ( -car_id ASC -); - -/*==============================================================*/ -/* Table: worker */ -/*==============================================================*/ --- 销售员信息表 -create table worker -( - worker_id integer not null default (S_worker.nextval),-- 销售员编号 - worker_name char(30) not null,-- 销售员姓名 - worker_sex char(1) not null,-- 销售员性别 - constraint PK_WORKER primary key (worker_id) -); - -/*==============================================================*/ -/* Index: worker_PK */ -/*==============================================================*/ -create unique index worker_PK on worker ( -worker_id ASC -); - -alter table Relationship_3 - add constraint FK_RELATION_RELATIONS_WORKER foreign key (worker_id) - references worker (worker_id) - on update restrict - on delete restrict; - -alter table Relationship_3 - add constraint FK_RELATION_RELATIONS_SALE foreign key (sale_id) - references sale (sale_id) - on update restrict - on delete restrict; - -alter table sale - add constraint FK_SALE_RELATIONS_CUSTOMER foreign key (customer_id) - references customer (customer_id) - on update restrict - on delete restrict; - -alter table sale - add constraint FK_SALE_RELATIONS_CAR foreign key (car_id) - references car (car_id) - on update restrict - on delete restrict; -insert into Relationship_3 - values - (111,221), - (111,222), - (112,223), - (113,224), - (113,225), - (114,226); - -insert into car - values - (221,'奥迪','120万','黑色','奥迪A6L'), - (222,'宝马','80万','银灰','宝马X7'), - (223,'宝马','91万','黑色','宝马i3'), - (224,'奇瑞','40万','绿色','奇瑞k7'), - (225,'五菱','125万','紫色','五菱l6'), - (226,'奇瑞','66万','蓝色','奇瑞1L'); - -insert into customer - values - (331,'小睿','男','11277577489'), - (332,'明溪','女','15896544565'), - (333,'铭总','男','17568945955'), - (334,'小雪','女','15025767922'); - -insert into sale - values - ('2022-06-06','110万',221,331,221,'奥迪'), - ('2022-07-12','75万',222,331,222,'宝马'), - ('2023-02-19','80万',223,332,223,'宝马'), - ('2023-04-22','40万',224,333,224,'奇瑞'), - ('2023-05-12','100万',225,333,225,'五菱'), - ('2023-06-10','60万',226,334,226,'奇瑞'); - -insert into worker - values - (111,'肉肉','男'), - (112,'雪女','女'), - (113,'影','女'), - (114,'万叶','男'); -# 应用场景: - -- 1.查询特定销售员的销售记录 - select * from Relationship_3 where worker_id='111'; - -- 2.查找销售记录中销售价格最高的汽车 - select max(sale_price)* from sale; - -- 3.统计某个销售员的销售总额 - select count(sale_id) * from Relationship_3; - -- 4.根据客户信息查询其购买过的汽车 - select * from sale where customer_id = '331'; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - select car_name 汽车品牌,count(car_id) 销售数量,sum(car_price) 销售额 from sale group by car_name; - -- 6.检索特定日期范围内的销售了哪些汽车 - select * from sale where sale_date like '2022'; - -- 7.查找某车型的销售历史。 - select * from sale left join car on sale.car_id=car.car_id; - -- 8.统计每个销售员的销售数量 - select * from Relationship_3 group by worker_id; - - -``` - diff --git "a/27 \346\235\250\346\242\205/\347\224\265\345\275\261\344\277\241\346\201\257\347\256\241\347\220\206\357\274\210pdm\357\274\211.jpg" "b/27 \346\235\250\346\242\205/\347\224\265\345\275\261\344\277\241\346\201\257\347\256\241\347\220\206\357\274\210pdm\357\274\211.jpg" deleted file mode 100644 index 66f765b597f565e630c760f0fb55a4335c59fbe0..0000000000000000000000000000000000000000 Binary files "a/27 \346\235\250\346\242\205/\347\224\265\345\275\261\344\277\241\346\201\257\347\256\241\347\220\206\357\274\210pdm\357\274\211.jpg" and /dev/null differ diff --git "a/27 \346\235\250\346\242\205/\347\224\265\345\275\261\347\256\241\347\220\206\344\277\241\346\201\257\350\241\250.jpg" "b/27 \346\235\250\346\242\205/\347\224\265\345\275\261\347\256\241\347\220\206\344\277\241\346\201\257\350\241\250.jpg" deleted file mode 100644 index fe92c16ae5b958ece08804e161e45da02b34438c..0000000000000000000000000000000000000000 Binary files "a/27 \346\235\250\346\242\205/\347\224\265\345\275\261\347\256\241\347\220\206\344\277\241\346\201\257\350\241\250.jpg" and /dev/null differ diff --git "a/27 \346\235\250\346\242\205/\347\224\265\345\275\261\347\256\241\347\220\206\347\263\273\347\273\237\357\274\210ldm\357\274\211.jpg" "b/27 \346\235\250\346\242\205/\347\224\265\345\275\261\347\256\241\347\220\206\347\263\273\347\273\237\357\274\210ldm\357\274\211.jpg" deleted file mode 100644 index c9e8e93cbdba3fe54c5017f81efb4da98e5cb43b..0000000000000000000000000000000000000000 Binary files "a/27 \346\235\250\346\242\205/\347\224\265\345\275\261\347\256\241\347\220\206\347\263\273\347\273\237\357\274\210ldm\357\274\211.jpg" and /dev/null differ diff --git "a/27 \346\235\250\346\242\205/\347\254\254\344\272\214\350\212\202\350\257\276\347\254\224\350\256\260.md" "b/27 \346\235\250\346\242\205/\347\254\254\344\272\214\350\212\202\350\257\276\347\254\224\350\256\260.md" deleted file mode 100644 index 7a7026deedda82fd8f72496c4732c862d3edf79a..0000000000000000000000000000000000000000 --- "a/27 \346\235\250\346\242\205/\347\254\254\344\272\214\350\212\202\350\257\276\347\254\224\350\256\260.md" +++ /dev/null @@ -1,14 +0,0 @@ -```java -数据库的范式: - 1 第一范式: - 要求字段的内容,不可再分割,为的是保证数据的原子性 - 2 第二范式: - 要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键要依赖整个联合主键) - 而不能只依赖部分 - eg:孩子与父母亲,父母亲为主键 - 3 第三范式: - 满足第二范式后,要求非主键属性要直接依赖于主键 - eg:儿依爸,爸依爷(传递依赖) - -``` - diff --git "a/27 \346\235\250\346\242\205/\350\247\206\345\233\276.md" "b/27 \346\235\250\346\242\205/\350\247\206\345\233\276.md" deleted file mode 100644 index de368d2e62615d691f97fe3abd372f479b158a91..0000000000000000000000000000000000000000 --- "a/27 \346\235\250\346\242\205/\350\247\206\345\233\276.md" +++ /dev/null @@ -1,94 +0,0 @@ -```mysql -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -select * from employees; -CREATE VIEW employee_vu - ( 姓名, 员工号, 部门编号 ) -AS SELECT - last_name, - employee_id, - department_id -FROM - employees; - -#2. 显示视图的结构 -desc employee_vu; - -#3. 查询视图中的全部内容 -select * from employee_vu; - -#4. 将视图中的数据限定在部门遍号是80的范围内 -select * from employee_vu where 部门编号 <=80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -create view emp_v1 - (员工姓,名, 工资, 邮箱) -as -select - first_name,last_name,salary,email -from - employees - where phone_number like '011%'; - -select * from emp_v1; -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -alter view emp_v1 - (员工姓,名, 工资, 邮箱) -as - select - first_name,last_name,salary,email -from - employees - where phone_number like '011%' and email like '%e%'; - -select * from emp_v1; - -#3. 向 emp_v1 插入一条记录,是否可以? - -在基本表上插入数据,视图表会随着基本表的更新而更新 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 - - update employees - set - salary = salary + 1000; - -#5. 删除emp_v1中姓名为Olsen的员工 - -select first_name from employees where first_name like 'O%'; -select last_name from employees where last_name like 'O%'; - -delete from employees where last_name = 'Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -create view emp_v2 - (部门编号,工资) - as -select - department_id,salary -from - employees -where salary > 12000; - -select * from emp_v2; - -#7. 向 emp_v2 中插入一条记录,是否可以? - -不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 - -drop view emp_v2; -drop view emp_v1; -``` - diff --git "a/27 \346\235\250\346\242\205/\350\264\251\345\215\226\346\260\264\346\235\257.md" "b/27 \346\235\250\346\242\205/\350\264\251\345\215\226\346\260\264\346\235\257.md" deleted file mode 100644 index 376ba85bb11e40d9695d8a447c21a7495706a837..0000000000000000000000000000000000000000 --- "a/27 \346\235\250\346\242\205/\350\264\251\345\215\226\346\260\264\346\235\257.md" +++ /dev/null @@ -1,177 +0,0 @@ -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-22 08:59:59 */ -/*==============================================================*/ - - -drop table if exists attributes; - -drop table if exists goods; - -drop table if exists middle; - -drop table if exists sku; - -drop table if exists valuee; - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_id int not null auto_increment, - attributes_name varchar(50) not null, - primary key (attributes_id) -); - -/*==============================================================*/ -/* Table: goods */ -/*==============================================================*/ -create table goods -( - goods_id int not null auto_increment, - goods_name varchar(50) not null, - primary key (goods_id) -); - -/*==============================================================*/ -/* Table: middle */ -/*==============================================================*/ -create table middle -( - middle int not null auto_increment, - sku_id int, - attributes_id int, - values_id int, - primary key (middle) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - goods_id int, - sku_name varchar(50) not null, - sku_price int not null, - sku_number int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: valuee */ -/*==============================================================*/ -create table valuee -( - values_id int not null auto_increment, - values_name varchar(50) not null, - primary key (values_id) -); - -alter table middle add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table middle add constraint FK_Relationship_3 foreign key (attributes_id) - references attributes (attributes_id) on delete restrict on update restrict; - -alter table middle add constraint FK_Relationship_4 foreign key (values_id) - references valuee (values_id) on delete restrict on update restrict; - -alter table sku add constraint FK_Relationship_1 foreign key (goods_id) - references goods (goods_id) on delete restrict on update restrict; - --- 商品表 -insert into goods - values - (111,"水果湿显直保温杯"); - -insert into sku - values - (221,111,"水果湿显直保温杯 鸢尾蓝 500ml 304不锈钢",40,100), - (222,111,"水果湿显直保温杯 鸢尾蓝 400ml 306不锈钢",36,100), - (223,111,"水果湿显直保温杯 祭红 500ml 304不锈钢",35,100), - (224,111,"水果湿显直保温杯 祭红 400ml 306不锈钢",40,100), - (225,111,"水果湿显直保温杯 竹青 500ml 304不锈钢",36,100), - (226,111,"水果湿显直保温杯 竹青 400ml 306不锈钢",35,100); - -insert into attributes - values - (331,"颜色"), - (332,"水杯容量"), - (333,"水杯材质"); - -insert into valuee - values - (441,"鸢尾蓝"), - (442,"祭红"), - (443,"竹青"), - (444,"500ml"), - (445,"400ml"), - (446,"304不锈钢"), - (447,"306不锈钢"); - -insert into middle - values - (1,221,331,441), - (2,221,332,444), - (3,221,333,446), - (4,222,331,441), - (5,222,332,445), - (6,222,333,447), - (7,223,331,442), - (8,223,332,444), - (9,223,333,446), - (10,224,331,442), - (11,224,332,445), - (12,224,333,447), - (13,225,331,443), - (14,225,332,444), - (15,225,333,446), - (16,226,331,443), - (17,226,332,444), - (18,226,333,447); - -select * from goods g, sku s, attributes a, valuee v,middle m WHERE -a.attributes_id = m.attributes_id -and s.sku_id = m.sku_id -and v.values_id = m.values_id -and g.goods_id = s.goods_id -and s.sku_id =(select a.sku_id from (select m.sku_id from valuee v,middle m where -v.values_id = m.values_id -and v.values_name = "500ml" ) a,(select m.sku_id from valuee v,middle m where -v.values_id = m.values_id -and v.values_name = "304不锈钢" ) b,(select m.sku_id from valuee v,middle m where -v.values_id = m.values_id -and v.values_name = "鸢尾蓝" ) c where - a.sku_id = b.sku_id -and b.sku_id = c.sku_id); - - - -select * from valuee v,middle m where -v.values_id = m.values_id -and v.values_name = "500ml"; - -select * from valuee v,middle m where -v.values_id = m.values_id -and v.values_name = "304不锈钢"; - -select * from valuee v,middle m where -v.values_id = m.values_id -and v.values_name = "鸢尾蓝"; - -select * from (select m.sku_id from valuee v,middle m where -v.values_id = m.values_id -and v.values_name = "500ml" ) a,(select m.sku_id from valuee v,middle m where -v.values_id = m.values_id -and v.values_name = "304不锈钢" ) b,(select m.sku_id from valuee v,middle m where -v.values_id = m.values_id -and v.values_name = "鸢尾蓝" ) c where - a.sku_id = b.sku_id -and b.sku_id = c.sku_id; - - -``` - diff --git "a/29 \350\267\257\347\216\262/20230905 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" "b/29 \350\267\257\347\216\262/20230905 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" deleted file mode 100644 index 9ff0f19c84f2d3a51ed7ccd7ff5b2f3083e2f8e4..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230905 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" +++ /dev/null @@ -1,10 +0,0 @@ -## 笔记 - -前两节讲了暑假都做了什么,后两节进述大二规划。 - -qithub :全球最大分享网站 ,gitee;国内版,还有csdn 、b站等 -tvff.cn :解析视频网站 - -在招频网站上看自己想要做的职位作为目标。 - -学会独立完成项自,在老师讲课的基础上,在闲定时间学习别的知识。 \ No newline at end of file diff --git "a/29 \350\267\257\347\216\262/20230906 \345\244\264\350\204\221\351\243\216\346\232\264.md" "b/29 \350\267\257\347\216\262/20230906 \345\244\264\350\204\221\351\243\216\346\232\264.md" deleted file mode 100644 index 5cc34ea38655fc5d081f0b5ed382f10495c19f95..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230906 \345\244\264\350\204\221\351\243\216\346\232\264.md" +++ /dev/null @@ -1,137 +0,0 @@ -# 笔记 - -关系是相互的,一个学生,可以选多个课,课也可以被多个学生选(多对多)这种关系应借助第三个表进行关联,将前面两张表的主键当作外键 - -表与表的关系:1对1,1对多,多对多 -1对多:第二张的表的主键当另一个表的外键(多) -1对1:将其中任一表的主键放在另一张表中的外键 -头脑风暴:院系、专业、班级、学生,教师、谢程、深程表、教室 - -visio -箭头变上有一个加号数据库chen's - -数据库设计方法 按住Ctrl,再拖动,可复制 -1.直观设计法 选中,一直抢动,不能点击 -2.规范设计法 多对多,用字母表行N.M… -3.计算机辅助设计法 -E-R图(实体关系图) -三要素:实体(表)、属性(字度)和关系(以外键约束) -实体用矩形.主键:加下划线 外键:横线中间加菱形 - -# 作业 - -``` mysql -create database school charset utf8; - -use school; - --- 院系表 -create table department( - d_id int primary key, - d_name varchar(10) -); -insert into department values -(123,'软件工程学院'), -(456,'信息工程学院'), -(789,'建筑工程学院'); - --- 专业表 -create table speciality( - s_id int primary key, - s_name varchar(10), - d_id int, - foreign key (d_id) references department(d_id) -); -insert into speciality values -(11,'软件技术与开发',123), -(22,'信息技术',456), -(33,'建筑设计',789); - --- 教室表 -create table classroom( -r_id int PRIMARY KEY, -r_name varchar(10) -); -insert into classroom values -(1,'实训一'), -(2,'实训二'), -(3,'实训三'); - --- 班级表 -create table class( - c_id int primary key, - c_name varchar(10), - s_id int, - foreign key (s_id) references speciality(s_id) -); -insert into class values -(1,'软件技术1班',11), -(2,'软件技术2班',11), -(3,'软件技术3班',11); - --- 课程 -CREATE TABLE course( - couseId int PRIMARY key, - courseName varchar(10), - credit int, - c_id int,-- 班级编号 - r_id int,-- 教室编号 - foreign key (c_id) references class(c_id), - foreign key (r_id) references classroom(r_id) -); -insert into course VALUES -(1,'java',78,1,2), -(2,'html',90,2,3), -(3,'mysql',80,3,1); - --- 教师表 -create table teacher( - t_id int primary key, - t_name varchar(10), - sex varchar(10), - d_id int,-- 院系编号 - couseId int,-- 课程编号 - foreign key (d_id) references department(d_id), - foreign key (couseId) references course(couseId) -); -insert into teacher values -(1,'张三','男',123,1), -(2,'张四','男',456,2), -(3,'李美','女',789,3); - --- 课程表 -create table `select` ( - selectId int primary key, - couseId int,-- 课程编号 - time varchar(20), - t_id int,-- 教师编号 - r_id int,-- 班级编号 - foreign key (couseId) references course(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references classroom(r_id) -); -insert into `select` values -(1,1,'周一上午',2,3), -(2,2,'周二下午',1,2), -(3,3,'周三上午',3,1); - --- 学生表 -create table student ( - id int primary key, - name varchar(10), - sex varchar(5), - age int, - address varchar(20), - d_id int,-- 院系编号 - c_id int,-- 课程编号 - selectId int,-- 选修表的编号 - foreign key (d_id) references department(d_id), - foreign key (c_id) references class(c_id), - foreign key (selectId) references `select`(selectId) -); -insert into student values -(11111,'小明','男',18,'团结里1',123,1,1), -(22222,'小花','女',118,'团结里2',123,2,2), -(33333,'小王','男',1118,'团结里3',456,3,3); -``` - diff --git "a/29 \350\267\257\347\216\262/20230907 \345\244\264\350\204\221\351\243\216\346\232\264\346\234\200\347\273\210\347\211\210.md" "b/29 \350\267\257\347\216\262/20230907 \345\244\264\350\204\221\351\243\216\346\232\264\346\234\200\347\273\210\347\211\210.md" deleted file mode 100644 index c2975e2d2847235da4d9b5d65932a3eb350a9d75..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230907 \345\244\264\350\204\221\351\243\216\346\232\264\346\234\200\347\273\210\347\211\210.md" +++ /dev/null @@ -1,190 +0,0 @@ -# 笔记 - -### 第一范式: - -要求字段的内容,不可再分割,为的是保证数据的原子性 - -例:姓名,省份、城市、区具、地址址 -### 第二范式: - -要求在满足第一范式的基础上,要求非主键字投要完全依赖主健(非主键雪完全依赖整个联合主键,而不只很赖部分) - -例:小明的存在,公须贾依父亲和母亲的存在 -### 第三范式: - -满足第二范式的前提下,要求非主键属性要有接依赖于主键 - -示例:儿子依赖爸爸,爸爸依赖爷爷。其中儿子与爷爷属于间接依赖,则不属于第三范式,学生表中建议不要写专业,院级系,将他们分开写,否则将很难修改,还占内存 -## 数据库设计步聚 - -1.需求分析(实体分析),再进行属性分析 -2.夯析Visio图 -3.在mysql建表 - -# 作业 - - - -```mysql --- 建立数据库 -create database brainstorming charset utf8; --- 使用数据库 -use brainstorming; - - --- 院系 -create table department( -de_id int primary key auto_increment, -de_name varchar(10) not null -); - --- 添加数据 -insert into department values -(1,'软件工程学院'), -(2,'信息工程学院'), -(3,'智能制造学院'), -(4,'旅游管理学院'); - - --- 专业 -create table major( -ma_id int primary key auto_increment, -ma_name varchar(10) not null, -de_id int,-- 学院编号 -foreign key (de_id) references department(de_id) -); - -insert into major values -(1,'前端',1), -(2,'后端',1), -(3,'新媒体',1), -(4,'管理',2); - - --- 班级 -create table clazz( -cl_id int primary key auto_increment, -cl_name varchar(10) not null, -ma_id int ,-- 专业主键 -foreign key (ma_id) references major(ma_id) -); - --- 添加数据 -insert into clazz VALUES -(1,'1班',1), -(2,'2班',1), -(3,'3班',3), -(4,'4班',2); - - --- 学生 -create table student( -stu_id int primary key auto_increment, -stu_name varchar(10) not null, -sex enum('男','女'), -address varchar(50) not null, -de_id int ,-- 学院 -foreign key (de_id) references department(de_id), -ma_id int ,-- 专业 -foreign key (ma_id) references major(ma_id), -cl_id int ,-- 班级 -foreign key (cl_id) references clazz(cl_id) -); - - --- 添加信息 -insert into student values -(1,'杨梅','女','北京',1,2,1), -(2,'露露','女','北京',1,4,3), -(3,'揭阳丽','女','花园宝宝',1,2,2), -(4,'罗云熙','男','云南',2,2,1); - - --- 课程信息表 -create table course( -c_id int primary key auto_increment, -c_name varchar(10) not null -); - --- 添加信息 -insert into course VALUES -(1,'java'), -(2,'html'), -(3,'mysql'), -(4,'css'); - --- 老师表 -create table teacher( -t_id int primary key auto_increment, -t_name varchar(10) not null, -c_id int ,-- 课程 -foreign key (c_id) references course(c_id) -); - --- 添加数据 -insert into teacher VALUES -(1,'张三',1), -(2,'丽思',2), -(3,'王五',3), -(4,'李二',4); - - --- 选修表 -create table elective( -e_id int primary key auto_increment, -grade double(4,2) not null, -c_id int ,-- 课程信息编号 -foreign key (c_id) references course(c_id), -stu_id int ,-- 学生编号 -foreign key (stu_id) references student(stu_id) -); - - --- 添加信息 -insert into elective values -(1,80,2,1), -(2,75.5,1,2), -(3,90,2,3), -(4,50,3,4); - - --- 教室 -create table classroom( -cr_id int primary key auto_increment, -cr_name varchar(10) not null -); - - --- 添加信息 -insert into course VALUES -(101,'实训1'), -(204,'实训2'), -(303,'实训3'), -(404,'实训4'); - - --- 课程表 -create table timetable( -ti_id int primary key auto_increment, -ti_time varchar(5) not null, -cl_id int ,-- 班级 -foreign key (cl_id) references clazz(cl_id), -t_id int ,-- 老师 -foreign key (t_id) references teacher(t_id), -cr_id int ,-- 教室 -foreign key (cr_id) references classroom(cr_id), -c_id int ,-- 课程信息 -foreign key (c_id) references course(c_id) -); - - --- 添加信息 -insert into timetable values -(1,'星期一',1,1,101,1), -(2,'星期二',2,2,204,2), -(3,'星期三',3,3,303,3), -(4,'星期四',4,4,404,4); - -- -``` - diff --git "a/29 \350\267\257\347\216\262/20230908 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/29 \350\267\257\347\216\262/20230908 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index b0e421eb2cdf195e74b473ed5a2c2afdeec94a1a..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230908 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,311 +0,0 @@ -# 笔记 - -软件PowerDesigner: - - - -| Serial:自增 | character:等于char,可设置长度 | integer:整数 | -| ----------- | ------------------------------- | ------------- | -| M:非空 | P:主键 | D:是否显示 | - - - -使用步骤; - -1.创建概念模型(类似与ER图),以用户的角度,简称CDM。 - -方法:点击PowerDesigner----找到File----选择Now Model ----Model types ----Conceptual Data Model---ok. - -点击拖动图标,右键取消 - -2.转换成逻辑模型,以计算机的角度,简称LDM,可以把多对多关系的第三张表创建出来。 - -方法:选择Tools----找到Generato Logical Data Model ---修改名字 - -3.转换成物理模型,以数据库的角度,简称PDM。 - -方法:选择Tools----找到Generato Physical Data Model ---选择MySQL5.0或者你拥有的版本MySQL,并改名字----ok-----选择database-----命名,后缀名为sql------以navicat打开。 - -# 作业(图书管理系统) - -```mysql --- 创建数据库 -create database t_books charset utf8; --- 使用数据库 -use t_books; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-11 20:27:33 */ -/*==============================================================*/ - - -drop table if exists bookinfo;-- 书籍具体信息表 - -drop table if exists borrow;-- 借阅信息表 - -drop table if exists floormassage;-- 楼层信息表 - -drop table if exists gett;-- 接收人 - -drop table if exists library;-- 图书馆表 - -drop table if exists put;-- 放置图书 - -drop table if exists return_book;-- 归还信息表 - -drop table if exists user;-- 用户登录表 - -drop table if exists userinfo;-- 用户信息表 - -drop table if exists work;-- 管理员信息表 - -/*==============================================================*/ -/* Table: bookinfo */ -/*==============================================================*/ - --- 书籍具体信息表 -create table bookinfo -( - book_ID int not null auto_increment, -- 书籍编号 - ID int not null, -- 楼层编号 - book_name char(20) not null, -- 书籍名称 - author varchar(15) not null, -- 书籍作者 - publish date not null, -- 出版时间 - book_price numeric(10,2) not null, -- 书籍价格 - primary key (book_ID) -); - -/*==============================================================*/ -/* Table: borrow */ -/*==============================================================*/ - --- 借阅信息表 -create table borrow -( - borrow_ID int not null auto_increment, -- 借阅编号 - book_ID int not null, -- 书籍编号 - borrow_date date not null, -- 借阅时间 - return_date date not null, -- 归还时间 - primary key (borrow_ID) -); - -/*==============================================================*/ -/* Table: floormassage */ -/*==============================================================*/ - --- 楼层信息表 -create table floormassage -( - ID int not null auto_increment, -- 楼层编号 - lib_ID int not null, -- 图书馆编号 - floor char(3) not null, -- 楼层 - shelf_ID int not null, -- 书架编号 - linenum int not null, -- 行号 - type char(10) not null, -- 类型 - primary key (ID) -); - -/*==============================================================*/ -/* Table: get */ -/*==============================================================*/ - --- 接收人 -create table gett -( - worker_ID int not null, -- 管理员编号 - return_ID int not null, -- 归还编号 - primary key (worker_ID, return_ID) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ - --- 图书馆表 -create table library -( - lib_ID int not null auto_increment, -- 图书馆编号 - user_ID int not null, -- 用户编号 - lib_name varchar(10) not null, -- 图书馆名称 - primary key (lib_ID) -); - -/*==============================================================*/ -/* Table: put */ -/*==============================================================*/ - --- 放置图书 -create table put -( - lib_ID int not null, -- 楼层编号 - worker_ID int not null, -- 管理员编号 - primary key (lib_ID, worker_ID) -); - -/*==============================================================*/ -/* Table: "return" */ -/*==============================================================*/ - --- 归还信息表 -create table return_book -( - return_ID int not null auto_increment, -- 归还编号 - user_ID int not null, -- 用户编号 - return_date date not null, -- 归还时间 - primary key (return_ID) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ - --- 用户登录表 -create table user -( - user_ID int not null auto_increment, -- 用户编号 - user_name varchar(5) not null, -- 用户姓名 - password varchar(10) not null, -- 密码 - primary key (user_ID) -); - -/*==============================================================*/ -/* Table: userinfo */ -/*==============================================================*/ - --- 用户信息表 -create table userinfo -( - userinfo_ID int not null auto_increment, -- 用户信息编号 - user_ID int not null, -- 用户编号 - userinfo_name varchar(6) not null, -- 用户姓名 - userinfo_sex char(1) not null, -- 用户性别 - college char(10) not null, -- 学院 - major char(15) not null, -- 专业 - grade char(20) not null, -- 年级 - class char(20) not null, -- 班级 - user_tel char(15) not null, -- 用户电话 - primary key (userinfo_ID) -); - -/*==============================================================*/ -/* Table: work */ -/*==============================================================*/ - --- 管理员信息表 -create table work -( - worker_ID int not null auto_increment, -- 员工编号 - worker_name varchar(5) not null, -- 员工姓名 - worker_sex char(1) not null, -- 员工性别 - worker_tel char(12) not null, -- 员工电话 - worker_salary int not null, -- 员工工资 - primary key (worker_ID) -); - -alter table bookinfo add constraint FK_check_book foreign key (ID) - references floormassage (ID) on delete restrict on update restrict; - -alter table borrow add constraint FK_borrow foreign key (book_ID) - references bookinfo (book_ID) on delete restrict on update restrict; - -alter table floormassage add constraint FK_check_floor foreign key (lib_ID) - references library (lib_ID) on delete restrict on update restrict; - -alter table gett add constraint FK_get foreign key (worker_ID) - references work (worker_ID) on delete restrict on update restrict; - -alter table gett add constraint FK_get2 foreign key (return_ID) - references return_book (return_ID) on delete restrict on update restrict; - -alter table library add constraint FK_check foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - -alter table put add constraint FK_put foreign key (lib_ID) - references library (lib_ID) on delete restrict on update restrict; - -alter table put add constraint FK_put2 foreign key (worker_ID) - references work (worker_ID) on delete restrict on update restrict; - -alter table return_book add constraint FK_return foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - -alter table userinfo add constraint FK_information foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - - ### 用户登录 - -insert into user values -- 用户登录 -(001,'小梅','123'), -(002,'小晶','456'), -(003,'小芳','789'); - - - ### 用户信息表 -insert into userinfo values -(101,001,'韩梅梅','女','软件工程学院','前端','22级','1班','1234567892'), -(102,002,'郭晶晶','女','软件工程学院','后端','22级','2班','2345678925'), -(103,003,'李静芳','女','软件工程学院','新媒体','22级','10班','1234567894'); - - -### 图书馆信息表 -insert into library values -(201,001,'北京市图书馆'), -(202,002,'龙岩市图书馆'), -(203,003,'厦门市图书馆'); - -### 楼层信息表 -insert into floormassage values -(301,201,'四楼',337,1,'外国著作'), -(302,202,'六楼',338,2,'文学经典'), -(303,203,'五楼',339,3,'仙侠类'); - -### 书籍具体信息表 -insert into bookinfo values -- 图书信息 -(401,301,'战争与和平','列夫托尔斯泰','1869-6-6',45), -(402,302,'活着','余华','1992-12-2',60), -(403,303,'花千骨','果果','2018-12-31',80.8); - - - - - -### 借阅信息表 -insert into borrow values -- 图书借阅 -(501,401,'2023-04-16','2023-05-16'), -(502,402,'2023-04-16','2023-05-16'), -(503,403,'2023-04-16','2023-05-16'); - - - - -### 归还信息表 -insert into return_book values -- 归还图书 -(601,001,'2023-04-25'), -(602,002,'2023-05-10'), -(603,003,'2023-05-16'); - - - -### 管理员 -insert into work values -(701,'张三','男','1594628347',5000), -(702,'李四','男','1569821347',4000), -(703,'李雪','女','1634957612',3000); - - --- 接受表 -insert into gett values -(701,601), -(702,602), -(703,603); - --- 放置表 -insert into put values -(201,701), -(202,702), -(203,703); - - - -``` - diff --git "a/29 \350\267\257\347\216\262/20230912 \347\224\265\345\275\261\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/29 \350\267\257\347\216\262/20230912 \347\224\265\345\275\261\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index 81c0ea9b5fac40ab6e0e3fac119beada32c1853d..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230912 \347\224\265\345\275\261\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,386 +0,0 @@ -```mysql --- 创建数据库 -create database film_message charset utf8; --- 使用数据库 -use film_message; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 20:13:50 */ -/*==============================================================*/ - - -drop table if exists actor_directors_screenwriters; - -drop table if exists actorr; - -drop table if exists collect; - -drop table if exists country; - -drop table if exists film; - -drop table if exists film_address; - -drop table if exists film_language; - -drop table if exists film_type; - -drop table if exists language; - -drop table if exists personal; - -drop table if exists phone; - -drop table if exists relation; - -drop table if exists short; - -drop table if exists type; - - -/*==============================================================*/ -/* Table: actor_directors_screenwriters */ -/*==============================================================*/ --- 演员,导演,编剧表 -create table actor_directors_screenwriters -( - films_id int not null, -- 影视编号 - actor_id int not null, -- 演员编号 - primary key (films_id, actor_id) -); - -/*==============================================================*/ -/* Table: actorr */ -/*==============================================================*/ --- 演员表 -create table actorr -( - actor_id int not null auto_increment,-- 演员编号 - actor_name char(20) not null, -- 演员姓名 - actor_sex char(1) not null, -- 演员性别 - primary key (actor_id) -); - -/*==============================================================*/ -/* Table: collect */ -/*==============================================================*/ --- 收藏片单表 -create table collect -( - collect_id int not null auto_increment,-- 收藏编号 - collect_time date not null, -- 收藏时间 - collect_language char(50) not null, -- 推荐语 - collect_join char(2) not null, -- 是否加入到豆列 - primary key (collect_id) -); - -/*==============================================================*/ -/* Table: country */ -/*==============================================================*/ --- 国家地区表 -create table country -( - country_id int not null auto_increment,-- 国家编号 - country_name char(15) not null, -- 国家名称 - primary key (country_id) -); - -/*==============================================================*/ -/* Table: film */ -/*==============================================================*/ --- 影视作品表 -create table film -( - films_id int not null auto_increment,-- 影视编号 - collect_id int not null, -- 收藏编号 - films_name char(10) not null, -- 影视名称 - films_date date not null, -- 上映日期 - films_duration int not null, -- 片长 - films_score numeric(4,2) not null, -- 豆瓣评分 - primary key (films_id) -); - -/*==============================================================*/ -/* Table: film_address */ -/*==============================================================*/ --- 影视地区表 -create table film_address -( - country_id int not null,-- 国家编号 - films_id int not null,-- 影视编号 - primary key (country_id, films_id) -); - -/*==============================================================*/ -/* Table: film_language */ -/*==============================================================*/ --- 影视语言表 -create table film_language -( - language_id int not null,-- 语言编号 - films_id int not null,-- 影视编号 - primary key (language_id, films_id) -); - -/*==============================================================*/ -/* Table: film_type */ -/*==============================================================*/ --- 影视类型表 -create table film_type -( - films_id int not null,-- 影视编号 - type_id int not null,-- 类型编号 - primary key (films_id, type_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ --- 语言表 -create table language -( - language_id int not null auto_increment,-- 语言编号 - language_name char(10) not null, -- 语言名称 - primary key (language_id) -); - -/*==============================================================*/ -/* Table: personal */ -/*==============================================================*/ --- 个人信息表 -create table personal -( - personal_id int not null auto_increment,-- 个人信息编号 - personal_name char(20) not null, -- 姓名 - personal_sex char(1) not null, -- 性别 - personal_date date not null, -- 出生日期 - personal_address char(10) not null, -- 出生地 - personal_star char(3) not null, -- 星座 - primary key (personal_id) -); - -/*==============================================================*/ -/* Table: phone */ -/*==============================================================*/ --- 图片表 -create table phone -( - phone_id int not null auto_increment,-- 图片编号 - films_id int not null, -- 影视编号 - phone_name char(50) not null, -- 图片地址 - primary key (phone_id) -); - -/*==============================================================*/ -/* Table: relation */ -/*==============================================================*/ --- 关系表 -create table relation -( - films_id int not null, -- 影视编号 - personal_id int not null, -- 个人信息编号 - primary key (films_id, personal_id) -); - -/*==============================================================*/ -/* Table: short */ -/*==============================================================*/ --- 短评表 -create table short· -( - short_id int not null auto_increment, -- 短评编号 - personal_id int not null, -- 个人信息编号 - films_id int not null, -- 影视编号 - short_want char(2) not null, -- 是否想看 - short_look char(2) not null, -- 是否看过 - short_rating char(10) not null, -- 评价等级 - short_label char(10) not null, -- 标签 - short_comment char(100) not null, -- 简短评论 - short_ilook char(5) not null, -- 是否仅自己可见 - primary key (short_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ --- 类型表 -create table type -( - type_id int not null auto_increment, -- 类型编号 - type_name char(10) not null, -- 类型名称 - primary key (type_id) -); - -alter table actor_directors_screenwriters add constraint FK_actor_directors_screenwriters foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table actor_directors_screenwriters add constraint FK_actor_directors_screenwriters2 foreign key (actor_id) - references actorr (actor_id) on delete restrict on update restrict; - -alter table film add constraint FK_enshrine foreign key (collect_id) - references collect (collect_id) on delete restrict on update restrict; - -alter table film_address add constraint FK_film_address foreign key (country_id) - references country (country_id) on delete restrict on update restrict; - -alter table film_address add constraint FK_film_address2 foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table film_language add constraint FK_film_language foreign key (language_id) - references language (language_id) on delete restrict on update restrict; - -alter table film_language add constraint FK_film_language2 foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table film_type add constraint FK_film_type foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table film_type add constraint FK_film_type2 foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table phone add constraint FK_poster foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table relation add constraint FK_relation foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table relation add constraint FK_relation2 foreign key (personal_id) - references personal (personal_id) on delete restrict on update restrict; - -alter table short add constraint FK_evaluation foreign key (personal_id) - references personal (personal_id) on delete restrict on update restrict; - -alter table short add constraint FK_loading foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - - - - - - --- 电影类型表 -insert into type - values - (111,"剧情"), - (112,"爱情"), - (113,"动作"); - --- 国家地区表 -insert into country - values - (121,"中国"), - (122,"韩国"), - (123,"英国"); - --- 语言表 -insert into language - values - (131,"中文"), - (132,"英语"), - (133,"韩语"); - - --- 演员表actorr -insert into actorr - values - (401,'席琳·宋','女'), - (402,'刘台午','男'), - (403,'约翰·马加罗','男'); - - --- collect -insert into collect - values - (501,'2023-09-30','很好看','加入'), - (502,'2022-08-21','好好看','加入'), - (503,'2023-07-11','好看','加入'); - --- 个人信息表 -insert into personal - values - (221,"小小",'女','2004-06-10','云南','双子座'), - (222,"肖军",'男','2002-04-21','四川','白羊座'), - (223,"瑞芮",'女','2003-01-18','山东','狮子座'); - --- 影视作品表 -insert into film - values - (021,501,'过往人生','2023-01-21',106,7.7), - (022,502,'生化危机','2022-05-12',127,7.8), - (023,503,'八角笼中','2023-06-06',150,7.2); - - --- phone -insert into phone - values - (310,021,'s?id=1775102085983294863&wfr=spider&for=pc'), - (311,022,'s?id=1768674709626395274&wfr=spider&for=pc'), - (312,023,'s?id=1768165498462546544&wfr=spider&for=pc'); - - --- short --- -insert into short - values - (661,221,021,'想看','看过','4颗星','我的观后感','非常好看','仅自己可见'), - (662,222,022,'想看','看过','4颗星','我的观后感','好好看','仅自己可见'), - (663,223,023,'想看','看过','5颗星','我的观后感','值得一看','仅自己可见'); - - - -- actor_directors_screenwriters --- -insert into actor_directors_screenwriters - values - (021,401), - (022,401), - (023,401); - --- film_address --- -insert into film_address - values - (121,021), - (121,022), - (121,023); - - --- film_language --- -insert into film_language - values - (131,021), - (132,022), - (133,023); - --- film_type --- -insert into film_type - values - (021,111), - (022,112), - (023,113); - --- relation --- -insert into relation - values - (021,221), - (022,222), - (023,223); - - - -``` - -## 图片 - -LDM; - -https://s2.loli.net/2023/09/12/MrmhwdXu1EYJ4Rf.jpg - - - -PDM: - -https://s2.loli.net/2023/09/12/RX8zq9dPCtMyWDl.jpg diff --git "a/29 \350\267\257\347\216\262/20230913 \345\214\273\351\231\242.md" "b/29 \350\267\257\347\216\262/20230913 \345\214\273\351\231\242.md" deleted file mode 100644 index f63f36f6049810cad77a83a79242e544bb03cf25..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230913 \345\214\273\351\231\242.md" +++ /dev/null @@ -1,256 +0,0 @@ -## 笔记 - -如果一个主体的属性有多个值,那么这个属性就可以拆成一个新的主体。 - -当三个表都是多对多关系时,可以另外设置一个表,将这三个表全部以1对多的关系连接这个另外设置的表, - -或者,在cdm时,先把其中两个表设成多对多的关系,等到ldm时,再将第三张表与生成的表连接。 - -LDM照片:https://s2.loli.net/2023/09/14/jdrQUcfnAsleLw6.jpg - -## 作业 - -```mysql --- 创建数据库 -create database hospital charset utf8; - --- 使用数据库 -use hospital; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-13 19:43:32 */ -/*==============================================================*/ - - -drop table if exists administrative_office;-- 科室 - -drop table if exists doctor;-- 医生 - -drop table if exists drug;-- 药品 - -drop table if exists inpatient_ward;-- 病房 - -drop table if exists nurse;-- 护士 - -drop table if exists nurse2;-- 护理 - -drop table if exists patient;-- 病人 - -drop table if exists user;-- 用 - -drop table if exists ward_type;-- 病房类型 - -/*==============================================================*/ -/* Table: administrative_office */ -/*==============================================================*/ -create table administrative_office -- 科室 -( - administrative_office_id int not null auto_increment,-- 科室编号 - administrative_office_name char(10) not null,-- 科室名称 - administrative_office_phone numeric(11,0) not null,-- 科室电话 - administrative_office_address char(100) not null,-- 科室地址 - primary key (administrative_office_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor-- 医生 -( - doctor_id int not null auto_increment,-- 医生编号 - administrative_office_id int,-- 科室编号 - doctor_name char(10) not null,-- 医生姓名 - doctor_sex char(1) not null,-- 医生性别 - doctor_post char(10) not null,-- 医生职务 - doctor_age char(10) not null,-- 医生年龄 - doctor_price numeric(6,0) not null,-- 医生工资 - doctor_phone int not null,-- 医生电话 - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug-- 药品 -( - drug_id int not null auto_increment,-- 药品编号 - drug_name char(10) not null,-- 药品名称 - drug_manufacturers char(10) not null,-- 药品厂家 - drug_price float(8,2) not null,-- 药品价格 - drug_date date not null,-- 生产日期 - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: inpatient_ward */ -/*==============================================================*/ -create table inpatient_ward-- 病房 -( - inpatient_ward_id int not null auto_increment,-- 病房编号 - ward_type_id int not null,-- 病房类型编号 - inpatient_ward_name int not null,-- 病房名称 - inpatient_ward_floor char(10) not null,-- 病房楼层 - inpatient_ward_sum char(10) not null,-- 病房栋数 - primary key (inpatient_ward_id) -); - -/*==============================================================*/ -/* Table: nurse */ -/*==============================================================*/ -create table nurse-- 护士 -( - nurse_id int not null auto_increment,-- 护士编号 - nurse_name char(10) not null,-- 护士姓名 - nurse_sex char(1) not null,-- 护士性别 - nurse_age char(5) not null,-- 护士年龄 - nurse_price numeric(6,0) not null,-- 护士工资 - primary key (nurse_id) -); - -/*==============================================================*/ -/* Table: nurse2 */ -/*==============================================================*/ -create table nurse2-- 护理 -( - nurse_id int not null,-- 护士编号 - patient_id int not null,-- 患者编号 - primary key (nurse_id, patient_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient-- 病人 -( - patient_id int not null auto_increment,-- 患者编号 - doctor_id int,-- 医生编号 - inpatient_ward_id int,-- 病房编号 - patient_name char(10) not null,-- 患者名称 - patient_sex char(1) not null,-- 患者性别 - patient_age int not null,-- 患者年龄 - patient_history char(100) not null,-- 患者年龄 - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: "use" */ -/*==============================================================*/ -create table user-- 用 -( - drug_id int not null,-- 药品编号 - patient_id int not null,-- 患者编号 - primary key (drug_id, patient_id) -); - -/*==============================================================*/ -/* Table: ward_type */ -/*==============================================================*/ -create table ward_type-- 病房类型 -( - ward_type_id int not null auto_increment,-- 病房类型编号 - administrative_office_id int,-- 科室编号 - ward_type_name char(10) not null,-- 病房类型名称 - ward_type_price numeric(6,0) not null,-- 病房类型价格 - primary key (ward_type_id) -); - -alter table doctor add constraint FK_subordinate foreign key (administrative_office_id) - references administrative_office (administrative_office_id) on delete restrict on update restrict; - -alter table inpatient_ward add constraint FK_set foreign key (ward_type_id) - references ward_type (ward_type_id) on delete restrict on update restrict; - -alter table nurse2 add constraint FK_nurse foreign key (nurse_id) - references nurse (nurse_id) on delete restrict on update restrict; - -alter table nurse2 add constraint FK_nurse2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table patient add constraint FK_Indications foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table patient add constraint FK_check_in foreign key (inpatient_ward_id) - references inpatient_ward (inpatient_ward_id) on delete restrict on update restrict; - -alter table user add constraint FK_use foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -alter table user add constraint FK_use2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table ward_type add constraint FK_belong foreign key (administrative_office_id) - references administrative_office (administrative_office_id) on delete restrict on update restrict; - - - --- 添加数据 - --- 插入科室表 -INSERT INTO administrative_office VALUES -(1,'骨科','16022585641','5栋101'), -(2,'普外科','16045928945','5栋102'), -(3,'妇科','15856842584','5栋103'), -(4,'内科','16053985698','5栋104'); - --- 插入护士表 -INSERT INTO nurse VALUES -(331,'吴天灵','女','25','5600'), -(332,'刘桂花','女','28','5800'), -(333,'王娜娜','女','22','4500'), -(334,'吴胡丽','女','32','8200'); - - --- 插入病房类型表 -INSERT INTO ward_type VALUES -(441,1,'ICU','15000'), -(442,2,'普通病房','120'), -(443,3,'vip独立病房','560'); - --- 插入病房表 -INSERT INTO inpatient_ward VALUES -(551,441,101,'1层','6栋'), -(552,442,102,'2层','6栋'), -(553,443,103,'3层','7栋'), -(554,442,104,'4层','8栋'); - --- 插入药品表 -INSERT INTO drug VALUES -(221,'布洛芬缓释胶囊','北京同仁堂','11','2023-04-12'), -(222,'复方氨基比林','北京双鹤药业','42','2023-02-12'), -(223,'苯巴比妥钠','北京双鹤药业','15','2022-12-15'), -(224,'复方愈创木酚磺酸钾','厦门星鲨制药','15','2023-06-26'), -(225,'维生素B2片','吉林敖东药业集团','13','2023-2-08'); - - - --- 插入医生表 -INSERT INTO doctor VALUES -(111,'1','李斯','男','住院医师','45岁','6500','1505526528'), -(112,'2','张武','男','主治医师','32岁','5200','1605566656'), -(113,'3','王䦹福','女','副主任医师','52岁','7500','1605558551'), -(114,'2','刘民生','男','主任医师','56岁','5600','1803694413'); - --- 插入病人表 -INSERT INTO patient VALUES -(881,111,551,'李黎明','男','25','花粉过敏'), -(882,112,554,'张栋国','男','42','花生过敏'), -(883,114,552,'刘建国','男','56','无'), -(884,113,553,'张立业','男','45','无'); - - --- 插入护理表 -INSERT INTO nurse2 VALUES -(331,881), -(332,882), -(333,883); - --- 插入用药表 -INSERT INTO user VALUES -(221,881), -(222,882), -(223,883); - - -``` - diff --git "a/29 \350\267\257\347\216\262/20230914 \350\256\262\350\247\243\345\214\273\351\231\242.md" "b/29 \350\267\257\347\216\262/20230914 \350\256\262\350\247\243\345\214\273\351\231\242.md" deleted file mode 100644 index b1e888ac087dfa7bd37e18031bab6bb98da39317..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230914 \350\256\262\350\247\243\345\214\273\351\231\242.md" +++ /dev/null @@ -1,170 +0,0 @@ - - -```mysql --- 创建数据库 -create database book_test charset utf8; --- 使用数据库 -use book_test; - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-14 16:46:42 */ -/*==============================================================*/ - - -drop table if exists Administrator; - -drop table if exists books; - -drop table if exists manage; - -drop table if exists reader; - -drop table if exists reading; - -/*==============================================================*/ -/* Table: Administrator */ -/*==============================================================*/ -create table Administrator -( - Administrator_id int not null auto_increment, - Administrator_name char(10) not null, - Administrator_sex char(1) not null, - Administratorsalary int not null, - Administrator_phone int not null, - primary key (Administrator_id) -); - -/*==============================================================*/ -/* Table: books */ -/*==============================================================*/ -create table books -( - books_id int not null auto_increment, - books_name char(10) not null, - books_author char(10) not null, - books_date date not null, - primary key (books_id) -); - -/*==============================================================*/ -/* Table: manage */ -/*==============================================================*/ -create table manage -( - books_id int not null, - Administrator_id int not null, - manage_date date, - primary key (books_id, Administrator_id) -); - -/*==============================================================*/ -/* Table: reader */ -/*==============================================================*/ -create table reader -( - reader_id int not null auto_increment, - reader_name char(10) not null, - reader_sex char(1) not null, - reader_college char(100) not null, - reader_clazz char(10) not null, - reader_phone int not null, - reader_address char(10) not null, - primary key (reader_id) -); - -/*==============================================================*/ -/* Table: reading */ -/*==============================================================*/ -create table reading -( - books_id int not null, - reader_id int not null, - reading_date date not null, - primary key (books_id, reader_id) -); - -alter table manage add constraint FK_manage foreign key (books_id) - references books (books_id) on delete restrict on update restrict; - -alter table manage add constraint FK_manage2 foreign key (Administrator_id) - references Administrator (Administrator_id) on delete restrict on update restrict; - -alter table reading add constraint FK_reading foreign key (books_id) - references books (books_id) on delete restrict on update restrict; - -alter table reading add constraint FK_reading2 foreign key (reader_id) - references reader (reader_id) on delete restrict on update restrict; - - - --- 添加数据 - --- 读者 -insert into reader values -(111,'张三','男','软件工程学院','1班',135644643,'新疆'), -(112,'李苗苗','女','信息工程学院','3班',134565138,'北京'), -(113,'韩梅梅','女','医学院','5班',134565138,'云南'), -(114,'王五','男','土木工程学院','2班',134565135,'广西'), -(115,'李涛','男','软件工程学院','6班',134565165,'甘肃'); - - --- 图书 -insert into books values -(221,'西游记','吴承恩','1850-06-06'), -(222,'水浒传','施耐庵','1820-12-06'), -(223,'三国演义','罗贯中','1860-04-12'), -(224,'红楼梦','曹雪芹','1806-09-25'), -(225,'活着','余华','2022-08-18'); - - --- 管理员 -insert into Administrator values -(331,'李强','男',6000,134618944), -(332,'刘强','男',5000,134465645), -(333,'张杰','男',5500,134941234), -(334,'王伟','男',3000,134944564), -(335,'曹植','男',3500,134821348); --- 看书表 -insert into reading values -(221,111,'2015-05-26'), -(222,112,'2018-09-15'), -(223,113,'2019-06-17'), -(224,114,'2023-05-19'), -(225,115,'2020-12-15'); - - - -insert into reading values -(221,111,''), -(221,111,''), -(221,111,''), -(221,111,''), - - --- 管理表 - -insert into manage values -(221,331,'2015-05-05'), -(222,332,'2016-06-06'), -(223,333,'2021-03-23'), -(224,334,'2022-05-26'), -(225,335,'2023-05-27'); - - - --- 查看数据 - --- 1.查看张三什么时候去的图书馆 -select r.reader_name 读者,rd.reading_date 观看日期 from reader r left join reading rd on r.reader_id=rd.reader_id where r.reader_name ='张三'; - --- 查看王五看了什么书 -select r.reader_name 姓名,bs.books_name 书名 from reader r left join reading rd on r.reader_id=rd.reader_id -left join books bs on rd.books_id=bs.books_id where r.reader_name ='王五'; - - - - -``` - diff --git "a/29 \350\267\257\347\216\262/20230915 \346\261\275\350\275\246.md" "b/29 \350\267\257\347\216\262/20230915 \346\261\275\350\275\246.md" deleted file mode 100644 index 68d933f7311f85dfc46887f0ba2b5c5634d67b8b..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230915 \346\261\275\350\275\246.md" +++ /dev/null @@ -1,190 +0,0 @@ -## 笔记 - -照片:https://s2.loli.net/2023/09/17/DCdcbzkqsULpeGt.jpg - -# 任务: - -- 给一个汽车商店设计销售系统的数据库 - -- 顶层实体:汽车、顾客、销售员 - -# 目标: - -- 完成概念模型、逻辑模型、物理模型 - -- 生成DDL SQL语句,建立对应数据库和表结构 - -- 模拟真实数据给每个表插入一些数据。并根据应用场景需求完成 DQL语句 - -# 需求: - -- 1.能记录在售车型的信息、销售员的基本信息、客户的基本信息 - -- 2.进行车辆售卖时,记录销售员、客户、销售日期、实际售卖价格等信息 - -- 3.满足实际应用场景下的数据查询功能 - - -# 应用场景: - -- 1.查询特定销售员的销售记录 - -- 2.查找销售记录中销售价格最高的汽车 - -- 3.统计某个销售员的销售总额 - -- 4.根据客户信息查询其购买过的汽车 - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - -- 8.统计每个销售员的销售数量 - - - -```mysql --- 创建数据库 -create database automobile_sell charset utf8; - --- 使用数据库 -use automobile_sell; - - - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:40:23 */ -/*==============================================================*/ - - -drop table if exists automobile; - -drop table if exists client; - -drop table if exists salesman; - -drop table if exists sell; - -/*==============================================================*/ -/* Table: automobile */ -/*==============================================================*/ -create table automobile -( - automobile_id int not null auto_increment, - automobile_name char(20) not null, - automobile_price numeric(10,0) not null, - automobile_address char(20) not null - primary key (automobile_id) -); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - client_id int not null auto_increment, - client_name char(10) not null, - client_sex char(1) not null, - client_phone char(20) not null, - primary key (client_id) -); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id int not null auto_increment, - salesman_name char(10) not null, - salesman_sex char(1) not null, - salesman_phone char(20) not null, - primary key (salesman_id) -); - -/*==============================================================*/ -/* Table: sell */ -/*==============================================================*/ -create table sell -( - sell_id int not null auto_increment, - client_id int, - salesman_id int, - automobile_id int not null, - sell_prcie numeric(10,0) not null, - sell_date date not null, - primary key (sell_id) -); - -alter table sell add constraint FK_Automobile_information foreign key (automobile_id) - references automobile (automobile_id) on delete restrict on update restrict; - -alter table sell add constraint FK_buy foreign key (client_id) - references client (client_id) on delete restrict on update restrict; - -alter table sell add constraint FK_market foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - - --- 添加数据 - --- 顾客信息 -insert into client values -(111,'张三','男','150-7898-8456'), -(112,'李四','男','150-1368-4895'), -(113,'王五','男','150-1468-1564'), -(114,'韩梅梅','女','159-1468-1349'), -(115,'张晓丽','女','158-1485-7499'), -(116,'李钊','男','151-2548-5264'); - - - --- 销售员 -insert into salesman values -(221,'熊大','男','154-4455-1259'), -(222,'熊二','男','153-4125-4295'), -(223,'光头强','男','154-1234-0069'), -(224,'玛特纳','女','151-0012-2356'), -(225,'向巧巧','女','150-8566-0013'), -(226,'张杰','男','154-1859-3015'); - - --- 汽车 -insert into automobile values -(331,'红旗',66666,'中国'), -(332,'长城',50000,'中国'), -(333,'林肯',20000,'美国'), -(334,'雪弗兰',15000,'美国'), -(335,'东风',25000,'中国'), -(336,'本田',30000,'日本'); - --- 售卖信息 -insert into sell values -(441,111,221,331,66666,'2023-02-06'), -(442,112,222,332,49000,'2012-06-25'), -(443,113,224,333,10000,'2009-05-25'), -(444,114,224,334,10000,'2016-07-24'), -(445,115,225,336,15000,'2019-08-29'), -(446,116,226,331,66666,'2023-05-26'); - --- 查询 --- 1.查询特定销售员的销售记录 -select sm.salesman_name 销售员姓名, a.automobile_name 销售车辆品牌,s.sell_date 销售日期,s.sell_prcie 销售实际价格 -from salesman sm -left join sell s on sm.salesman_id=s.salesman_id -left join automobile a on s.automobile_id =a.automobile_id -where sm.salesman_name ='玛特纳'; - -- 2.查找销售记录中销售价格最高的汽车 - select s.sell_prcie 销售最高价格,a.automobile_name 汽车品牌 - from sell s left join automobile a on s.automobile_id=a.automobile_id - where a.automobile_id=(select distinct(automobile_id) from sell where sell_prcie =(select max(sell_prcie) from sell)) - -- 3.统计某个销售员的销售总额 - select salesman_name 销售员,sum(sell_prcie) 销售总额 from sell s left join salesman sa on s.salesman_id=sa.salesman_id - where sa.salesman_name='玛特纳'; - -- 4.根据客户信息查询其购买过的汽车 - -- 一个客户 - select c.client_name 客户姓名,a.automobile_name 汽车品牌 from client c left join sell s on c.client_id=s.client_id - left join automobile a on s.automobile_id=a.automobile_id where c.client_name ='张晓丽'; - - -- - select c.client_name 客户姓名,a.automobile_name 汽车品牌 from client c left join sell s on c.client_id=s.client_id - left join automobile a on s.automobile_id=a.automobile_id ; - - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - select automobile_name 品牌,count(sell_id) 销售数量,sum(sell_prcie) 销售总额 from sell s left join automobile a on s.automobile_id=a.automobile_id GROUP BY a.automobile_name; - -- 6.检索特定日期范围内的销售了哪些汽车 - select s.sell_date 销售日期,a.automobile_name 汽车品牌 from sell s left join automobile a on s.automobile_id=a.automobile_id where s.sell_date between '2010-10-12' and '2020-01-01'; - -- 7.查找某车型的销售历史。 - select a.automobile_name 汽车品牌,s.sell_date 销售历史 from automobile a left join sell s on a.automobile_id=s.automobile_id where a.automobile_name ='红旗'; - -- 8.统计每个销售员的销售数量 - select sm.salesman_name 销售员,count(sell_id) 销售数量 from salesman sm left join sell s on sm.salesman_id=s.salesman_id GROUP BY salesman_name; - -``` - diff --git "a/29 \350\267\257\347\216\262/20230919 \346\237\245\350\257\242\347\273\203\344\271\240.md" "b/29 \350\267\257\347\216\262/20230919 \346\237\245\350\257\242\347\273\203\344\271\240.md" deleted file mode 100644 index 24404d84ed20708f5d6118660cfa2e2048308849..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230919 \346\237\245\350\257\242\347\273\203\344\271\240.md" +++ /dev/null @@ -1,829 +0,0 @@ -```mysql -create database work2_6 charset utf8; -use work2_6; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- - --- Table structure for countries - --- ---------------------------- - -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of countries - --- ---------------------------- - -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- - --- Table structure for departments - --- ---------------------------- - -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of departments - --- ---------------------------- - -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- - --- Table structure for employees - --- ---------------------------- - -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of employees - --- ---------------------------- - -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- - --- Table structure for job_grades - --- ---------------------------- - -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of job_grades - --- ---------------------------- - -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- - --- Table structure for job_history - --- ---------------------------- - -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of job_history - --- ---------------------------- - -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- - --- Table structure for jobs - --- ---------------------------- - -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of jobs - --- ---------------------------- - -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- - --- Table structure for locations - --- ---------------------------- - -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of locations - --- ---------------------------- - -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- - --- Table structure for order - --- ---------------------------- - -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of order - --- ---------------------------- - -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- - --- Table structure for regions - --- ---------------------------- - -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of regions - --- ---------------------------- - -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- - --- View structure for emp_details_view - --- ---------------------------- - -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -#; - -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - -select sum(salary*12) as 工资总和 FROM employees; - -# 2.查询employees表中去除重复的job_id以后的数据 - -#去除重复 distinct -select distinct job_id,employees.*from employees; - -# 3.查询工资大于12000的员工姓名和工资 - -select last_name,salary from employees where salary > 12000; - -# 4.查询员工号为176的员工的姓名和部门号 - -select last_name,department_id from employees where employee_id = 176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -select last_name,salary from employees where salary < 5000 or salary > 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select last_name,department_id from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -select emp.last_name,emp.job_id from employees emp join departments dep on emp.department_id=dep.department_id where emp.manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select * from employees where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select last_name from employees where last_name like '__尔%'; - - - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -select * from employees where first_name like '%特%' or first_name like '%尔%'; - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select * from employees where first_name like '%尔'; - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select first_name 姓名,job_id 工种 from employees where department_id BETWEEN 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select last_name,salary,manager_id from employees where manager_id in (100,101,110); - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select last_name,department_id,(salary+salary * IFNULL(commission_pct,0))*12 from employees ; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -select last_name,salary from employees where salary <8000 or salary>17000 ORDER BY salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select employees.*,email,length(email) 字节数 from employees where email like '%e%' order by 字节数 desc,department_id asc; - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - -select e.last_name,e.department_id,d.department_name from employees e left join departments d on e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -select e.job_id,d.location_id,d.department_id from employees e left join departments d on e.department_id=d.department_id where d.department_id=90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select e.last_name , d.department_name , l.location_id , city from employees e -left join departments d on e.department_id=d.department_id -left join locations l on l.location_id=d.location_id; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select e.last_name,e.job_id,d.department_id,d.department_name,city from employees e -left join departments d on e.department_id=d.department_id -left join locations l on l.location_id=d.location_id where city='多伦多'; - -#sql92语法(自然连接): - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -select dep.department_name 部门名称,loc.street_address 部门地址,emp.last_name 姓名,jobs.job_title 工作, emp.salary 工资 from employees emp -left join jobs on emp.job_id=jobs.job_id -left join departments dep on emp.department_id=dep.department_id -left join locations loc on dep.location_id=loc.location_id -where department_name='行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 - --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 -select a.last_name,a.employee_id,b.last_name,b.employee_id from employees a inner join employees b on a.employee_id=b.manager_id; - -# 7.查询哪些部门没有员工 - -select d.department_name from employees e right join departments d on e.department_id=d.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - -select city from departments dep right join locations loc on dep.location_id=loc.location_id where department_id is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select * from employees e join departments d on e.department_id=d.department_id where department_name in ('销售部','信息技术部'); - -# 第08章_聚合函数的课后练习 - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -select job_id,max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees GROUP BY job_id; - -#4.查询各个job_id的员工人数 -select job_id,count(job_id) from employees GROUP BY job_id; - -# 5.查询员工最高工资和最低工资的差距 - -select max(salary)-min(salary) from employees; - - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name,d.location_id,count(e.employee_id) 员工数量,avg(e.salary) 平均工资 from employees e left join departments d on e.department_id=d.department_id group by e.department_id order by avg(e.salary) desc; - - - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - SELECT - j.job_title 工种名, - d.department_name 部门名, - min( salary ) 最低工资 - FROM - jobs j - LEFT JOIN employees e ON j.job_id = e.job_id - LEFT JOIN departments d ON e.department_id = d.department_id - GROUP BY - j.job_title,d.department_name; - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - -select first_name,last_name,salary from employees where department_id =(select department_id from employees where last_name ='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - -select employee_id,first_name,last_name,salary from employees where salary >(select avg(salary) from employees ); - - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name,job_id,salary from employees where salary>(select max(salary) from employees where JOB_ID = 'SA_MAN'); - - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -select employee_id,first_name from employees where department_id =(SELECT department_id from employees where first_name like '%u%'); - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -select employee_id from employees where department_id= any(select department_id from departments where location_id=1700); - -#6.查询管理者是 金 的员工姓名和工资 - -select first_name,salary from employees where last_name like '金'; - -#7.查询工资最低的员工信息: last_name, salary - -select last_name,salary from employees where salary =(select min(salary) from employees); - -#8.查询平均工资最低的部门信息 - -select * from departments d left join employees e on d.department_id=e.department_id where e.salary=(select min(salary) from employees); - -#方式1: - -# 部门最低工资=全司最低 - -#方式2: - -# 部门平均<= 公司所有平均 - - - - -​ -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -select d.*,min(salary) from departments d left join employees e on d.department_id=e.department_id where e.salary=(select min(salary) from employees)group by e.department_id; - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -select * from jobs j left join employees e on j.job_id=e.job_id where salary=(select max(salary) from employees); - -#方式2:平均工资>=所有平均工资 - - -#11.查询平均工资高于公司平均工资的部门有哪些? - -select avg(salary) from employees; -select ifnull(department_id,0) from employees group by department_id having avg(salary)>(select avg(salary) from employees); - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - - -#方式2:子查询 -#员工编号=(管理员编号有哪些) -select * from employees a left join employees b on a.employee_id=b.manager_id; - - - -​ -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? -select department_id,min(最高工资) from (select max(salary) 最高工资,department_id from employees group by department_id) as a group by department_id; - - - -#方式: - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -select avg(salary) 平均工资 from employees group by department_id ; -select last_name,department_id,email,salary from employees group by department_id having avg(salary)=(select max(平均工资)from (select avg(salary) 平均工资 from employees group by department_id) as a); - - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: -select department_id from employees where job_id !='ST_CLERK'; - - - - - -#16. 选择所有没有管理者的员工的last_name -select last_name from employees where manager_id is null; - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: -select * from employees where last_name - -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 -select avg(salary) 平均工资,department_id from employees group by department_id; -select * from employees a left join (select avg(salary) 平均工资,department_id from employees group by department_id) -b on a.department_id=b.department_id where a.salary>b.平均工资; - - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -select department_id from employees group by department_id having count(department_id)>5; -select * from departments where department_id in(select department_id from employees group by department_id having count(department_id)>5); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) -select department_id from employees group by department_id having count(department_id)>5; -select * from departments where department_id in(select department_id from employees group by department_id having count(department_id)>5); -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` - diff --git "a/29 \350\267\257\347\216\262/20230920 RBAC.md" "b/29 \350\267\257\347\216\262/20230920 RBAC.md" deleted file mode 100644 index e084e60b2445b8b117a9022e8102a0afac8340ab..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230920 RBAC.md" +++ /dev/null @@ -1,155 +0,0 @@ -## RBAC - -基于角色的权限访问控制(Role-BasedAccessControl)作为传统访问控制(自主访问,强制访问)的有前景的代替受到广泛的关注。在RBAC中,权限与角色相关联,用户通过成为适当角色的成员而得到这些角色的权限。这就极大地简化了权限的管理。在一个组织中,角色是为了完成各种工作而创造,用户则依据它的责任和资格来被指派相应的角色,用户可以很容易地从一个角色被指派到另一个角色。角色可依新的需求和系统的合并而赋予新的权限,而权限也可根据需要而从某角色中回收。角色与角色的关系可以建立起来以囊括更广泛的客观情况。 - - - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:33:45 */ -/*==============================================================*/ --- 创建数据库 -create database exercise2_rbac; --- 使用数据库 -use exercise2_rbac; - -drop table if exists jurisdiction; - -drop table if exists role; - -drop table if exists role_jurisdiction; - -drop table if exists userr; - -drop table if exists userr_role; - -/*==============================================================*/ -/* Table: jurisdiction */ -/*==============================================================*/ -create table jurisdiction -( - jurisdiction_id int not null auto_increment, - jurisdiction_name char(10) not null, - primary key (jurisdiction_id) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name char(10) not null, - primary key (role_id) -); - -/*==============================================================*/ -/* Table: role_jurisdiction */ -/*==============================================================*/ -create table role_jurisdiction -( - jurisdiction_id int not null, - role_id int not null, - primary key (jurisdiction_id, role_id) -); - -/*==============================================================*/ -/* Table: userr */ -/*==============================================================*/ -create table userr -( - userr_id int not null auto_increment, - userr_name char(10) not null, - userr_password varchar(10) not null, - primary key (userr_id) -); - -/*==============================================================*/ -/* Table: userr_role */ -/*==============================================================*/ -create table userr_role -( - role_id int not null, - userr_id int not null, - primary key (role_id, userr_id) -); - -alter table role_jurisdiction add constraint FK_role_jurisdiction foreign key (jurisdiction_id) - references jurisdiction (jurisdiction_id) on delete restrict on update restrict; - -alter table role_jurisdiction add constraint FK_role_jurisdiction2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table userr_role add constraint FK_userr_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table userr_role add constraint FK_userr_role2 foreign key (userr_id) - references userr (userr_id) on delete restrict on update restrict; - - - - - --- 添加数据 -insert into userr VALUES -(1,'张三','111111'), -(2,'里斯','222222'), -(3,'王武','333333'), -(4,'韩梅梅','445445'), -(5,'李华','555555'), -(6,'王强','666666'); - - -insert into role VALUES -(1,'校长'), -(2,'教师'), -(3,'学生'); - - -insert into jurisdiction VALUES -(1,'首页'), -(2,'教师信息'), -(3,'学生信息'), -(4,'工资信息'); - - - -insert into userr_role VALUES -(1,1), -(2,2), -(2,3), -(3,4), -(3,5), -(3,6); - - - -insert into role_jurisdiction VALUES -(1,1), -(2,1), -(3,1), -(4,1), -(1,2), -(2,2), -(3,2), -(1,3), -(2,3); - - - --- 查看所有信息(自然连接) -select * FROM -userr u,userr_role ur,role r,role_jurisdiction rj,jurisdiction j -where u.userr_id=ur.userr_id -and ur.role_id=r.role_id -and r.role_id=rj.role_id -and rj.jurisdiction_id=j.jurisdiction_id -and u.userr_name='王强' -and u.userr_password='666666'; - - - - -``` - diff --git "a/29 \350\267\257\347\216\262/20230921 sku.md" "b/29 \350\267\257\347\216\262/20230921 sku.md" deleted file mode 100644 index 8913fa8c8f381957411b62548c685fe25ad9d9d8..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230921 sku.md" +++ /dev/null @@ -1,215 +0,0 @@ -## 笔记 - -SPU和SKU介绍及区别 -一、spu概念(商品) -SPU = Standard Product Unit (标准化产品单元) -  SPU是商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个产品的特性。 -通俗点讲,属性值、特性相同的商品就可以称为一个SPU。 - -二、sku概念(规格) -SKU=stock keeping unit(库存量单位) -  SKU即库存进出计量的单位, 可以是以件、盒、托盘等为单位。 -  SKU是物理上不可分割的最小存货单元。在使用时要根据不同业态,不同管理模式来处理。在服装、鞋类商品中使用最多最普遍。 - -三、spu和sku的区别 -举例说明: -  你想要一台iPhone XS, 店员也会再继续问: 你想要什么iPhone XS? 16G 银色?64G白色? -每一台iPhone XS的毛重都是420.00g,产地也都是中国大陆,这两个属性就属于spu属性。 -  而容量和颜色,这种会影响价格和库存的(比如16G与64G的价格不同,16G银色还有货,金色卖完了)属性就是sku属性。 -   -  spu属性: -  1、毛重420.00 g -  2、产地中国大陆 -   -  sku属性: -  2、容量: 16G, 64G, 128G -  3、颜色: 银、白、玫瑰金 -例如:iPhone X 可以确定一个产品即为一个SPU。 -例如:iPhone X 64G 银色 则是一个SKU。 -常规的业务流程。用户通过一个标有商品简略信息的入口点进一个商品页面,这时会有几个不同的配置、颜色、尺寸供选择,用户选择时需要判断这个商品是否有库存。 -这一系列操作中一个商品的页面会是一个SPU,最后检查的库存就是SKU - -## 作业 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:20:34 */ -/*==============================================================*/ -create database work2_11 charset utf8; -use work2_11; - -drop table if exists attribute; - -drop table if exists relevance; - -drop table if exists sku; - -drop table if exists spu; - -drop table if exists value; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table attribute -( - attribute_id int not null auto_increment, - attribute_namer varchar(20) not null, - primary key (attribute_id) -); - -/*==============================================================*/ -/* Table: relevance */ -/*==============================================================*/ -create table relevance -( - relevance_id int not null auto_increment, - sku_id int, - attribute_id int, - value_id int, - primary key (relevance_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_title varchar(50) not null, - sku_inventory int not null, - sku_price decimal(9,2) not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_text text, - primary key (spu_id) -); - -/*==============================================================*/ -/* Table: value */ -/*==============================================================*/ -create table value -( - value_id int not null auto_increment, - value_name varchar(50) not null, - primary key (value_id) -); - -alter table relevance add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table relevance add constraint FK_Relationship_3 foreign key (attribute_id) - references attribute (attribute_id) on delete restrict on update restrict; - -alter table relevance add constraint FK_Relationship_4 foreign key (value_id) - references value (value_id) on delete restrict on update restrict; - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - - - --- 插入数据 -insert into spu values -(111,'华为Mate60pro','遥遥领先'), -(112,'苹果12','有辐气咯'); - -insert into sku values -(221,111,'华为 旗舰手机 Mate60pro 12GB+512GB 白',200,6999.00), -(222,111,'华为 旗舰手机 Mate60pro 12GB+512GB 黑',300,6999.00), -(223,111,'华为 旗舰手机 Mate60pro 12GB+512GB 红',500,6999.00), -(224,111,'华为 旗舰手机 Mate60pro 12GB+1TB 白',200,7999.00), -(225,111,'华为 旗舰手机 Mate60pro 12GB+1TB 黑',300,7999.00), -(226,111,'华为 旗舰手机 Mate60pro 12GB+1TB 红',500,7999.00); - -insert into attribute values -(331,'颜色'), -(332,'内存'); - -insert into `value` VALUES -(441,'白色'), -(442,'黑色'), -(443,'红色'), -(444,'512GB'), -(445,'1TB'); - - -insert into relevance VALUES -(551,221,331,441), -(552,221,332,444), -(553,222,331,442), -(554,222,332,444), -(555,223,331,443), -(556,223,332,444), -(557,224,331,441), -(558,224,332,445), -(559,225,331,442), -(5510,225,332,445), -(5511,226,331,443), -(5512,226,332,445); - - - --- 查看所有信息 - -select * -from -spu p, -sku k, -attribute a, -`value` v, -relevance r -where p.spu_id=k.spu_id -and k.sku_id=r.sku_id -and a.attribute_id=r.attribute_id -and v.value_id=r.value_id; - - --- 根据 属性值查看sku的信息 -select * -from -spu p, -sku k, -attribute a, -`value` v, -relevance r -where p.spu_id=k.spu_id -and k.sku_id=r.sku_id -and a.attribute_id=r.attribute_id -and v.value_id=r.value_id -and k.sku_id=(SELECT a.sku_id FROM (select sku_id,value_name from relevance r,`value` v where r.value_id=v.value_id -and v.value_name='红色') a,(select sku_id,value_name from relevance r,`value` v where r.value_id=v.value_id -and v.value_name='1TB') b where a.sku_id=b.sku_id); - - - - - - - -SELECT a.sku_id FROM (select sku_id,value_name from relevance r,`value` v where r.value_id=v.value_id -and v.value_name='红色') a,(select sku_id,value_name from relevance r,`value` v where r.value_id=v.value_id -and v.value_name='1TB') b where a.sku_id=b.sku_id; - - - - - - -select * from relevance r,`value` v where r.value_id=v.value_id -and v.value_name='红色'; - -select * from relevance r,`value` v where r.value_id=v.value_id -and v.value_name='1TB'; -``` - diff --git "a/29 \350\267\257\347\216\262/20230924 \347\254\224\350\256\260.md" "b/29 \350\267\257\347\216\262/20230924 \347\254\224\350\256\260.md" deleted file mode 100644 index c672a5abbcf1cdfebde12a8b35dfefd147078afc..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230924 \347\254\224\350\256\260.md" +++ /dev/null @@ -1,246 +0,0 @@ -## 笔记 - -一、视图简介 -视图是从一个或几个基本表(或视图)导出的表。它与基本表不同,是一个虚表。数据库只存放视图的定义,而不存放视图对应的数据,这些数据仍存放在原来的基本表中。所以基本表中的数据发生变化,从视图中查询出的数据也就随之改变了。从这个意义上讲,视图就像一个窗口,透过它可以看到数据库中自己感兴趣的数据及其变化。 - -二、视图的优点 -既然视图的定义是基于基本表的,哪为什么还要定义视图呢?这是因为合理地使用视图能够带来许多好处: - -1. 视图能简化用户操作 - -视图机制使用户可以将注意力集中在所关心地数据上。如果这些数据不是直接来自基本表,则可以通过定义视图,使数据库看起来结构简单、清晰,并且可以简化用户的的数据查询操作。例如,那些定义了若干张表连接的视图,就将表与表之间的连接操作对用户隐藏起来了。换句话说,用户所作的只是对一个虚表的简单查询,而这个虚表是怎样得来的,用户无需了解。 - -2. 视图使用户能以多种角度看待同一数据 - -视图机制能使不同的用户以不同的方式看待同一数据,当许多不同种类的用户共享同一个数据库时,这种灵活性是非常必要的。 - -3. 视图对重构数据库提供了一定程度的逻辑独立性 - -数据的物理独立性是指用户的应用程序不依赖于数据库的物理结构。数据的逻辑独立性是指当数据库重构造时,如增加新的关系或对原有的关系增加新的字段,用户的应用程序不会受影响。层次数据库和网状数据库一般能较好地支持数据的物理独立性,而对于逻辑独立性则不能完全的支持。 - -在关许数据库中,数据库的重构造往往是不可避免的。重构数据库最常见的是将一个基本表“垂直”地分成多个基本表。例如:将学生关系Student(Sno,Sname,Ssex,Sage,Sdept), - -分为SX(Sno,Sname,Sage)和SY(Sno,Ssex,Sdept)两个关系。这时原表Student为SX表和SY表自然连接的结果。如果建立一个视图Student: - -```mysql -CREATE VIEW Student(Sno,Sname,Ssex,Sage,Sdept) - -AS - -SELECT SX.Sno,SX.Sname,SY.Ssex,SX.Sage,SY.Sdept - -FROM SX,SY - -WHERE SX.Sno=SY.Sno; - -``` - -这样尽管数据库的逻辑结构改变了(变为SX和SY两个表了),但应用程序不必修改,因为新建立的视图定义为用户原来的关系,使用户的外模式保持不变,用户的应用程序通过视图仍然能够查找数据。 - -当然,视图只能在一定程度上提供数据的逻辑独立,比如由于视图的更新是有条件的,因此应用程序中修改数据的语句可能仍会因为基本表构造的改变而改变。 - -4. 视图能够对机密数据提供安全保护 - -有了视图机制,就可以在设计数据库应用系统时,对不同的用户定义不同的视图,使机密数据不出现在不应该看到这些数据的用户视图上。这样视图机制就自动提供了对机密数据的安全保护功能。例如,Student表涉及全校15个院系学生数据,可以在其上定义15个视图,每个视图只包含一个院系的学生数据,并只允许每个院系的主任查询和修改本原系学生视图。 - -5. 适当的利用视图可以更清晰地表达查询 - -例如经常需要执行这样的查询“对每个学生找出他获得最高成绩的课程号”。可以先定义一个视图,求出每个同学获得的最高成绩: - -``` mysql - - -CREATE VIEW VMGRADE - -AS - -SELECT Sno,MAX(Grade) Mgrade - -FROM SC - -GROUP BY Sno; - ---然后用如下的查询语句完成查询: - -SELECT SC.Sno,Cno - -FROM SC,VMGRADE - -WHERE SC.Sno = VMGRADE.Sno AND SC.Grade = VMGRADE.Mgrade; -``` - -## 课堂练习 - -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-22 08:53:27 */ -/*==============================================================*/ -create database work2_12 charset utf8; -use work2_12; - - - -drop table if exists attribute; - -drop table if exists contact; - -drop table if exists sku; - -drop table if exists spu; - -drop table if exists valuee; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table attribute -( - attribute_id int not null auto_increment, - attribute_name varchar(50) not null, - primary key (attribute_id) -); - -/*==============================================================*/ -/* Table: contact */ -/*==============================================================*/ -create table contact -( - contact_id int not null auto_increment, - sku_id int, - attribute_id int, - valuee_id int, - primary key (contact_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_title varchar(50) not null, - sku_price decimal(5,2) not null, - sku_stork int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - primary key (spu_id) -); - -/*==============================================================*/ -/* Table: valuee */ -/*==============================================================*/ -create table valuee -( - valuee_id int not null auto_increment, - valuee_name varchar(50) not null, - primary key (valuee_id) -); - -alter table contact add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table contact add constraint FK_Relationship_3 foreign key (attribute_id) - references attribute (attribute_id) on delete restrict on update restrict; - -alter table contact add constraint FK_Relationship_4 foreign key (valuee_id) - references valuee (valuee_id) on delete restrict on update restrict; - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - - - - - - -- 插入数据 -insert into spu values -(111,'水果温显直杯'); - - - -insert into sku values -(221,111,'水果温显直杯 鸢尾蓝 280ml 304不锈钢',36.00,100), -(222,111,'水果温显直杯 祭红 280ml 304不锈钢',36.00,100), -(223,111,'水果温显直杯 竹青 280ml 304不锈钢',36.00,100), -(224,111,'水果温显直杯 鸢尾蓝 500ml 316不锈钢',88.00,200), -(225,111,'水果温显直杯 祭红 500ml 316不锈钢',88.00,200), -(226,111,'水果温显直杯 竹青 500ml 316不锈钢',88.00,200); - - -insert into attribute values -(331,'颜色'), -(332,'容量'), -(333,'材质'); - -insert into valuee values -(441,'鸢尾蓝'), -(442,'祭红'), -(443,'竹青'), -(444,'280ml'), -(445,'500ml'), -(446,'304不锈钢'), -(447,'316不锈钢'); - -insert into contact values -(551,221,331,441), -(552,221,332,444), -(553,221,333,446), -(554,222,331,442), -(555,222,332,444), -(556,222,333,446), -(557,223,331,443), -(558,223,332,444), -(559,223,333,446), -(5510,224,331,441), -- 鸢尾蓝 500ml 316不锈钢 -(5511,224,332,445), -(5512,224,333,447), -(5513,225,331,442), -(5514,225,332,445), -(5515,225,333,447), -(5516,226,331,443), -(5517,226,332,445), -(5518,226,333,447); - - --- 查询 - --- 查看所有信息 -select * from spu p,sku k,contact c,attribute a,valuee v -where p.spu_id=k.spu_id -and k.sku_id=c.sku_id -and a.attribute_id=c.attribute_id -and v.valuee_id=c.valuee_id; - - --- 根据属性值查看价格 -select c.sku_id,v.valuee_name from contact c,valuee v where c.valuee_id=v.valuee_id and v.valuee_name='鸢尾蓝'; -select c.sku_id,v.valuee_name from contact c,valuee v where c.valuee_id=v.valuee_id and v.valuee_name='280ml'; -select c.sku_id,v.valuee_name from contact c,valuee v where c.valuee_id=v.valuee_id and v.valuee_name='304不锈钢'; - -select a.sku_id from (select c.sku_id,v.valuee_name from contact c,valuee v where c.valuee_id=v.valuee_id and v.valuee_name='鸢尾蓝') a,(select c.sku_id,v.valuee_name from contact c,valuee v where c.valuee_id=v.valuee_id and v.valuee_name='280ml') b,(select c.sku_id,v.valuee_name from contact c,valuee v where c.valuee_id=v.valuee_id and v.valuee_name='304不锈钢') s where a.sku_id=b.sku_id and b.sku_id=s.sku_id; - -select * from spu p,sku k,contact c,attribute a,valuee v -where p.spu_id=k.spu_id -and k.sku_id=c.sku_id -and a.attribute_id=c.attribute_id -and v.valuee_id=c.valuee_id -and k.sku_id=(select a.sku_id from (select c.sku_id,v.valuee_name from contact c,valuee v where c.valuee_id=v.valuee_id and v.valuee_name='鸢尾蓝') a,(select c.sku_id,v.valuee_name from contact c,valuee v where c.valuee_id=v.valuee_id and v.valuee_name='280ml') b,(select c.sku_id,v.valuee_name from contact c,valuee v where c.valuee_id=v.valuee_id and v.valuee_name='304不锈钢') s where a.sku_id=b.sku_id and b.sku_id=s.sku_id); - - - - - -``` - - - diff --git "a/29 \350\267\257\347\216\262/20230926 \350\247\206\345\233\276\344\275\234\344\270\232.md" "b/29 \350\267\257\347\216\262/20230926 \350\247\206\345\233\276\344\275\234\344\270\232.md" deleted file mode 100644 index e9a4603b3e8bef909946047e4cf9e82c2df5689d..0000000000000000000000000000000000000000 --- "a/29 \350\267\257\347\216\262/20230926 \350\247\206\345\233\276\344\275\234\344\270\232.md" +++ /dev/null @@ -1,480 +0,0 @@ -## 笔记 - -一、什么是视图 - -¨ 视图是查看数据库表中数据的一种方法; - -·· 视图是一张虚拟的表,视图与数据库中存在的表不太相同。之前我们创建的表都是包含数据的,如用户信息订单信息。然而视图是不包含数据的。 - -¨ 视图提供了存储预定义的查询语句作为数据库中的对象以备以后使用的能力; - -¨ 视图只是一种逻辑对象,并不是物理对象,因为视图不占物理存储空间; - -¨ 在视图中被查询的表称为视图的基表; - -¨ 视图的内容包括:基表的列的子集或者行的子集;两个或者多个基表的联合;两个或者多个基表的连接;基表的统计汇总;另外一个视图的子集;视图和基表的混合。 - -二、视图的优点 - -1.集中用户使用的数据; - -2.掩码数据库的复杂性,视图把数据库设计的复杂性与用户屏蔽分开; - -3.简化用户权限的管理; - -4.为向其他应用程序输出而重新组织数据。 - -第二节 创建视图 - -1、用企业管理器创建通讯录 - -2、用企业管理器创建一个成绩单视图 - -```mysql -语法 - -: CREATE VIEW <视图名> [(列名1,列名2,……)] - -​ [WITH ENCRYPTION] - -​ AS - -​ SELECT_STATEMENT - -[WITH CHECK OPTION] - -功能:创建视图 - -例1:创建一个成绩单视图 - -CREATE VIEW dbo.vw_cjd(name, cid, result) - - AS - -​ SELECT name, report.cid, report.result FROM student JOIN report - -​ ON student.sid=report.sid - -例2:显示成绩单视图 - -Select * from vw_cjd - -例3:创建一个按专业统计平均年龄的视图 - - CREATE VIEW dbo.vw_avg(speciality, avage) - - AS - -​ SELECT speciality, avg(age) FROM student - -​ GROUP BY speciality - -例4:显示平均年龄视图 - -Select * from vw_avg - -第三节 修改视图与删除视图 - -\1. 修改视图 - -语法:ALTER VIEW <视图名> [(列名1,列名2,……)] [WITH ENCRYPTION] - - AS - -SELECT statement [WITH CHECK OPTION] - -例:修改视图vw_cjd - -ALTER VIEW vw_cjd - -AS - - Select name, report.cid, report.result, address From student join report - - ON student.sid=report.sid - -查看Select * from vw_cjd - -\2. 删除视图 - -语法:DROP VIEW <视图名> - -例:删除视图vw_cjd - - DROP VIEW vw_cjd - -第四节 视图定义信息 - -一、视图定义信息 - -1.在企业管理体制器中查看 - -2.查询视图Information_schema.views - -3.查询系统表syscomments - -4.使用命令 sp_helptext 对象名 - - - - -``` - -扩展: - - concat 、concat_ws、 group_concat函数 - ------- - -一、concat()函数可以连接一个或者多个字符串 - -  CONCAT(str1,str2,…) 返回结果为连接参数产生的字符串。如有任何一个参数为NULL ,则返回值为 NULL。 - -  select concat('11','22','33'); 112233 - -二、CONCAT_WS(separator,str1,str2,...) - -  是CONCAT()的特殊形式。第一个参数是其它参数的分隔符。分隔符的位置放在要连接的两个字符串之间。分隔符可以是一个字符串,也可以是其它参数。 - -  select concat_ws(',','11','22','33');  11,22,33 - -三、group_concat()分组拼接函数 - -  group_concat([DISTINCT] 要连接的字段 [Order BY ASC/DESC 排序字段] [Separator '分隔符']) - -  对下面的一组数据使用 group_concat() - -  | id |name - -  |1 | 10| -  |1 | 20| -  |1 | 20| -  |2 | 20| -  |3 | 200 | -  |3 | 500 | - -  1、select id,group_concat(name) from aa group by id; - -  |1 | 10,20,20| -  |2 | 20 | -  |3 | 200,500| - -  2、select id,group_concat(name separator ';') from aa group by id; - -  |1 | 10;20;20 | -  |2 | 20| -  |3 | 200;500 | - -  3、select id,group_concat(name order by name desc) from aa group by id; - -  |1 | 20,20,10 | -  |2 | 20| -  |3 | 500,200| - -  4、select id,group_concat(distinct name) from aa group by id; - -  |1 | 10,20| -  |2 | 20 | -  |3 | 200,500 | - - - - - -```mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - --- 题目 - - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -create view employee_vu as -select LAST_NAME 姓名,EMPLOYEE_ID 员工号,DEPARTMENT_ID 部门号 - from employees; - - -#2. 显示视图的结构 - -desc employee_vu; - -#3. 查询视图中的全部内容 -select * from employee_vu; - - -#4. 将视图中的数据限定在部门号是80的范围内 -create or replace view employee_vu as -select LAST_NAME 姓名,EMPLOYEE_ID 员工号,DEPARTMENT_ID 部门号 - from employees where department_id <=80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -create view emp_v1 as -select concat(last_name,' ',first_name) 员工姓名,salary 工资,email 邮箱 from employees where phone_number like '011%'; - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -create or replace view emp_v1 as -select CONCAT(last_name,' ',first_name) 员工姓名,email 邮箱,phone_number 电话号码,salary 工资 from employees where phone_number like '011%' and email like '%e%'; - - -#3. 向 emp_v1 插入一条记录,是否可以? --- 不可以 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -create or replace view emp_v1 as -select CONCAT(last_name,' ',first_name) 员工姓名,email 邮箱,phone_number 电话号码,(salary+1000) 工资 from employees ; - -#5. 删除emp_v1中姓名为Olsen的员工 -delete from emp_v1 where 员工姓名='Olsen'; - - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -create view emp_v2 as -select department_id 部门id,max(salary) 最高工资 from employees group by department_id having max(salary)>12000; - -#7. 向 emp_v2 中插入一条记录,是否可以? --- 不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view if exists emp_v2; -drop view if exists emp_v1; -``` - diff --git "a/33\351\227\253\347\273\247\345\221\250/20230905\345\244\247\344\272\214\347\254\254\344\270\200\350\212\202\350\257\276\345\255\246\344\271\240\350\247\204\345\210\222.md" "b/33\351\227\253\347\273\247\345\221\250/20230905\345\244\247\344\272\214\347\254\254\344\270\200\350\212\202\350\257\276\345\255\246\344\271\240\350\247\204\345\210\222.md" deleted file mode 100644 index 764479d8c18fd004b4586637e5cb1f01ec034517..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/20230905\345\244\247\344\272\214\347\254\254\344\270\200\350\212\202\350\257\276\345\255\246\344\271\240\350\247\204\345\210\222.md" +++ /dev/null @@ -1,56 +0,0 @@ -## 大二课程😂: - -1.MySQL高级课程 - -2.InnoDB储存引擎 - -3.Spring 是最流行的企业Java应用程序开发框架,易于快速开发健壮的Java应用程序,提供全面的基础架构支持。易于测试和可重用的代码。【特点:最流行,开源,轻量级(Spring框架基本版仅约2MB)】 - -4.SpringCloud 是一组即用型组件,可用于企业中构建分布式应用程序,主要用于为分布式环境中观察到的问题(如负载平衡,服务发现,断路等)提供即用型解决方案,易于集成到现有的Spring项目中。 - -5.Spring Boot Java开源框架,用于创建微服务,轻松创建独立且可用于生产的Spring应用程序。包含用于开发为服务的全面基础支持,能够开发出可以直接运行的企业级应用程序。 - -6.Spring MVC 开源Java平台,易于快速开发健壮的基于Java的web应用程序提供全面的基础框架支持。 - -7.MoNgoDB 基于分布式文件存储数据库,旨在为web应用提供可扩展的高性能数据存储解决方案【介于关系型数据库和非关系型数据库之间】 - -8.JavaScript(JS)具有函数优先的轻量级,作为web页面的脚本语言而出名,V8引擎出世后,也被用于非浏览器环境中,JavaScript程序在V8引擎下运行速度媲美二进制程序。 - -9.redis 在Java web中的应用:①存储缓存用的数据 - -​ ②需要高速读写的场合使用它快速读写 - -10.mybatis 优秀的持久层框架,支持自定义SQL,存储及高级映射 - -11.MVC(model view controller 模型视图控制器) - -12.SSM (Spring、SpringMVC、MyBatis) - -13.maven 服务于Java平台的自动化构建工具 - -14.Node.js 基于chrome JavaScript运行时建立的平台,Node.js是服务端的js,后端可部署一些高性能的服务。 - -15.vue.js 基于HTML,css,js构建,帮助开发者开发复杂的单页面应用 - -16.webAPi 网页应用接口:存储服务、消息服务、计算服务、信息服务、web2.0服务 - -17.Nginx 高效能的HTTP和反向代理的web服务器 - -18.中间件、签 中间件——分布式环境下支撑应用开发和集成的平台 - -​ 数据传输、数据访问、应用调度、系统构建、系统集成、远程管理 - -19.小程序 - -20.Linux服务器的部署 - -21.技术栈和技能树的关系: - -技术栈:一个项目多个方案中所需求的那个方案所需技术 - -技能树:个人本身所掌握的技术。 - -技能树>技术栈 - - - diff --git "a/33\351\227\253\347\273\247\345\221\250/20230906\344\275\234\344\270\2321.md" "b/33\351\227\253\347\273\247\345\221\250/20230906\344\275\234\344\270\2321.md" deleted file mode 100644 index cf91094e2dc11eaebcb8ad218519a161508c56a8..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/20230906\344\275\234\344\270\2321.md" +++ /dev/null @@ -1,107 +0,0 @@ -create database school charset utf8; - -use school; - --- 院系表 -create table department( - d_id int primary key, - d_name varchar(10), - d_address varchar(10) -); -insert into department values -(123,'软件工程学院','望云楼'), -(456,'信息工程学院','辛耕楼'), -(789,'建筑工程学院','万源楼'); - --- 专业表 -create table speciality( - s_id int primary key, - s_name varchar(10), - d_id int, - foreign key (d_id) references department(d_id) -); -insert into speciality values -(11,'软件技术与开发',123), -(22,'信息技术',456), -(33,'建筑设计',789); - --- 教室表 -create table classroom( -r_id int PRIMARY KEY, -r_name varchar(10) -); -insert into classroom values -(1,'实训一'), -(2,'实训二'), -(3,'实训三'); - --- 班级表 -create table class( - c_id int primary key, - c_name varchar(10), - s_id int, - foreign key (s_id) references speciality(s_id) -); -insert into class values -(1,'软件技术1班',11), -(2,'软件技术2班',11), -(3,'软件技术3班',11); - --- 课程表 -CREATE TABLE course( - couseId int PRIMARY key, - courseName varchar(10), - c_id int, - r_id int, - foreign key (c_id) references class(c_id), - foreign key (r_id) references classroom(r_id) -); -insert into course VALUES -(1,'java',1,2), -(2,'html',2,3), -(3,'mysql',3,1); - --- 教师表 -create table teacher( - t_id int primary key, - t_name varchar(10), - couseId int, - foreign key (couseId) references course(couseId) -); -insert into teacher values -(1,'张三',1), -(2,'张四',2), -(3,'张五',3); - --- 选修表 -create table `select` ( - selectId int primary key, - couseId int, - time varchar(20), - t_id int, - r_id int, - foreign key (couseId) references course(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references classroom(r_id) -); -insert into `select` values -(1,1,'周一上午',2,3), -(2,2,'周二下午',1,2), -(3,3,'周三上午',3,1); - --- 学生表 -create table student ( - id int primary key, - name varchar(10), - sex varchar(5), - age int, - address varchar(20), - c_id int, - selectId int, - foreign key (c_id) references class(c_id), - foreign key (selectId) references `select`(selectId) -); -insert into student values -(11111,'小明','男',18,'团结里1',1,1), -(22222,'小花','女',118,'团结里2',2,2), -(33333,'小王','男',1118,'团结里3',3,3); \ No newline at end of file diff --git "a/33\351\227\253\347\273\247\345\221\250/20230906\347\254\254\344\272\214\350\212\202\350\257\276\350\241\250\347\232\204\345\205\263\347\263\273\345\222\214ER\345\233\276.md" "b/33\351\227\253\347\273\247\345\221\250/20230906\347\254\254\344\272\214\350\212\202\350\257\276\350\241\250\347\232\204\345\205\263\347\263\273\345\222\214ER\345\233\276.md" deleted file mode 100644 index 66f94ff5a7b9a8b111540724781a3ac6fa2dc08f..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/20230906\347\254\254\344\272\214\350\212\202\350\257\276\350\241\250\347\232\204\345\205\263\347\263\273\345\222\214ER\345\233\276.md" +++ /dev/null @@ -1,18 +0,0 @@ -#### 1.表与表的关系: - -1对1,1对多,多对多。 - -##### 2.关系是相互的: - -一对一:任意一个表的主键作为另一个表的外键约束 - -一对多:把“一”的主键作为“多”的外键约束 - -多对多:必须引用第三张表(新增一张表) - -数据库设计步骤: - -1.需求分析 - -2.ER图(要素:实体(表)、属性(字段)、关系(类似外键约束)) - diff --git "a/33\351\227\253\347\273\247\345\221\250/20230921\344\275\234\344\270\232\347\254\224\350\256\260.md" "b/33\351\227\253\347\273\247\345\221\250/20230921\344\275\234\344\270\232\347\254\224\350\256\260.md" deleted file mode 100644 index 3d1cd071b9f9d37a6b9a6a94036b6adc7c30f082..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/20230921\344\275\234\344\270\232\347\254\224\350\256\260.md" +++ /dev/null @@ -1,147 +0,0 @@ -基于角色的权限访问控制 RBAC(Role- Based - Access - Control) - -基于角色的访问控制 (RBAC),也称为基于角色的安全性,是一种访问控制方法,可根据最终用户在组织中的角色为其分配权限。RBAC 提供了细粒度的控制,提供了一种简单、可管理的访问管理方法,与单独分配权限相比,这种方法更不容易出错。 - -在 RBAC 系统中,用户访问配置是基于一个基于共同职责和需求的组(例如营销部门)的需求。这意味着每个角色都有一组给定的权限,并且可以将个人分配给一个或多个角色。 - -例如,您可以将用户指定为管理员、专家或最终用户,并限制对特定资源或任务的访问。在组织内部,可以为不同的角色提供写访问权限,而其他角色可能只提供查看权限。 - -用户-角色和角色-权限关系使执行角色分配变得容易,因为各个用户不再具有唯一的访问权限,而是具有与分配给其特定角色或工作职能的权限一致的权限。 -RBAC 的好处包括: - -创建系统的、可重复的权限分配 -审核用户权限并更正已识别的问题 -添加、删除或更改角色,以及跨 API 调用实现它们 -减少分配用户权限时的潜在错误 - 通过为 第三方供应商和供应商 提供预定义角色来 降低 第三方风险 和 第四方风险 -更有效地遵守有关 机密性、完整性、可用性和隐私的法规和法定要求。随着 GDPR、 LGPD、 PIPEDA、 FIPA和 SHIELD 法案等通用数据保护法以及 CPS 234、 FISMA、 23 NYCRR 500和 HIPAA等行业特定法规的引入,这一点变得越来越重要 。 -允许您跨操作系统、平台和应用程序在全球范围内快速切换角色和权限,从而减少管理工作和 IT 支持 - 通过限制对敏感信息的访问来降低 数据泄露 和 数据泄露的风险 -———————————————— - - -~~~ mysql -create database text03 charset utf8; -use text03; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:27:53 */ -/*==============================================================*/ - - -drop table if exists menu; - -drop table if exists role; - -drop table if exists role_menu; - -drop table if exists `user`; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: menu */ -/*==============================================================*/ -create table menu -( - menu_id int not null auto_increment, - menu_name varchar(10) not null, - menu_address varchar(150) not null, - primary key (menu_id) -); -insert into menu values -(null,'首页','http://www.md.com/'), -(null,'查询学生信息','http://www.md.com/student'), -(null,'查询教师信息','http://www.md.com/teacher'), -(null,'查询教师工资','http://www.md.com/salary'); -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name varchar(10) not null, - primary key (role_id) -); -insert into role values -(null,'校长'), -(null,'老师'), -(null,'学生'); - -/*==============================================================*/ -/* Table: role_menu */ -/*==============================================================*/ -create table role_menu -( - menu_id int not null, - role_id int not null, - primary key (menu_id, role_id) -); -insert into role_menu values -(1,1), -(2,1), -(3,1), -(4,1), -(1,2), -(2,2), -(3,2), -(1,3), -(2,3); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table `user` -( - user_id int not null auto_increment, - user_name varchar(10) not null, - user_paw varchar(10) not null, - primary key (user_id) -); -insert into `user` values -(null,'张三','88888888'), -(null,'丘丘','66666666'), -(null,'小明','12345678'), -(null,'小红','12345678'); - -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - role_id int not null, - user_id int not null, - primary key (role_id, user_id) -); -insert into user_role values -(1,1), -(2,2), -(3,3), -(3,4); - -alter table role_menu add constraint FK_role_menu foreign key (menu_id) - references menu (menu_id) on delete restrict on update restrict; - -alter table role_menu add constraint FK_role_menu2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - - -delimiter $$ -create procedure proc01(in in_name varchar(5),in in_psw varchar(10)) -begin - select user_name,role_name,menu_name,menu_address - from `user` u,user_role ur,role r,role_menu rm,menu m where u.user_id = ur.user_id and ur.role_id = r.role_id and r.role_id = rm.role_id and rm.menu_id = m.menu_id and u.user_name = in_name and u.user_paw = in_psw; -end $$ -delimiter ; - -call proc01('张三','88888888'); -call proc01('丘丘','66666666'); -call proc01('小明','12345678'); -call proc01('小红','12345678'); \ No newline at end of file diff --git "a/33\351\227\253\347\273\247\345\221\250/20230921\347\254\224\350\256\260\344\270\216\344\275\234\344\270\232.md" "b/33\351\227\253\347\273\247\345\221\250/20230921\347\254\224\350\256\260\344\270\216\344\275\234\344\270\232.md" deleted file mode 100644 index 3acd683a01c8f2947c1c9f99f24d2a0bd298939d..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/20230921\347\254\224\350\256\260\344\270\216\344\275\234\344\270\232.md" +++ /dev/null @@ -1,114 +0,0 @@ -笔记 - -1.SPU 全SPU = Standard Product Unit (标准化产品单元) - -SPU 是商品信息聚合的最小单位。 - -2.SKU :库存进出计量的单位.所有属性为 一种规格,通过规格定位价格还有库存。最小存货单位(SKU),全称为Stock Keeping Unit,即库存进出计量的基本单元,可以是以件,盒,托盘等为单位。SKU这是对于大型连锁超市DC(配送中心)物流管理的一个必要的方法。 - -建库建表 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : kjin - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : taob - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 21/09/2023 11:19:29 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for model --- ---------------------------- -DROP TABLE IF EXISTS `model`; -CREATE TABLE `model` ( - `sku_id` int NOT NULL AUTO_INCREMENT, - `m_name` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`sku_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of model --- ---------------------------- -INSERT INTO `model` VALUES (1, '华为matex5'); - --- ---------------------------- --- Table structure for price --- ---------------------------- -DROP TABLE IF EXISTS `price`; -CREATE TABLE `price` ( - `p_id` int NOT NULL AUTO_INCREMENT, - `pr_id` int NULL DEFAULT NULL, - `p_pr` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`p_id`) USING BTREE, - INDEX `FK_Relationship_3`(`pr_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`pr_id`) REFERENCES `property` (`pr_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of price --- ---------------------------- -INSERT INTO `price` VALUES (1, 1, '16+1t'); -INSERT INTO `price` VALUES (2, 2, '白色'); - --- ---------------------------- --- Table structure for property --- ---------------------------- -DROP TABLE IF EXISTS `property`; -CREATE TABLE `property` ( - `pr_id` int NOT NULL AUTO_INCREMENT, - `sp_id` int NULL DEFAULT NULL, - `pr_name` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`pr_id`) USING BTREE, - INDEX `FK_Relationship_2`(`sp_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`sp_id`) REFERENCES `specification` (`sp_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of property --- ---------------------------- -INSERT INTO `property` VALUES (1, 1, '内存'); -INSERT INTO `property` VALUES (2, 1, '颜色'); - --- ---------------------------- --- Table structure for specification --- ---------------------------- -DROP TABLE IF EXISTS `specification`; -CREATE TABLE `specification` ( - `sp_id` int NOT NULL AUTO_INCREMENT, - `sku_id` int NULL DEFAULT NULL, - `sp_price` decimal(9, 2) NULL DEFAULT NULL, - `inventory` int NULL DEFAULT NULL, - PRIMARY KEY (`sp_id`) USING BTREE, - INDEX `FK_price`(`sku_id` ASC) USING BTREE, - CONSTRAINT `FK_price` FOREIGN KEY (`sku_id`) REFERENCES `model` (`sku_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of specification --- ---------------------------- -INSERT INTO `specification` VALUES (1, 1, 1999.00, 10); - -SET FOREIGN_KEY_CHECKS = 1; - -``` - -查询 - -```mysql -SELECT * FROM model,specification,price,property -WHERE model.sku_id=specification.sku_id -and specification.sp_id=property.sp_id -and property.pr_id=price.pr_id -``` \ No newline at end of file diff --git "a/33\351\227\253\347\273\247\345\221\250/20230922\344\275\234\344\270\232.md" "b/33\351\227\253\347\273\247\345\221\250/20230922\344\275\234\344\270\232.md" deleted file mode 100644 index ba4c13a7fdfa8cce72274399edf128d9bb2407f5..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/20230922\344\275\234\344\270\232.md" +++ /dev/null @@ -1,189 +0,0 @@ -笔记 - -自连接是指使用表的别名实现表与其自身连接的查询方法。 - -一般情况下,很多问题的解决,需要我们进行多表查询,将两表中某些数据联结,来得到我们所需的数据。 - -但有些情况下,我们需要对一张表内的数据,进行一些对比,或者是比较,获得各列层次关系,通过一般的SQL写法,可能需要通过写多个子查询的方式才能解决。但是用自连接查询可以轻松解决,所以通俗来理解的话,自连接查询就是以类似多表对比的方式,实现对同一张表内数据进行复杂的关系表示或关系处理。 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : kjijn - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : nevada - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 22/09/2023 16:22:04 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for commodity --- ---------------------------- -DROP TABLE IF EXISTS `commodity`; -CREATE TABLE `commodity` ( - `com_id` int NOT NULL AUTO_INCREMENT, - `com_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`com_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 47 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of commodity --- ---------------------------- -INSERT INTO `commodity` VALUES (1, '七彩虹3090ti 16g樱花粉'); -INSERT INTO `commodity` VALUES (2, '微星4060ti 12g纯白'); -INSERT INTO `commodity` VALUES (3, '盈通4070 16g花嫁'); -INSERT INTO `commodity` VALUES (4, '技嘉4090 24g纯白'); -INSERT INTO `commodity` VALUES (5, '黄伟达9090ti 36g花嫁'); - --- ---------------------------- --- Table structure for intermediate --- ---------------------------- -DROP TABLE IF EXISTS `intermediate`; -CREATE TABLE `intermediate` ( - `sp_id` int NULL DEFAULT NULL, - `pp_id` int NULL DEFAULT NULL, - `va_id` int NULL DEFAULT NULL, - INDEX `FK_Relationship_2`(`sp_id` ASC) USING BTREE, - INDEX `FK_Relationship_3`(`pp_id` ASC) USING BTREE, - INDEX `FK_Relationship_4`(`va_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`sp_id`) REFERENCES `specification` (`sp_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`pp_id`) REFERENCES `property` (`pp_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`va_id`) REFERENCES `value` (`va_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of intermediate --- ---------------------------- -INSERT INTO `intermediate` VALUES (1, 1, 1); -INSERT INTO `intermediate` VALUES (1, 2, 5); -INSERT INTO `intermediate` VALUES (2, 1, 2); -INSERT INTO `intermediate` VALUES (2, 2, 6); -INSERT INTO `intermediate` VALUES (3, 1, 1); -INSERT INTO `intermediate` VALUES (3, 2, 7); -INSERT INTO `intermediate` VALUES (4, 1, 3); -INSERT INTO `intermediate` VALUES (4, 2, 6); -INSERT INTO `intermediate` VALUES (5, 1, 4); -INSERT INTO `intermediate` VALUES (5, 2, 7); - --- ---------------------------- --- Table structure for property --- ---------------------------- -DROP TABLE IF EXISTS `property`; -CREATE TABLE `property` ( - `pp_id` int NOT NULL AUTO_INCREMENT, - `pp_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`pp_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of property --- ---------------------------- -INSERT INTO `property` VALUES (1, '显存'); -INSERT INTO `property` VALUES (2, '样式'); - --- ---------------------------- --- Table structure for specification --- ---------------------------- -DROP TABLE IF EXISTS `specification`; -CREATE TABLE `specification` ( - `sp_id` int NOT NULL AUTO_INCREMENT, - `com_id` int NULL DEFAULT NULL, - `price` int NULL DEFAULT NULL, - `inventory` int NULL DEFAULT NULL, - PRIMARY KEY (`sp_id`) USING BTREE, - INDEX `FK_Relationship_1`(`com_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`com_id`) REFERENCES `commodity` (`com_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of specification --- ---------------------------- -INSERT INTO `specification` VALUES (1, 1, 12000, 200); -INSERT INTO `specification` VALUES (2, 2, 4000, 300); -INSERT INTO `specification` VALUES (3, 3, 6499, 300); -INSERT INTO `specification` VALUES (4, 4, 12999, 300); -INSERT INTO `specification` VALUES (5, 5, 1999, 60); - --- ---------------------------- --- Table structure for value --- ---------------------------- -DROP TABLE IF EXISTS `value`; -CREATE TABLE `value` ( - `va_id` int NOT NULL AUTO_INCREMENT, - `content` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`va_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of value --- ---------------------------- -INSERT INTO `value` VALUES (1, '16g'); -INSERT INTO `value` VALUES (2, '12g'); -INSERT INTO `value` VALUES (3, '24g'); -INSERT INTO `value` VALUES (4, '36g'); -INSERT INTO `value` VALUES (5, '樱花粉'); -INSERT INTO `value` VALUES (6, '纯白'); -INSERT INTO `value` VALUES (7, '花嫁'); - -SET FOREIGN_KEY_CHECKS = 1; -``` - -# 查询 - -```mysql -SELECT i.com_name,i.price,i.inventory,i.content '显存',j.content '样式' from -( SELECT - a.com_name, - b.price, - b.inventory, - d.pp_name, - e.content - FROM - commodity a, - specification b, - intermediate c, - property d, - `value` e - WHERE - a.com_id = b.com_id - AND b.sp_id = c.sp_id - AND c.pp_id = d.pp_id - AND c.va_id = e.va_id - and pp_name='显存' - ORDER BY com_name - ) i, - ( - SELECT - a.com_name, - b.price, - b.inventory, - d.pp_name, - e.content - FROM - commodity a, - specification b, - intermediate c, - property d, - `value` e - WHERE - a.com_id = b.com_id - AND b.sp_id = c.sp_id - AND c.pp_id = d.pp_id - AND c.va_id = e.va_id - and pp_name='样式' - ORDER BY com_name - ) j -WHERE - i.com_name = j.com_name - AND i.content = '12g' - AND j.content = '纯白'; \ No newline at end of file diff --git "a/33\351\227\253\347\273\247\345\221\250/20230927\346\243\200\346\237\245\347\272\246\346\235\237\345\222\214\350\247\206\345\233\276.md" "b/33\351\227\253\347\273\247\345\221\250/20230927\346\243\200\346\237\245\347\272\246\346\235\237\345\222\214\350\247\206\345\233\276.md" deleted file mode 100644 index 7fb1c1e0ac0ed80a9cbd023287ec6c68ed7cc814..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/20230927\346\243\200\346\237\245\347\272\246\346\235\237\345\222\214\350\247\206\345\233\276.md" +++ /dev/null @@ -1,352 +0,0 @@ -### 笔记 - -#### 检查约束check - -意义:保证列中的值符合指定的条件 - -check(sex=“男”or sex=“女”) - -check(sex in (“男”,“女”)) - -check(age>=0 and age<=100) - -check(length(name)>=0 and length(name)<=6) - -注意:在utf8中,一个汉字就是一个字符,一个字符是3个字节 - -1Btye=8bit - -### 修改表 - -- 修改字段 - ALTER TABLE test.student MODIFY id_card varchar(30) 【约束】 - -- 修改表结构 - -- 添加字段 - -- 新增一个叫做id_card的字段,它的类型是可变字符串且非空。 - ALTER TABLE test.student ADD id_card varchar(18) NOT NULL; - -- 修改字段 - ALTER TABLE test.student MODIFY id_card varchar(30) - -- 修改字段名 - ALTER TABLE test.student CHANGE id_card id_card1 char(10) not null; - -- 删除字段 - ALTER TABLE test.student DROP id_card1; - -- 修改表名 - ALTER TABLE test.student RENAME test.stu; - - ### 视图 - - --视图是一种虚拟表,本身不具有数据,占用内存空间很少 - - --视图建立在已有表的基础上,视图赖以建立的这些表称为基表 - - --视图的优点:1.操作简单 2.减少数据冗余 3.数据安全 4.适应灵活多变的需求 - - ``` - -- 创建视图 - create view 视图名称 as - create view 名称(1,2,3,4) as (小括号内字段个数与select中字段个数相同) - -- 查看视图 - show create view 视图名称; - -- 修改视图 - 1. create or replace view 名称 as (有就更新,没有就创建) - 2. alter view 名称 as (要存在才能修改) - -- 删除视图 - drop view (if exists) 视图名称 - ``` - - - -```mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -create view employee_vu as -select last_name 姓名,employee_id 员工号,department_id 部门号 from employees; - - -#2. 显示视图的结构 -show create view employee_vu; - -#3. 查询视图中的全部内容 -select * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -select * from employee_vu where 部门号 = 80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -create view emp_v1(员工姓名,工资,邮箱) as -select last_name,salary,email from employees where phone_number like "011%"; - - -select * from emp_v1; -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - -alter view emp_v1 as -select last_name 姓名,email 邮箱,phone_number 电话号码,salary 工资 from employees where phone_number like "011%" and email like "%e%"; - -select * from emp_v1; -#3. 向 emp_v1 插入一条记录,是否可以? - --- 可以 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 - -update emp_v1 set 工资 = 工资 + 1000; - -#5. 删除emp_v1中姓名为Olsen的员工 - -delete from emp_v1 where 姓名 = "Olsen"; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -create view emp_v2 as -select b.department_id 部门id,max(a.salary) 最高工资 from employees a,departments b where a.department_id = b.department_id and salary > 12000 group BY b.department_id; - -select * from emp_v2; -#7. 向 emp_v2 中插入一条记录,是否可以? - -insert into emp_v2 values (60,66666); - --- 不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 - -drop view emp_v2,emp_v1; -``` - diff --git "a/33\351\227\253\347\273\247\345\221\250/\344\270\264\346\227\266\347\273\203\344\271\240\344\270\216\344\275\234\344\270\232.md" "b/33\351\227\253\347\273\247\345\221\250/\344\270\264\346\227\266\347\273\203\344\271\240\344\270\216\344\275\234\344\270\232.md" deleted file mode 100644 index f811c5bf8165c267cd263d90478b42ab1fe635cd..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/\344\270\264\346\227\266\347\273\203\344\271\240\344\270\216\344\275\234\344\270\232.md" +++ /dev/null @@ -1,735 +0,0 @@ -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不null,就保持原值 - -```mysq -create database db1 charset utf8; - -use db1; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; -``` - -作业 - -```mysql -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -select sum(12*salary) from employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - -select sum(salary*12+ifnull(salary*commission_pct*12,0)) from employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - -select distinct job_id from employees; - -# 3.查询工资大于12000的员工姓名和工资 - -select first_name,salary from employees where salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 - -select first_name,department_id from employees where employee_id=176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -select first_name,salary from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select first_name,department_id from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -select first_name,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select employee_id,salary,grade_level from employees e left join job_grades j on e.salary between j.lowest_sal and j.highest_sal where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select * from employees where first_name like '__尔'; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -select * from employees where last_name like '%特%' and last_name like '%尔%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select * from employees where first_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select e.first_name,j.job_title from employees e left join jobs j on e.job_id=j.job_id where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select first_name,salary,manager_id from employees where manager_id in (100,101,110); - -#第05章_排序与分页的课后练习 - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - -select first_name,department_id,salary*12 from employees order by salary*12 desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select first_name,salary from employees where salary not between 8000 and 17000 order by salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -select * from employees where email like '%e%' order by length(email) desc,department_id asc; - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - -select first_name,e.department_id,department_name from employees e left join departments d on e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -select e.job_id,d.location_id from employees e left join departments d on e.department_id=d.department_id where e.department_id=90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select e.last_name,d.department_name,d.location_id,l.city from employees e left join departments d on e.department_id=d.department_id left join locations l on d.location_id=l.location_id where commission_pct is not null; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select e.last_name,e.job_id,d.department_id,d.department_name from employees e left join departments d on e.department_id=d.department_id left join locations l on d.location_id=l.location_id where l.city='多伦多'; - -#sql92语法(自然连接): - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -select department_name,street_address,first_name,job_title,salary from jobs j,employees e,departments d,locations l where j.job_id=e.job_id and e.department_id=d.department_id and d.location_id=l.location_id and department_name='行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select e.first_name,e.employee_id,s.last_name,s.employee_id from employees e inner join employees s on e.employee_id=s.employee_id; - -# 7.查询哪些部门没有员工 - -select department_name from departments d left join employees e on d.department_id=e.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - -select city from departments d right join locations l on d.location_id=l.location_id where department_id is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select e.* from departments d,employees e where d.department_id=e.department_id and d.department_name='销售部' or d.department_name='信息技术部'; - -# 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - -select max(salary),min(salary),avg(salary),sum(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - -select job_id,max(salary),min(salary),avg(salary),sum(salary) from employees group by job_id; - -#4.选择各个job_id的员工人数 - -select job_id,count(employee_id) from employees group by job_id; - -# 5.查询员工最高工资和最低工资的差距 - -select max(salary)-min(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - -select manager_id,min(salary) from employees where manager_id is not null group by manager_id having min(salary)>6000; - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name,d.location_id,count(employee_id),avg(salary) from departments d left join employees e on d.department_id=e.department_id group by d.department_id order by avg(salary) desc; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select j.job_title,min(salary),department_name from jobs j left join employees e on j.job_id=e.job_id left join departments d on e.department_id=d.department_id group by j.job_id,d.department_id; - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - -select * from employees where department_id =(select department_id from employees where last_name='兹洛特基') and salary=(select salary from employees where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - -select employee_id,first_name,salary from employees where salary>(select avg(salary) from employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name,job_id,salary from employees where salary>(select max(salary) from employees where JOB_ID = 'SA_MAN'); - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -select employee_id,last_name from employees where department_id=(select department_id from employees where last_name like '%u%'); - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -select first_name,employee_id from employees where department_id in (select department_id from departments where location_id=1700); - -#6.查询管理者是 金 的员工姓名和工资 - -select first_name,salary from employees where manager_id in (select manager_id from employees where last_name='金'); - -#7.查询工资最低的员工信息: last_name, salary - -select last_name,salary from employees where salary=(select min(salary) from employees); - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 - -select * from departments where department_id =(select department_id from employees group by department_id having avg(salary)=(select min(s) from (select avg(salary) s from employees group by department_id) a)); - -#方式2: -# 部门平均<= 公司所有平均 - -select * from departments where department_id=(select department_id from employees group by department_id having avg(salary)<=all(select avg(salary) from employees group by department_id)); - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - -select d.*,(select avg(salary) from employees where department_id=d.department_id) from departments d where department_id =(select department_id from employees group by department_id having avg(salary)=(select min(s) from (select avg(salary) s from employees group by department_id) a)); - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -select * from jobs where job_id=(select job_id from employees group by job_id having avg(salary)=(select max(s) from (select avg(salary) s from employees group by job_id) a)); - -#方式2:平均工资>=所有平均工资 - -select * from jobs where job_id=(select job_id from employees group by job_id having avg(salary)>=all(select avg(salary) from employees group by job_id)); - -#11.查询平均工资高于公司平均工资的部门有哪些? - -select department_id from employees where department_id is not null group by department_id having avg(salary)>(select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - -select e.* from employees e inner join employees s on e.employee_id=s.manager_id; - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - -select * from employees where employee_id=any(select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - -select min(salary) from employees group by department_id having max(salary)<=all(select max(salary) from employees group by department_id); - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary - -select last_name,department_id,email,salary from employees where department_id = (select department_id from employees group by department_id having avg(salary)>=all(select avg(salary) from employees group by department_id)); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 - -select department_id from departments where department_id !=all(select department_id from employees where job_id='ST_CLERK'); - -#16. 选择所有没有管理者的员工的last_name - -select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - -select employee_id,first_name,hire_date,salary from employees e where e.manager_id=(select employee_id from employees where first_name = 'De Haan'); - -#方式2: - -select employee_id, last_name, hire_date, salary from employees e where exists(select * from employees s where e.employee_id=s.manager_id and s.first_name='De Haan'); - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - -select employee_id,last_name,salary from employees e1 where salary > (select avg(salary) from employees e2 where e2.department_id = e1.department_id); - -#方式2:在FROM中声明子查询 - -select employee_id,last_name,salary from employees e1,(select department_id,AVG(salary) s from employees e2 group by department_id) a where e1.department_id = a.department_id and e1.salary > a.s; - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - -select department_name,department_id from departments d where 5 < (select count(*) from employees e where d.department_id = e.department_id); - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -select country_id from locations l where 2 < (select count(*) from departments d where l.location_id=d.location_id); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` \ No newline at end of file diff --git "a/33\351\227\253\347\273\247\345\221\250/\345\214\273\351\231\242\347\263\273\347\273\237.md" "b/33\351\227\253\347\273\247\345\221\250/\345\214\273\351\231\242\347\263\273\347\273\237.md" deleted file mode 100644 index b90b29eb3113ac4e9a336e2195004eca4cdd5886..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/\345\214\273\351\231\242\347\263\273\347\273\237.md" +++ /dev/null @@ -1,93 +0,0 @@ -笔记 -如果一个主体的属性有多个值,那这个属性就可以拆成一个新主体 - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-14 08:55:14 */ -/*==============================================================*/ - - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists medical; - -drop table if exists patients; - -drop table if exists prescription; - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doc_id int not null auto_increment, - doc_no varchar(20) not null, - doc_name varchar(10) not null, - doc_sex varchar(5), - primary key (doc_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - dro_id int not null auto_increment, - dro_name varchar(20) not null, - primary key (dro_id) -); - -/*==============================================================*/ -/* Table: medical */ -/*==============================================================*/ -create table medical -( - ca_id int not null auto_increment, - doc_id int, - bat_no int, - date date, - diagnose varchar(50), - primary key (ca_id) -); - -/*==============================================================*/ -/* Table: patients */ -/*==============================================================*/ -create table patients -( - bat_no int not null auto_increment, - bat_name varchar(10) not null, - bat_age int, - bat_sex varchar(5), - primary key (bat_no) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - dro_id int not null, - ca_id int not null, - bat_no int, - usa varchar(20), - dosage varchar(20), - primary key (dro_id, ca_id) -); - -alter table medical add constraint FK_Relationship_1 foreign key (doc_id) - references doctor (doc_id) on delete restrict on update restrict; - -alter table medical add constraint FK_Relationship_2 foreign key (bat_no) - references patients (bat_no) on delete restrict on update restrict; - -alter table prescription add constraint FK_Relationship_5 foreign key (bat_no) - references patients (bat_no) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription foreign key (dro_id) - references drug (dro_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription2 foreign key (ca_id) - references medical (ca_id) on delete restrict on update restrict; \ No newline at end of file diff --git "a/33\351\227\253\347\273\247\345\221\250/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/33\351\227\253\347\273\247\345\221\250/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index b3938c67e34696037b1ef6107c03705973c447e7..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,260 +0,0 @@ -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW2_BORROW_LIBRARY') then - alter table Borrow2 - delete foreign key FK_BORROW2_BORROW_LIBRARY -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW2_BORROW2_BORROW') then - alter table Borrow2 - delete foreign key FK_BORROW2_BORROW2_BORROW -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_MANAGE_MANAGE_LIBRARY') then - alter table manage - delete foreign key FK_MANAGE_MANAGE_LIBRARY -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_MANAGE_MANAGE2_WORKING') then - alter table manage - delete foreign key FK_MANAGE_MANAGE2_WORKING -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_SERVE_SERVE_WORKING') then - alter table serve - delete foreign key FK_SERVE_SERVE_WORKING -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_SERVE_SERVE2_BORROW') then - alter table serve - delete foreign key FK_SERVE_SERVE2_BORROW -end if; - -drop index if exists Borrow.Borrow_PK; - -drop table if exists Borrow; - -drop index if exists Borrow2.Borrow2_FK; - -drop index if exists Borrow2.Borrow_FK; - -drop index if exists Borrow2.Borrow2_PK; - -drop table if exists Borrow2; - -drop index if exists library.library_PK; - -drop table if exists library; - -drop index if exists manage.manage2_FK; - -drop index if exists manage.manage_FK; - -drop index if exists manage.manage_PK; - -drop table if exists manage; - -drop index if exists serve.serve_FK; - -drop index if exists serve.serve2_FK; - -drop index if exists serve.serve_PK; - -drop table if exists serve; - -drop index if exists "working personnel"."working personnel_PK"; - -drop table if exists "working personnel"; - -/*==============================================================*/ -/* Table: Borrow */ -/*==============================================================*/ -create table Borrow -( - Bor_id integer not null, - Bor_name varchar(10) not null, - Bor_level integer not null, - Bor_blacklist varchar(10) not null, - constraint PK_BORROW primary key (Bor_id) -); - -/*==============================================================*/ -/* Index: Borrow_PK */ -/*==============================================================*/ -create unique index Borrow_PK on Borrow ( -Bor_id ASC -); - -/*==============================================================*/ -/* Table: Borrow2 */ -/*==============================================================*/ -create table Borrow2 -( - lib_id integer not null, - Bor_id integer not null, - situation char(4) not null, - constraint PK_BORROW2 primary key (lib_id, Bor_id) -); - -/*==============================================================*/ -/* Index: Borrow2_PK */ -/*==============================================================*/ -create unique index Borrow2_PK on Borrow2 ( -lib_id ASC, -Bor_id ASC -); - -/*==============================================================*/ -/* Index: Borrow_FK */ -/*==============================================================*/ -create index Borrow_FK on Borrow2 ( -lib_id ASC -); - -/*==============================================================*/ -/* Index: Borrow2_FK */ -/*==============================================================*/ -create index Borrow2_FK on Borrow2 ( -Bor_id ASC -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - lib_id integer not null, - lib_name varchar(20) not null, - lib_state varchar(3) not null, - lib_author varchar(10) not null, - lib_publish varchar(20) not null, - lib_classes integer not null, - constraint PK_LIBRARY primary key (lib_id) -); - -/*==============================================================*/ -/* Index: library_PK */ -/*==============================================================*/ -create unique index library_PK on library ( -lib_id ASC -); - -/*==============================================================*/ -/* Table: manage */ -/*==============================================================*/ -create table manage -( - lib_id integer not null, - wor_id integer not null, - lib_state varchar(2) not null, - constraint PK_MANAGE primary key (lib_id, wor_id) -); - -/*==============================================================*/ -/* Index: manage_PK */ -/*==============================================================*/ -create unique index manage_PK on manage ( -lib_id ASC, -wor_id ASC -); - -/*==============================================================*/ -/* Index: manage_FK */ -/*==============================================================*/ -create index manage_FK on manage ( -lib_id ASC -); - -/*==============================================================*/ -/* Index: manage2_FK */ -/*==============================================================*/ -create index manage2_FK on manage ( -wor_id ASC -); - -/*==============================================================*/ -/* Table: serve */ -/*==============================================================*/ -create table serve -( - wor_id integer not null, - Bor_id integer not null, - constraint PK_SERVE primary key (wor_id, Bor_id) -); - -/*==============================================================*/ -/* Index: serve_PK */ -/*==============================================================*/ -create unique index serve_PK on serve ( -wor_id ASC, -Bor_id ASC -); - -/*==============================================================*/ -/* Index: serve2_FK */ -/*==============================================================*/ -create index serve2_FK on serve ( -Bor_id ASC -); - -/*==============================================================*/ -/* Index: serve_FK */ -/*==============================================================*/ -create index serve_FK on serve ( -wor_id ASC -); - -/*==============================================================*/ -/* Table: "working personnel" */ -/*==============================================================*/ -create table "working personnel" -( - wor_id integer not null, - wor_name varchar(4) not null, - wor_position varchar(10) not null, - wor_range varchar(20) not null, - wor_state varchar(4) not null, - constraint "PK_WORKING PERSONNEL" primary key (wor_id) -); - -/*==============================================================*/ -/* Index: "working personnel_PK" */ -/*==============================================================*/ -create unique index "working personnel_PK" on "working personnel" ( -wor_id ASC -); - -alter table Borrow2 - add constraint FK_BORROW2_BORROW_LIBRARY foreign key (lib_id) - references library (lib_id) - on update restrict - on delete restrict; - -alter table Borrow2 - add constraint FK_BORROW2_BORROW2_BORROW foreign key (Bor_id) - references Borrow (Bor_id) - on update restrict - on delete restrict; - -alter table manage - add constraint FK_MANAGE_MANAGE_LIBRARY foreign key (lib_id) - references library (lib_id) - on update restrict - on delete restrict; - -alter table manage - add constraint FK_MANAGE_MANAGE2_WORKING foreign key (wor_id) - references "working personnel" (wor_id) - on update restrict - on delete restrict; - -alter table serve - add constraint FK_SERVE_SERVE_WORKING foreign key (wor_id) - references "working personnel" (wor_id) - on update restrict - on delete restrict; - -alter table serve - add constraint FK_SERVE_SERVE2_BORROW foreign key (Bor_id) - references Borrow (Bor_id) - on update restrict - on delete restrict; -``` \ No newline at end of file diff --git "a/33\351\227\253\347\273\247\345\221\250/\346\261\275\350\275\246\351\224\200\345\224\256\347\263\273\347\273\237.md" "b/33\351\227\253\347\273\247\345\221\250/\346\261\275\350\275\246\351\224\200\345\224\256\347\263\273\347\273\237.md" deleted file mode 100644 index 10e7bf6cf9866002dde9e030c0bf5dcf53d2f04a..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/\346\261\275\350\275\246\351\224\200\345\224\256\347\263\273\347\273\237.md" +++ /dev/null @@ -1,121 +0,0 @@ -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:43:09 */ -/*==============================================================*/ -create database che charset utf8; -use che; - -drop table if exists car; - -drop table if exists client; - -drop table if exists salesman; - -drop table if exists sell; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - car_name varchar(10) not null, - car_brand varchar(5) not null, - car_price int not null, - primary key (car_id) -); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - client_id int not null auto_increment, - client_name varchar(4) not null, - client_sex char(1) not null, - primary key (client_id) -); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id char(5) not null, - salesman_name varchar(4) not null, - salesman_age char(2) not null, - primary key (salesman_id) -); - -/*==============================================================*/ -/* Table: sell */ -/*==============================================================*/ -create table sell -( - sell_id int not null auto_increment, - client_id int, - car_id int, - salesman_id char(5), - sell_date date not null, - sell_price int not null, - primary key (sell_id) -); - -alter table sell add constraint FK_car_sell foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table sell add constraint FK_market foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - -alter table sell add constraint FK_purchase foreign key (client_id) - references client (client_id) on delete restrict on update restrict; - -#汽车 -insert into car values -(1,"RS7","奥迪",900000), -(2,"A6","奥迪",500000), -(3,"E300","奔驰",1000000), -(4,"X5","宝马",600000); -#顾客 -insert into client values -(1,"老王","男"), -(2,"老六","男"), -(3,"翠花","女"); -#销售员 -insert into salesman values -(10001,"小石","男"), -(10002,"小刘","女"), -(10003,"小梁","女"); -#售卖记录 -insert into sell values -(1,1,2,10003,"2023-11-11",666666), -(2,1,4,10003,"2023-11-22",600999), -(3,2,1,10002,"2023-11-16",888888), -(4,2,4,10003,"2023-11-12",500999), -(5,3,3,10001,"2023-11-26",1008611); - - -- 1.查询特定销售员的销售记录 - select * from sell a join salesman b on a.salesman_id=b.salesman_id where salesman_name = "小梁"; - -- 2.查找销售记录中销售价格最高的汽车 - select car.car_name from sell join car on sell.car_id = car.car_id where sell_price = (select max(sell_price) from sell); - -- 3.统计某个销售员的销售总额 - select b.salesman_name,sum(a.sell_price) from sell a join salesman b on a.salesman_id = b.salesman_id where b.salesman_name = "小梁"; - -- 4.根据客户信息查询其购买过的汽车 - select a.client_name 客户,c.car_brand 购买过的汽车 from client a - left join sell b on a.client_id = b.client_id - left join car c on b.car_id = c.car_id; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - select a.car_brand 品牌,count(car_brand) 销售数量,sum(sell_price) 总销售额 from car a - left join sell b on a.car_id = b.car_id - where car_brand = "宝马"; - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - select a.car_brand 品牌,b.sell_date 销售历史 from car a - left join sell b on a.car_id = b.car_id - where car_brand = "宝马"; - -- 8.统计每个销售员的销售数量 - select a.salesman_name 销售员,count(b.salesman_id) 销售数量 from salesman a - left join sell b on a.salesman_id = b.salesman_id group by salesman_name; - -``` \ No newline at end of file diff --git "a/33\351\227\253\347\273\247\345\221\250/\347\224\265\345\275\261\347\263\273\347\273\237.md" "b/33\351\227\253\347\273\247\345\221\250/\347\224\265\345\275\261\347\263\273\347\273\237.md" deleted file mode 100644 index aea3f8506218d13936527650c1cc71f8926a38b9..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/\347\224\265\345\275\261\347\263\273\347\273\237.md" +++ /dev/null @@ -1,179 +0,0 @@ -![https://i.niupic.com/images/2023/09/12/bEaF.png](https://i.niupic.com/images/2023/09/12/bEaF.png) - -1、笔记 - - 1.找到PicGo的客户端,成功上传图片 - -2.在CDM模型中,实体与实体之间可以多条连线 - - - - - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : qiqi - Source Server Type : MySQL - Source Server Version : 50741 - Source Host : localhost:3306 - Source Schema : tushu - - Target Server Type : MySQL - Target Server Version : 50741 - File Encoding : 65001 - - Date: 12/09/2023 13:20:37 -*/ -drop DATABASE tushu; -CREATE DATABASE tushu charset utf8; -use tushu; - - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for actors --- ---------------------------- -DROP TABLE IF EXISTS `actors`; -CREATE TABLE `actors` ( - `fm_id` int(11) NOT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `zhiwu` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`fm_id`, `m_id`) USING BTREE, - INDEX `FK_actors2`(`m_id`) USING BTREE, - CONSTRAINT `FK_actors` FOREIGN KEY (`fm_id`) REFERENCES `filmmaker` (`fm_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_actors2` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of actors --- ---------------------------- - --- ---------------------------- --- Table structure for comment --- ---------------------------- -DROP TABLE IF EXISTS `comment`; -CREATE TABLE `comment` ( - `cm_id` int(11) NOT NULL AUTO_INCREMENT, - `u_idd` int(11) NULL DEFAULT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `c_disagree` int(11) NULL DEFAULT NULL, - `c_date` datetime NULL DEFAULT NULL, - `c_agree` int(11) NULL DEFAULT NULL, - PRIMARY KEY (`cm_id`) USING BTREE, - INDEX `FK_Relationship_1`(`u_idd`) USING BTREE, - INDEX `FK_Relationship_4`(`m_id`) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`u_idd`) REFERENCES `user` (`u_idd`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of comment --- ---------------------------- -INSERT INTO `comment` VALUES (1, 1, '1', 0, '2023-09-20 13:19:35', 1); -INSERT INTO `comment` VALUES (2, 3, '1', 0, '2023-09-15 13:20:06', 1); - --- ---------------------------- --- Table structure for country --- ---------------------------- -DROP TABLE IF EXISTS `country`; -CREATE TABLE `country` ( - `country_id` int(10) NOT NULL AUTO_INCREMENT, - `country_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `language` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`country_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of country --- ---------------------------- -INSERT INTO `country` VALUES (1, '美国', '英语'); -INSERT INTO `country` VALUES (2, '韩国', '韩语'); - --- ---------------------------- --- Table structure for filmmaker --- ---------------------------- -DROP TABLE IF EXISTS `filmmaker`; -CREATE TABLE `filmmaker` ( - `fm_id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `sex` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `age` int(11) NULL DEFAULT NULL, - `master_work` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `contact` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`fm_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of filmmaker --- ---------------------------- -INSERT INTO `filmmaker` VALUES (1, '席琳·宋', '女', 11, '导演,编剧', '1222'); -INSERT INTO `filmmaker` VALUES (2, ' 格蕾塔·李', '男', 22, '主演', '100'); -INSERT INTO `filmmaker` VALUES (3, '刘台午', '男', 33, '主演', '2222'); -INSERT INTO `filmmaker` VALUES (4, ' 约翰·马加罗', '女', 44, '主演', '4444'); -INSERT INTO `filmmaker` VALUES (5, ' 文胜雅', '男', 55, '主演', '5555'); -INSERT INTO `filmmaker` VALUES (6, '尹智慧', '女', 66, '主演', '6666'); - --- ---------------------------- --- Table structure for movie --- ---------------------------- -DROP TABLE IF EXISTS `movie`; -CREATE TABLE `movie` ( - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `type_id` int(11) NULL DEFAULT NULL, - `country_id` int(11) NULL DEFAULT NULL, - `m_name` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_award` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_length` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_intro` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`m_id`) USING BTREE, - INDEX `FK_Relationship_3`(`type_id`) USING BTREE, - INDEX `FK_Relationship_6`(`country_id`) USING BTREE, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`type_id`) REFERENCES `movietype` (`type_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_6` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of movie --- ---------------------------- -INSERT INTO `movie` VALUES ('1', 1, 1, '过往人生', '第73届柏林国际电影节', '106', 'Nora(Greta Lee 饰)自小便因家庭因素搬离首尔移居加拿大。她与青梅竹马 Hae Sung(刘台午 饰)的关系最终停留在稚幼的凝视不语。而在二十年后,命运令两人于纽约重逢。可此时 Nora已拥有新的身份,甚至已和Arthur(John Magaro 饰)建立家庭。和Hae Sung 分开二十年后的重逢,也令她重新思索生活中的真正渴望。'); - --- ---------------------------- --- Table structure for movietype --- ---------------------------- -DROP TABLE IF EXISTS `movietype`; -CREATE TABLE `movietype` ( - `type_id` int(10) NOT NULL AUTO_INCREMENT, - `type_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`type_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of movietype --- ---------------------------- -INSERT INTO `movietype` VALUES (1, '爱情'); - --- ---------------------------- --- Table structure for user --- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `u_idd` int(11) NOT NULL AUTO_INCREMENT, - `u_id` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `u_IP` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `u_name` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`u_idd`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '2', '美国', 'Seb’s '); -INSERT INTO `user` VALUES (3, '4', '法国', 'DeadVolcano '); - -SET FOREIGN_KEY_CHECKS = 1; - -``` \ No newline at end of file diff --git "a/33\351\227\253\347\273\247\345\221\250/\347\254\254\344\270\211\350\212\202\350\257\276\347\254\224\350\256\260.md" "b/33\351\227\253\347\273\247\345\221\250/\347\254\254\344\270\211\350\212\202\350\257\276\347\254\224\350\256\260.md" deleted file mode 100644 index 3e44f60029667b52175525ec75d72cd09b151183..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/\347\254\254\344\270\211\350\212\202\350\257\276\347\254\224\350\256\260.md" +++ /dev/null @@ -1,9 +0,0 @@ -数据库的范式: - -1.第一范式:要求字段的内容,不可再分割,为的是保证数据的原子性。 - -2.第二范式:要求在满足第一范式的基础上,要求非主键字段要完全依赖主键,(非主键要依赖整个联合主键)而不能只依赖部分 - -3.第三范式:满足第二范式的前提上,要求非主键要直接依赖主键 - -注意:实际开发不会完全按照范式来设计,因为需求不一样,有时会故意反范式 \ No newline at end of file diff --git "a/33\351\227\253\347\273\247\345\221\250/\347\254\254\345\233\233\350\212\202\350\257\276\347\254\224\350\256\260.md" "b/33\351\227\253\347\273\247\345\221\250/\347\254\254\345\233\233\350\212\202\350\257\276\347\254\224\350\256\260.md" deleted file mode 100644 index 49f3ea4efd3468bc24a2b93f7334cd0689b92b69..0000000000000000000000000000000000000000 --- "a/33\351\227\253\347\273\247\345\221\250/\347\254\254\345\233\233\350\212\202\350\257\276\347\254\224\350\256\260.md" +++ /dev/null @@ -1,25 +0,0 @@ -Visio制作ER图的一个软件: - -一个软件:power Designer - -第一步:创建概念模型(类似ER图)CDM(以用户的角度) - -第二步:转换成逻辑模型LDM (以计算机的角度) - -第三步:转换成物理模型 (以数据库角度) - - - -数据库设计步骤: - -1.需求分析 - -2.ER图 - -3.逻辑结构设计 - -4.物理模型设计 - -5.数据库的实施 - -6.数据库的维护 \ No newline at end of file diff --git "a/34 \345\210\230\346\231\272\347\277\224/.keep" "b/34 \345\210\230\346\231\272\347\277\224/.keep" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/34 \345\210\230\346\231\272\347\277\224/20230922 \350\257\276\345\240\202\347\273\203\344\271\240.md" "b/34 \345\210\230\346\231\272\347\277\224/20230922 \350\257\276\345\240\202\347\273\203\344\271\240.md" deleted file mode 100644 index c36c8259c72a47ef9fc6d9112918d278eba4435f..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/20230922 \350\257\276\345\240\202\347\273\203\344\271\240.md" +++ /dev/null @@ -1,190 +0,0 @@ -# 笔记 - -自连接就是两张表结构和数据内容完全一样的表,在做数据处理的时候,我们通常会给它们分别重命名来加以区分(不重命名也不行啊,不然数据库也不认识它们谁是谁),然后进行关联。 - -# 数据库 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : kjijn - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : nevada - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 22/09/2023 16:22:04 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for commodity --- ---------------------------- -DROP TABLE IF EXISTS `commodity`; -CREATE TABLE `commodity` ( - `com_id` int NOT NULL AUTO_INCREMENT, - `com_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`com_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 47 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of commodity --- ---------------------------- -INSERT INTO `commodity` VALUES (1, '七彩虹3090ti 16g樱花粉'); -INSERT INTO `commodity` VALUES (2, '微星4060ti 12g纯白'); -INSERT INTO `commodity` VALUES (3, '盈通4070 16g花嫁'); -INSERT INTO `commodity` VALUES (4, '技嘉4090 24g纯白'); -INSERT INTO `commodity` VALUES (5, '黄伟达9090ti 36g花嫁'); - --- ---------------------------- --- Table structure for intermediate --- ---------------------------- -DROP TABLE IF EXISTS `intermediate`; -CREATE TABLE `intermediate` ( - `sp_id` int NULL DEFAULT NULL, - `pp_id` int NULL DEFAULT NULL, - `va_id` int NULL DEFAULT NULL, - INDEX `FK_Relationship_2`(`sp_id` ASC) USING BTREE, - INDEX `FK_Relationship_3`(`pp_id` ASC) USING BTREE, - INDEX `FK_Relationship_4`(`va_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`sp_id`) REFERENCES `specification` (`sp_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`pp_id`) REFERENCES `property` (`pp_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`va_id`) REFERENCES `value` (`va_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of intermediate --- ---------------------------- -INSERT INTO `intermediate` VALUES (1, 1, 1); -INSERT INTO `intermediate` VALUES (1, 2, 5); -INSERT INTO `intermediate` VALUES (2, 1, 2); -INSERT INTO `intermediate` VALUES (2, 2, 6); -INSERT INTO `intermediate` VALUES (3, 1, 1); -INSERT INTO `intermediate` VALUES (3, 2, 7); -INSERT INTO `intermediate` VALUES (4, 1, 3); -INSERT INTO `intermediate` VALUES (4, 2, 6); -INSERT INTO `intermediate` VALUES (5, 1, 4); -INSERT INTO `intermediate` VALUES (5, 2, 7); - --- ---------------------------- --- Table structure for property --- ---------------------------- -DROP TABLE IF EXISTS `property`; -CREATE TABLE `property` ( - `pp_id` int NOT NULL AUTO_INCREMENT, - `pp_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`pp_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of property --- ---------------------------- -INSERT INTO `property` VALUES (1, '显存'); -INSERT INTO `property` VALUES (2, '样式'); - --- ---------------------------- --- Table structure for specification --- ---------------------------- -DROP TABLE IF EXISTS `specification`; -CREATE TABLE `specification` ( - `sp_id` int NOT NULL AUTO_INCREMENT, - `com_id` int NULL DEFAULT NULL, - `price` int NULL DEFAULT NULL, - `inventory` int NULL DEFAULT NULL, - PRIMARY KEY (`sp_id`) USING BTREE, - INDEX `FK_Relationship_1`(`com_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`com_id`) REFERENCES `commodity` (`com_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of specification --- ---------------------------- -INSERT INTO `specification` VALUES (1, 1, 12000, 200); -INSERT INTO `specification` VALUES (2, 2, 4000, 300); -INSERT INTO `specification` VALUES (3, 3, 6499, 300); -INSERT INTO `specification` VALUES (4, 4, 12999, 300); -INSERT INTO `specification` VALUES (5, 5, 1999, 60); - --- ---------------------------- --- Table structure for value --- ---------------------------- -DROP TABLE IF EXISTS `value`; -CREATE TABLE `value` ( - `va_id` int NOT NULL AUTO_INCREMENT, - `content` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`va_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of value --- ---------------------------- -INSERT INTO `value` VALUES (1, '16g'); -INSERT INTO `value` VALUES (2, '12g'); -INSERT INTO `value` VALUES (3, '24g'); -INSERT INTO `value` VALUES (4, '36g'); -INSERT INTO `value` VALUES (5, '樱花粉'); -INSERT INTO `value` VALUES (6, '纯白'); -INSERT INTO `value` VALUES (7, '花嫁'); - -SET FOREIGN_KEY_CHECKS = 1; - -``` - -# 查询 - -```mysql -SELECT i.com_name,i.price,i.inventory,i.content '显存',j.content '样式' from -( SELECT - a.com_name, - b.price, - b.inventory, - d.pp_name, - e.content - FROM - commodity a, - specification b, - intermediate c, - property d, - `value` e - WHERE - a.com_id = b.com_id - AND b.sp_id = c.sp_id - AND c.pp_id = d.pp_id - AND c.va_id = e.va_id - and pp_name='显存' - ORDER BY com_name - ) i, - ( - SELECT - a.com_name, - b.price, - b.inventory, - d.pp_name, - e.content - FROM - commodity a, - specification b, - intermediate c, - property d, - `value` e - WHERE - a.com_id = b.com_id - AND b.sp_id = c.sp_id - AND c.pp_id = d.pp_id - AND c.va_id = e.va_id - and pp_name='样式' - ORDER BY com_name - ) j -WHERE - i.com_name = j.com_name - AND i.content = '12g' - AND j.content = '纯白'; -``` - diff --git "a/34 \345\210\230\346\231\272\347\277\224/mysql\345\244\215\344\271\240.md" "b/34 \345\210\230\346\231\272\347\277\224/mysql\345\244\215\344\271\240.md" deleted file mode 100644 index 47d03ee11fd51d8774510dc40e320f21f0ab9e1e..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/mysql\345\244\215\344\271\240.md" +++ /dev/null @@ -1,277 +0,0 @@ -# 笔记 - -好多 - -受不了了,以后最大值就排序找第一个吧 - -limit 从哪一位开始,往后几位 - - - -# 作业 - -```mysql -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -SELECT SUM(salary+(salary*IFNULL(commission_pct,1)))*12 工资总和 FROM employees; -#理解1:计算12月的基本工资 -#SELECT sum(salary*12) as 工资总和 FROM employees; -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的 job_id 以后的数据 -#去除重复 distinct -SELECT DISTINCT job_id FROM employees; - - -# 3.查询工资大于12000的员工姓名和工资 -SELECT first_name,last_name,salary FROM employees WHERE salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 -SELECT first_name,last_name,job_id FROM employees WHERE employee_id=176; - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -DESC departments; -SELECT * FROM departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -SELECT * FROM employees WHERE salary NOT in (5000,12000); - - -# 2.选择在20或50号部门工作的员工姓名和部门号 -SELECT * FROM employees WHERE department_id=20 OR department_id=50; - -# 3.选择公司中没有管理者的员工姓名及job_id -SELECT first_name,last_name,job_id FROM employees WHERE manager_id IS NULL; - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -SELECT first_name,last_name,salary,commission_pct FROM employees WHERE commission_pct IS NOT NULL; - - - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 -SELECT * FROM employees WHERE last_name like '__尔%'; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -SELECT * FROM employees WHERE last_name like '%尔%' or '%特%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -SELECT * FROM employees WHERE last_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -SELECT * FROM employees WHERE department_id BETWEEN 80 AND 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -SELECT * FROM employees WHERE department_id in(100,101,110); - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -SELECT * FROM employees ORDER BY salary DESC; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -SELECT * FROM employees WHERE salary not BETWEEN 8000 AND 17000 ORDER BY salary DESC LIMIT 20,20; - - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -SELECT * FROM employees WHERE email LIKE '%e%' ORDER BY LENGTH(email) DESC , department_id; - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -SELECT e.first_name,e.last_name,e.department_id,d.department_name FROM employees e INNER JOIN departments d ON e.department_id=d.department_id; - -# 2.查询90号部门员工的 job_id 和90号部门的location_id -SELECT e.job_id,e.department_id,d.location_id FROM employees e INNER JOIN departments d ON e.department_id=d.department_id WHERE e.department_id=90; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city -SELECT e.last_name,d.department_name,d.location_id,l.city -FROM - employees e - INNER JOIN departments d -on - e.department_id = d.department_id - INNER JOIN locations l ON d.location_id = l.location_id -WHERE - e.commission_pct IS NOT NULL; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -SELECT e.last_name,e.job_id,e.department_id,d.department_name from employees e INNER JOIN departments d on e.department_id=d.department_id where d.location_id= -(SELECT location_id FROM locations WHERE city='多伦多'); - - -#sql92语法(自然连接) - -# 5.查询 行政部 门员工的部门名称、部门地址、姓名、工作、工资 -SELECT d.department_name,l.city,e.last_name,j.job_title,e.salary from departments d INNER JOIN locations l on d.location_id=l.location_id INNER JOIN employees e on d.department_id=e.department_id INNER JOIN jobs j on e.job_id=j.job_id WHERE d.department_name='行政部'; - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 -SELECT e1.last_name,e1.employee_id,e2.last_name,e2.employee_id from employees e1 INNER JOIN employees e2 on e1.manager_id=e2.employee_id; - -# 7.查询哪些部门没有员工 -SELECT d.department_name from employees e RIGHT JOIN departments d on e.department_id=d.department_id WHERE e.employee_id IS null; -# 8. 查询哪个城市没有部门 -SELECT city from departments d RIGHT JOIN locations l on d.location_id=l.location_id where department_id IS NULL; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -SELECT e.* FROM employees e INNER JOIN departments d on e.department_id=d.department_id where d.department_name='销售部'or '信息技术部'; -# 第08章_聚合函数的课后练习 - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -SELECT MAX(salary),MIN(salary),AVG(salary),SUM(salary) FROM employees; - -#3.查询各 job_id 的员工工资的最大值,最小值,平均值,总和 -SELECT job_id,MAX(salary),MIN(salary),AVG(salary),SUM(salary) FROM employees GROUP BY job_id; - -#4.选择各个job_id的员工人数 -SELECT job_id,COUNT(job_id) from employees GROUP BY job_id; - -# 5.查询员工最高工资和最低工资的差距 -SELECT MAX(salary)-MIN(salary) FROM employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 -SELECT manager_id,MIN(salary) FROM employees WHERE manager_id IS NOT NULL GROUP BY manager_id HAVING MIN(salary)>6000; - -# 7.查询所有部门的名字,location_id,员工数量 和 平均工资,并按平均工资降序 -SELECT d.department_name,location_id,e1.`员工数量`,e1.`平均工资` FROM departments d INNER JOIN ( -SELECT e.department_id,COUNT(e.salary) 员工数量,AVG(e.salary) 平均工资 FROM employees e GROUP BY e.department_id) e1 on d.department_id=e1.department_id ORDER BY e1.`平均工资` DESC; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 -SELECT e.job_id,d.department_name,MIN(e.salary) FROM jobs j INNER JOIN employees e ON j.job_id=e.job_id INNER JOIN departments d on d.department_id=e.department_id GROUP BY e.job_id,d.department_name; - - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -SELECT last_name,salary from employees WHERE department_id= -(SELECT department_id FROM employees WHERE last_name='兹洛特基') AND last_name != '兹洛特基'; - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -SELECT employee_id,last_name,salary FROM employees WHERE salary>( -SELECT AVG(salary) FROM employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary -SELECT last_name,job_id,salary FROM employees WHERE salary>( -SELECT MAX(salary) from employees WHERE job_id='SA_MAN'); - -#4.查询和姓名中包含 尔 的员工在相同部门的员工的员工号和姓名 -SELECT employee_id,last_name from employees WHERE department_id IN( -SELECT DISTINCT department_id FROM employees WHERE last_name LIKE '%尔%') AND last_name NOT LIKE '%尔%'; - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -SELECT e.employee_id FROM employees e INNER JOIN departments d ON e.department_id=d.department_id where d.location_id=1700; - -#6.查询管理者是 金 的员工姓名和工资 -SELECT e1.last_name,e1.salary FROM employees e1 INNER JOIN employees e2 on e1.manager_id=e2.employee_id where e2.last_name='金'; - -#7.查询工资最低的员工信息: last_name, salary -SELECT last_name,salary FROM employees WHERE salary=( -SELECT MIN(salary) FROM employees); -#8.查询平均工资最低的部门信息 -SELECT * FROM departments d INNER JOIN -(SELECT department_id,AVG(salary) as a FROM employees WHERE department_id IS NOT NULL GROUP BY department_id) e ON d.department_id=e.department_id where e.a=( -SELECT MIN(e.a) FROM departments d INNER JOIN -(SELECT department_id,AVG(salary) as a FROM employees WHERE department_id IS NOT NULL GROUP BY department_id) e ON d.department_id=e.department_id); -#方式1 -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -SELECT * FROM departments d INNER JOIN -(SELECT department_id,AVG(salary) as a FROM employees WHERE department_id IS NOT NULL GROUP BY department_id) e ON d.department_id=e.department_id where e.a=( -SELECT MIN(e.a) FROM departments d INNER JOIN -(SELECT department_id,AVG(salary) as a FROM employees WHERE department_id IS NOT NULL GROUP BY department_id) e ON d.department_id=e.department_id); - -#10.查询平均工资最高的 job 信息 -SELECT job_id,AVG(salary) a1 FROM employees GROUP BY job_id HAVING a1= -(SELECT max(e.a) FROM( -SELECT job_id,AVG(salary) a FROM employees GROUP BY job_id) as e); - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - - -#11.查询平均工资高于公司平均工资的部门有哪些? -SELECT department_id,AVG(salary) a FROM employees GROUP BY department_id HAVING a>( -(SELECT AVG(salary) FROM employees)); - -#12.查询出公司中所有 manager 的详细信息 -SELECT * FROM employees WHERE employee_id in ( -SELECT manager_id FROM employees); -#方式1:自连接 自己连自己 - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? -#方式: -SELECT MIN(salary) FROM employees WHERE department_id=( -SELECT department_id FROM employees GROUP BY department_id HAVING MAX(salary)=( -SELECT MIN(a.m) FROM (SELECT department_id,MAX(salary) m FROM employees GROUP BY department_id ) a)); - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -SELECT last_name,department_id,email,salary FROM employees WHERE department_id=( -SELECT department_id from employees GROUP BY department_id ORDER BY AVG(salary) LIMIT 1); - -#15. 查询部门的部门号,其中不包括job_id是" ST_CLERK "的部门号 -#方式1: - -SELECT DISTINCT department_id FROM employees WHERE job_id != 'ST_CLERK' - -#16. 选择所有没有管理者的员工的last_name -SELECT last_name FROM employees WHERE manager_id IS NULL; -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 金 -SELECT employee_id,last_name,hire_date,salary FROM employees WHERE manager_id in( -SELECT employee_id FROM employees WHERE last_name='金'); - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) -SELECT - e1.employee_id,e1.last_name,e1.salary,e2.a -FROM - employees e1 - INNER JOIN ( SELECT department_id, AVG( salary ) a FROM employees GROUP BY department_id ) e2 - ON e1.department_id=e2.department_id HAVING e1.salary>e2.a; - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -SELECT d.department_name FROM departments d INNER JOIN ( -SELECT department_id,COUNT(department_id) FROM employees GROUP BY department_id HAVING COUNT(department_id)>5) d2 on d.department_id=d2.department_id; -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -SELECT country_id FROM locations l INNER JOIN departments d on l.location_id=d.location_id GROUP BY country_id HAVING COUNT(department_id)>2; -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` - diff --git "a/34 \345\210\230\346\231\272\347\277\224/rbac.md" "b/34 \345\210\230\346\231\272\347\277\224/rbac.md" deleted file mode 100644 index 969bea40794d1900ba6960a38c3c3c8e9d4a3166..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/rbac.md" +++ /dev/null @@ -1,131 +0,0 @@ -# 笔记 - -RBAC(Role-Based Access Control )基于角色的访问控制 - -![](https://pic2.zhimg.com/80/v2-b8ba22fa7f4e29f99242f2cae4cf06a5_1440w.webp) - -# 建库建表 - -``` mysql - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for jue_nemu --- ---------------------------- -DROP TABLE IF EXISTS `jue_nemu`; -CREATE TABLE `jue_nemu` ( - `nemu_id` int(11) NOT NULL, - `j_id` int(11) NOT NULL, - PRIMARY KEY (`nemu_id`, `j_id`) USING BTREE, - INDEX `FK_jue_nemu2`(`j_id`) USING BTREE, - CONSTRAINT `FK_jue_nemu` FOREIGN KEY (`nemu_id`) REFERENCES `nemu` (`nemu_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_jue_nemu2` FOREIGN KEY (`j_id`) REFERENCES `jues` (`j_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of jue_nemu --- ---------------------------- -INSERT INTO `jue_nemu` VALUES (1, 1); -INSERT INTO `jue_nemu` VALUES (1, 2); -INSERT INTO `jue_nemu` VALUES (2, 2); -INSERT INTO `jue_nemu` VALUES (1, 3); -INSERT INTO `jue_nemu` VALUES (2, 3); -INSERT INTO `jue_nemu` VALUES (3, 3); - --- ---------------------------- --- Table structure for jues --- ---------------------------- -DROP TABLE IF EXISTS `jues`; -CREATE TABLE `jues` ( - `j_id` int(11) NOT NULL AUTO_INCREMENT, - `j_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`j_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of jues --- ---------------------------- -INSERT INTO `jues` VALUES (1, '学生'); -INSERT INTO `jues` VALUES (2, '老师'); -INSERT INTO `jues` VALUES (3, '校长'); - --- ---------------------------- --- Table structure for nemu --- ---------------------------- -DROP TABLE IF EXISTS `nemu`; -CREATE TABLE `nemu` ( - `nemu_id` int(11) NOT NULL AUTO_INCREMENT, - `n_name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `teacher` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`nemu_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of nemu --- ---------------------------- -INSERT INTO `nemu` VALUES (1, '学生信息', '学生查看学生信息'); -INSERT INTO `nemu` VALUES (2, '老师信息', '老师查看老师信息'); -INSERT INTO `nemu` VALUES (3, '工资信息', '校长查看工资'); - --- ---------------------------- --- Table structure for user_jue --- ---------------------------- -DROP TABLE IF EXISTS `user_jue`; -CREATE TABLE `user_jue` ( - `j_id` int(11) NOT NULL, - `user_id` int(11) NOT NULL, - PRIMARY KEY (`j_id`, `user_id`) USING BTREE, - INDEX `FK_user_jue2`(`user_id`) USING BTREE, - CONSTRAINT `FK_user_jue` FOREIGN KEY (`j_id`) REFERENCES `jues` (`j_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_user_jue2` FOREIGN KEY (`user_id`) REFERENCES `users` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user_jue --- ---------------------------- -INSERT INTO `user_jue` VALUES (1, 1); -INSERT INTO `user_jue` VALUES (2, 2); -INSERT INTO `user_jue` VALUES (3, 3); - --- ---------------------------- --- Table structure for users --- ---------------------------- -DROP TABLE IF EXISTS `users`; -CREATE TABLE `users` ( - `user_id` int(11) NOT NULL AUTO_INCREMENT, - `user` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `pad` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`user_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of users --- ---------------------------- -INSERT INTO `users` VALUES (1, '111', '111'); -INSERT INTO `users` VALUES (2, '222', '222'); -INSERT INTO `users` VALUES (3, '333', '333'); - -SET FOREIGN_KEY_CHECKS = 1; - -``` - -# 查询 - -```mysql -SELECT - a.user_id,d.* -FROM - users a, - user_jue b, - jue_nemu c, - nemu d -WHERE - `user` = '111' - AND pad = '111' - and a.user_id=b.user_id - and b.j_id=c.j_id - and c.nemu_id=d.nemu_id; -``` - diff --git "a/34 \345\210\230\346\231\272\347\277\224/spu,sku.md" "b/34 \345\210\230\346\231\272\347\277\224/spu,sku.md" deleted file mode 100644 index 7ccbf0fcf61b61910e6ee8e47fad2b05c09c9b19..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/spu,sku.md" +++ /dev/null @@ -1,115 +0,0 @@ -# 笔记 - -1.SPU 全称 Standard Product Unit,是标准产品单位。SPU 描述一个产品的各种特性。 - -SKU 全称 Stock Keeping Unit ,库存进出计量的单位 - -所有属性为 一种规格,通过规格定位价格还有库存。 - -# 建库建表 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : kjin - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : taob - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 21/09/2023 11:19:29 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for model --- ---------------------------- -DROP TABLE IF EXISTS `model`; -CREATE TABLE `model` ( - `sku_id` int NOT NULL AUTO_INCREMENT, - `m_name` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`sku_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of model --- ---------------------------- -INSERT INTO `model` VALUES (1, '华为matex5'); - --- ---------------------------- --- Table structure for price --- ---------------------------- -DROP TABLE IF EXISTS `price`; -CREATE TABLE `price` ( - `p_id` int NOT NULL AUTO_INCREMENT, - `pr_id` int NULL DEFAULT NULL, - `p_pr` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`p_id`) USING BTREE, - INDEX `FK_Relationship_3`(`pr_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`pr_id`) REFERENCES `property` (`pr_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of price --- ---------------------------- -INSERT INTO `price` VALUES (1, 1, '16+1t'); -INSERT INTO `price` VALUES (2, 2, '白色'); - --- ---------------------------- --- Table structure for property --- ---------------------------- -DROP TABLE IF EXISTS `property`; -CREATE TABLE `property` ( - `pr_id` int NOT NULL AUTO_INCREMENT, - `sp_id` int NULL DEFAULT NULL, - `pr_name` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`pr_id`) USING BTREE, - INDEX `FK_Relationship_2`(`sp_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`sp_id`) REFERENCES `specification` (`sp_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of property --- ---------------------------- -INSERT INTO `property` VALUES (1, 1, '内存'); -INSERT INTO `property` VALUES (2, 1, '颜色'); - --- ---------------------------- --- Table structure for specification --- ---------------------------- -DROP TABLE IF EXISTS `specification`; -CREATE TABLE `specification` ( - `sp_id` int NOT NULL AUTO_INCREMENT, - `sku_id` int NULL DEFAULT NULL, - `sp_price` decimal(9, 2) NULL DEFAULT NULL, - `inventory` int NULL DEFAULT NULL, - PRIMARY KEY (`sp_id`) USING BTREE, - INDEX `FK_price`(`sku_id` ASC) USING BTREE, - CONSTRAINT `FK_price` FOREIGN KEY (`sku_id`) REFERENCES `model` (`sku_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of specification --- ---------------------------- -INSERT INTO `specification` VALUES (1, 1, 1999.00, 10); - -SET FOREIGN_KEY_CHECKS = 1; - -``` - -# 查询 - -```mysql -SELECT * FROM model,specification,price,property -WHERE model.sku_id=specification.sku_id -and specification.sp_id=property.sp_id -and property.pr_id=price.pr_id -``` - diff --git "a/34 \345\210\230\346\231\272\347\277\224/\345\214\273\351\231\242.md" "b/34 \345\210\230\346\231\272\347\277\224/\345\214\273\351\231\242.md" deleted file mode 100644 index d5622bcbaa8e6f36f145797fdf2712a791aff3a2..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/\345\214\273\351\231\242.md" +++ /dev/null @@ -1,97 +0,0 @@ -![](https://img1.imgtp.com/2023/09/15/uFjlYb3x.png) - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-14 08:55:14 */ -/*==============================================================*/ - - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists medical; - -drop table if exists patients; - -drop table if exists prescription; - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doc_id int not null auto_increment, - doc_no varchar(20) not null, - doc_name varchar(10) not null, - doc_sex varchar(5), - primary key (doc_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - dro_id int not null auto_increment, - dro_name varchar(20) not null, - primary key (dro_id) -); - -/*==============================================================*/ -/* Table: medical */ -/*==============================================================*/ -create table medical -( - ca_id int not null auto_increment, - doc_id int, - bat_no int, - date date, - diagnose varchar(50), - primary key (ca_id) -); - -/*==============================================================*/ -/* Table: patients */ -/*==============================================================*/ -create table patients -( - bat_no int not null auto_increment, - bat_name varchar(10) not null, - bat_age int, - bat_sex varchar(5), - primary key (bat_no) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - dro_id int not null, - ca_id int not null, - bat_no int, - usa varchar(20), - dosage varchar(20), - primary key (dro_id, ca_id) -); - -alter table medical add constraint FK_Relationship_1 foreign key (doc_id) - references doctor (doc_id) on delete restrict on update restrict; - -alter table medical add constraint FK_Relationship_2 foreign key (bat_no) - references patients (bat_no) on delete restrict on update restrict; - -alter table prescription add constraint FK_Relationship_5 foreign key (bat_no) - references patients (bat_no) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription foreign key (dro_id) - references drug (dro_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription2 foreign key (ca_id) - references medical (ca_id) on delete restrict on update restrict; - - -``` - diff --git "a/34 \345\210\230\346\231\272\347\277\224/\345\233\276\344\271\246\351\246\206.md" "b/34 \345\210\230\346\231\272\347\277\224/\345\233\276\344\271\246\351\246\206.md" deleted file mode 100644 index 9e49f4f893fe33387bcb91c54cb6da8408a38281..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/\345\233\276\344\271\246\351\246\206.md" +++ /dev/null @@ -1,266 +0,0 @@ -~~~mysql - - - -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW2_BORROW_LIBRARY') then - alter table Borrow2 - delete foreign key FK_BORROW2_BORROW_LIBRARY -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW2_BORROW2_BORROW') then - alter table Borrow2 - delete foreign key FK_BORROW2_BORROW2_BORROW -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_MANAGE_MANAGE_LIBRARY') then - alter table manage - delete foreign key FK_MANAGE_MANAGE_LIBRARY -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_MANAGE_MANAGE2_WORKING') then - alter table manage - delete foreign key FK_MANAGE_MANAGE2_WORKING -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_SERVE_SERVE_WORKING') then - alter table serve - delete foreign key FK_SERVE_SERVE_WORKING -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_SERVE_SERVE2_BORROW') then - alter table serve - delete foreign key FK_SERVE_SERVE2_BORROW -end if; - -drop index if exists Borrow.Borrow_PK; - -drop table if exists Borrow; - -drop index if exists Borrow2.Borrow2_FK; - -drop index if exists Borrow2.Borrow_FK; - -drop index if exists Borrow2.Borrow2_PK; - -drop table if exists Borrow2; - -drop index if exists library.library_PK; - -drop table if exists library; - -drop index if exists manage.manage2_FK; - -drop index if exists manage.manage_FK; - -drop index if exists manage.manage_PK; - -drop table if exists manage; - -drop index if exists serve.serve_FK; - -drop index if exists serve.serve2_FK; - -drop index if exists serve.serve_PK; - -drop table if exists serve; - -drop index if exists "working personnel"."working personnel_PK"; - -drop table if exists "working personnel"; - -/*==============================================================*/ -/* Table: Borrow */ -/*==============================================================*/ -create table Borrow -( - Bor_id integer not null, - Bor_name varchar(10) not null, - Bor_level integer not null, - Bor_blacklist varchar(10) not null, - constraint PK_BORROW primary key (Bor_id) -); - -/*==============================================================*/ -/* Index: Borrow_PK */ -/*==============================================================*/ -create unique index Borrow_PK on Borrow ( -Bor_id ASC -); - -/*==============================================================*/ -/* Table: Borrow2 */ -/*==============================================================*/ -create table Borrow2 -( - lib_id integer not null, - Bor_id integer not null, - situation char(4) not null, - constraint PK_BORROW2 primary key (lib_id, Bor_id) -); - -/*==============================================================*/ -/* Index: Borrow2_PK */ -/*==============================================================*/ -create unique index Borrow2_PK on Borrow2 ( -lib_id ASC, -Bor_id ASC -); - -/*==============================================================*/ -/* Index: Borrow_FK */ -/*==============================================================*/ -create index Borrow_FK on Borrow2 ( -lib_id ASC -); - -/*==============================================================*/ -/* Index: Borrow2_FK */ -/*==============================================================*/ -create index Borrow2_FK on Borrow2 ( -Bor_id ASC -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - lib_id integer not null, - lib_name varchar(20) not null, - lib_state varchar(3) not null, - lib_author varchar(10) not null, - lib_publish varchar(20) not null, - lib_classes integer not null, - constraint PK_LIBRARY primary key (lib_id) -); - -/*==============================================================*/ -/* Index: library_PK */ -/*==============================================================*/ -create unique index library_PK on library ( -lib_id ASC -); - -/*==============================================================*/ -/* Table: manage */ -/*==============================================================*/ -create table manage -( - lib_id integer not null, - wor_id integer not null, - lib_state varchar(2) not null, - constraint PK_MANAGE primary key (lib_id, wor_id) -); - -/*==============================================================*/ -/* Index: manage_PK */ -/*==============================================================*/ -create unique index manage_PK on manage ( -lib_id ASC, -wor_id ASC -); - -/*==============================================================*/ -/* Index: manage_FK */ -/*==============================================================*/ -create index manage_FK on manage ( -lib_id ASC -); - -/*==============================================================*/ -/* Index: manage2_FK */ -/*==============================================================*/ -create index manage2_FK on manage ( -wor_id ASC -); - -/*==============================================================*/ -/* Table: serve */ -/*==============================================================*/ -create table serve -( - wor_id integer not null, - Bor_id integer not null, - constraint PK_SERVE primary key (wor_id, Bor_id) -); - -/*==============================================================*/ -/* Index: serve_PK */ -/*==============================================================*/ -create unique index serve_PK on serve ( -wor_id ASC, -Bor_id ASC -); - -/*==============================================================*/ -/* Index: serve2_FK */ -/*==============================================================*/ -create index serve2_FK on serve ( -Bor_id ASC -); - -/*==============================================================*/ -/* Index: serve_FK */ -/*==============================================================*/ -create index serve_FK on serve ( -wor_id ASC -); - -/*==============================================================*/ -/* Table: "working personnel" */ -/*==============================================================*/ -create table "working personnel" -( - wor_id integer not null, - wor_name varchar(4) not null, - wor_position varchar(10) not null, - wor_range varchar(20) not null, - wor_state varchar(4) not null, - constraint "PK_WORKING PERSONNEL" primary key (wor_id) -); - -/*==============================================================*/ -/* Index: "working personnel_PK" */ -/*==============================================================*/ -create unique index "working personnel_PK" on "working personnel" ( -wor_id ASC -); - -alter table Borrow2 - add constraint FK_BORROW2_BORROW_LIBRARY foreign key (lib_id) - references library (lib_id) - on update restrict - on delete restrict; - -alter table Borrow2 - add constraint FK_BORROW2_BORROW2_BORROW foreign key (Bor_id) - references Borrow (Bor_id) - on update restrict - on delete restrict; - -alter table manage - add constraint FK_MANAGE_MANAGE_LIBRARY foreign key (lib_id) - references library (lib_id) - on update restrict - on delete restrict; - -alter table manage - add constraint FK_MANAGE_MANAGE2_WORKING foreign key (wor_id) - references "working personnel" (wor_id) - on update restrict - on delete restrict; - -alter table serve - add constraint FK_SERVE_SERVE_WORKING foreign key (wor_id) - references "working personnel" (wor_id) - on update restrict - on delete restrict; - -alter table serve - add constraint FK_SERVE_SERVE2_BORROW foreign key (Bor_id) - references Borrow (Bor_id) - on update restrict - on delete restrict; -``` -~~~ - diff --git "a/34 \345\210\230\346\231\272\347\277\224/\345\233\276\344\271\246\351\246\206\345\256\214\346\225\264.md" "b/34 \345\210\230\346\231\272\347\277\224/\345\233\276\344\271\246\351\246\206\345\256\214\346\225\264.md" deleted file mode 100644 index 6411366387a587d0177cc1f267076ab1bc85eb4c..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/\345\233\276\344\271\246\351\246\206\345\256\214\346\225\264.md" +++ /dev/null @@ -1,433 +0,0 @@ -![](https://img1.imgtp.com/2023/09/13/g2UtAWUz.png) - - - -# 笔记 - -``` -用工具理清楚各主体的关系和属性 -一对多还是多对一 -利用软件powerdesigner -先生成概念数据模型 -后生成逻辑数据模型 -最后生成物理模型 -最后辅助生成代码 -``` - -# 作业 - -``` mysql -/* - Navicat Premium Data Transfer - - Source Server : kjin - Source Server Type : MySQL - Source Server Version : 50742 - Source Host : localhost:3306 - Source Schema : wy - - Target Server Type : MySQL - Target Server Version : 50742 - File Encoding : 65001 - - Date: 13/09/2023 21:20:35 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for actor --- ---------------------------- -DROP TABLE IF EXISTS `actor`; -CREATE TABLE `actor` ( - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `a_id` int(11) NOT NULL, - PRIMARY KEY (`m_id`, `a_id`) USING BTREE, - INDEX `FK_actor2`(`a_id`) USING BTREE, - CONSTRAINT `FK_actor` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_actor2` FOREIGN KEY (`a_id`) REFERENCES `filmmaker` (`a_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of actor --- ---------------------------- -INSERT INTO `actor` VALUES ('1', 1); - --- ---------------------------- --- Table structure for awards --- ---------------------------- -DROP TABLE IF EXISTS `awards`; -CREATE TABLE `awards` ( - `a_id` int(11) NOT NULL AUTO_INCREMENT, - `a_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`a_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of awards --- ---------------------------- -INSERT INTO `awards` VALUES (1, '最佳影片奖(提名)'); - --- ---------------------------- --- Table structure for carry --- ---------------------------- -DROP TABLE IF EXISTS `carry`; -CREATE TABLE `carry` ( - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `a_id` int(11) NOT NULL, - `f_id` int(11) NULL DEFAULT NULL, - PRIMARY KEY (`m_id`, `a_id`) USING BTREE, - INDEX `FK_Relationship_27`(`f_id`) USING BTREE, - INDEX `FK_carry2`(`a_id`) USING BTREE, - CONSTRAINT `FK_Relationship_27` FOREIGN KEY (`f_id`) REFERENCES `festival` (`f_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_carry` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_carry2` FOREIGN KEY (`a_id`) REFERENCES `awards` (`a_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of carry --- ---------------------------- -INSERT INTO `carry` VALUES ('1', 1, 1); - --- ---------------------------- --- Table structure for country --- ---------------------------- -DROP TABLE IF EXISTS `country`; -CREATE TABLE `country` ( - `country_id` int(10) NOT NULL AUTO_INCREMENT, - `country_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`country_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of country --- ---------------------------- -INSERT INTO `country` VALUES (1, '中国'); -INSERT INTO `country` VALUES (2, '美国'); -INSERT INTO `country` VALUES (3, '韩国'); - --- ---------------------------- --- Table structure for direct --- ---------------------------- -DROP TABLE IF EXISTS `direct`; -CREATE TABLE `direct` ( - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `a_id` int(11) NOT NULL, - PRIMARY KEY (`m_id`, `a_id`) USING BTREE, - INDEX `FK_direct2`(`a_id`) USING BTREE, - CONSTRAINT `FK_direct` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_direct2` FOREIGN KEY (`a_id`) REFERENCES `filmmaker` (`a_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of direct --- ---------------------------- -INSERT INTO `direct` VALUES ('1', 1); - --- ---------------------------- --- Table structure for discuss --- ---------------------------- -DROP TABLE IF EXISTS `discuss`; -CREATE TABLE `discuss` ( - `u_id` int(11) NOT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `t_theme` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `content` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`u_id`, `m_id`) USING BTREE, - INDEX `FK_discuss2`(`m_id`) USING BTREE, - CONSTRAINT `FK_discuss` FOREIGN KEY (`u_id`) REFERENCES `user` (`u_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_discuss2` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of discuss --- ---------------------------- -INSERT INTO `discuss` VALUES (1, '1', '为什么cj要废了这些娃 ', '为什么cj要废了这些娃 '); - --- ---------------------------- --- Table structure for festival --- ---------------------------- -DROP TABLE IF EXISTS `festival`; -CREATE TABLE `festival` ( - `f_id` int(11) NOT NULL AUTO_INCREMENT, - `f_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `f_held` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `f_start` date NOT NULL, - `f_finish` date NOT NULL, - `f_picture` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`f_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of festival --- ---------------------------- -INSERT INTO `festival` VALUES (1, '中国长春电影节', '中国长春', '2023-09-11', '2023-09-16', 'https://img1.doubanio.com/view/photo/photo/public/p2897645249.webp'); - --- ---------------------------- --- Table structure for filmmaker --- ---------------------------- -DROP TABLE IF EXISTS `filmmaker`; -CREATE TABLE `filmmaker` ( - `a_id` int(11) NOT NULL AUTO_INCREMENT, - `a_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `a_ename` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `a_sex` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `a_intro` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, - `a_photo` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`a_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of filmmaker --- ---------------------------- -INSERT INTO `filmmaker` VALUES (1, '王宝强', 'Baoqiang Wang', '男', '王宝强,中国男演员。王宝强6岁时开始练习武术,8岁-14岁在河南嵩山少林寺做俗家弟子,之后来到北京闯天下,在各个剧组当武行做群众演员。命运似乎很眷顾这个看上去普普通通的孩子,16岁时,王宝强被导演李扬挑中,主演独立电影《盲井》,这部电影让他一夜之间从武行变成金马奖最佳新人。此外,王宝强还凭《盲井》获得了法国第五届杜威尔电影节“最佳男主演奖”以及第二届曼谷国际电影节“最佳男演员奖”。', 'https://img9.doubanio.com/view/celebrity/raw/public/p1356403251.95.jpg'); - --- ---------------------------- --- Table structure for filmreview --- ---------------------------- -DROP TABLE IF EXISTS `filmreview`; -CREATE TABLE `filmreview` ( - `u_id` int(11) NOT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `y_star` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `y_title` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `y_content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`u_id`, `m_id`) USING BTREE, - INDEX `FK_filmreview2`(`m_id`) USING BTREE, - CONSTRAINT `FK_filmreview` FOREIGN KEY (`u_id`) REFERENCES `user` (`u_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_filmreview2` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of filmreview --- ---------------------------- -INSERT INTO `filmreview` VALUES (1, '1', '5', '用双手去打出属于自己的未来吧', '用双手去打出属于自己的未来吧'); - --- ---------------------------- --- Table structure for flanguage --- ---------------------------- -DROP TABLE IF EXISTS `flanguage`; -CREATE TABLE `flanguage` ( - `l_id` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`l_id`, `m_id`) USING BTREE, - INDEX `FK_flanguage2`(`m_id`) USING BTREE, - CONSTRAINT `FK_flanguage` FOREIGN KEY (`l_id`) REFERENCES `language` (`l_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_flanguage2` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of flanguage --- ---------------------------- -INSERT INTO `flanguage` VALUES ('1', '1'); - --- ---------------------------- --- Table structure for language --- ---------------------------- -DROP TABLE IF EXISTS `language`; -CREATE TABLE `language` ( - `l_id` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `l_name` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`l_id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of language --- ---------------------------- -INSERT INTO `language` VALUES ('1', '中文'); -INSERT INTO `language` VALUES ('2', '英语'); -INSERT INTO `language` VALUES ('3', '韩语'); - --- ---------------------------- --- Table structure for movie --- ---------------------------- -DROP TABLE IF EXISTS `movie`; -CREATE TABLE `movie` ( - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `l_id` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `m_name` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_ename` varchar(25) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `m_date` date NULL DEFAULT NULL, - `m_alias` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `imdb` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `m_intro` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, - PRIMARY KEY (`m_id`) USING BTREE, - INDEX `FK_Relationship_15`(`l_id`) USING BTREE, - CONSTRAINT `FK_Relationship_15` FOREIGN KEY (`l_id`) REFERENCES `language` (`l_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of movie --- ---------------------------- -INSERT INTO `movie` VALUES ('1', '1', '八角笼中', 'Never Say Never', '2023-07-06', 'Octagonal', 'tt20865116', '电影讲述了向腾辉(王宝强 饰)倾注心血想把当地无人照料的孩子培养成才,这让生活本没有出路的孩子们看到了一丝通向未来的曙光。然而,随着往日的表演视频被爆出,这些“残忍、血腥”的画面刺激了不明真相的人们的神经。一夜之间,舆论开始发酵。向腾辉的生活、孩子们的前途都陷入到人们以善良为名编织的大网中,让他们难以挣脱,重回泥沼,关于未来,他们的“出路”又将在哪……'); - --- ---------------------------- --- Table structure for movietype --- ---------------------------- -DROP TABLE IF EXISTS `movietype`; -CREATE TABLE `movietype` ( - `type_id` int(10) NOT NULL AUTO_INCREMENT, - `type_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`type_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of movietype --- ---------------------------- -INSERT INTO `movietype` VALUES (1, '剧情'); - --- ---------------------------- --- Table structure for picture --- ---------------------------- -DROP TABLE IF EXISTS `picture`; -CREATE TABLE `picture` ( - `p_id` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `mov_m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `p_url` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`p_id`) USING BTREE, - INDEX `FK_poster`(`m_id`) USING BTREE, - INDEX `FK_still`(`mov_m_id`) USING BTREE, - CONSTRAINT `FK_poster` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_still` FOREIGN KEY (`mov_m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of picture --- ---------------------------- -INSERT INTO `picture` VALUES ('1', '1', '1', 'https://movie.douban.com/subject/35765480/photos?type=R'); - --- ---------------------------- --- Table structure for redact --- ---------------------------- -DROP TABLE IF EXISTS `redact`; -CREATE TABLE `redact` ( - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `a_id` int(11) NOT NULL, - PRIMARY KEY (`m_id`, `a_id`) USING BTREE, - INDEX `FK_redact2`(`a_id`) USING BTREE, - CONSTRAINT `FK_redact` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_redact2` FOREIGN KEY (`a_id`) REFERENCES `filmmaker` (`a_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of redact --- ---------------------------- -INSERT INTO `redact` VALUES ('1', 1); - --- ---------------------------- --- Table structure for relationship_3 --- ---------------------------- -DROP TABLE IF EXISTS `relationship_3`; -CREATE TABLE `relationship_3` ( - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `type_id` int(11) NOT NULL, - PRIMARY KEY (`m_id`, `type_id`) USING BTREE, - INDEX `FK_Relationship_4`(`type_id`) USING BTREE, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`type_id`) REFERENCES `movietype` (`type_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of relationship_3 --- ---------------------------- -INSERT INTO `relationship_3` VALUES ('1', 1); - --- ---------------------------- --- Table structure for relationship_6 --- ---------------------------- -DROP TABLE IF EXISTS `relationship_6`; -CREATE TABLE `relationship_6` ( - `country_id` int(11) NOT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`country_id`, `m_id`) USING BTREE, - INDEX `FK_Relationship_7`(`m_id`) USING BTREE, - CONSTRAINT `FK_Relationship_6` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_7` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of relationship_6 --- ---------------------------- -INSERT INTO `relationship_6` VALUES (1, '1'); - --- ---------------------------- --- Table structure for sheet --- ---------------------------- -DROP TABLE IF EXISTS `sheet`; -CREATE TABLE `sheet` ( - `u_id` int(11) NOT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `recommend` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, - PRIMARY KEY (`u_id`, `m_id`) USING BTREE, - INDEX `FK_sheet2`(`m_id`) USING BTREE, - CONSTRAINT `FK_sheet` FOREIGN KEY (`u_id`) REFERENCES `user` (`u_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_sheet2` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of sheet --- ---------------------------- -INSERT INTO `sheet` VALUES (1, '1', '好看,爱看'); - --- ---------------------------- --- Table structure for short --- ---------------------------- -DROP TABLE IF EXISTS `short`; -CREATE TABLE `short` ( - `u_id` int(11) NOT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `d_star` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `d_content` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`u_id`, `m_id`) USING BTREE, - INDEX `FK_short2`(`m_id`) USING BTREE, - CONSTRAINT `FK_short` FOREIGN KEY (`u_id`) REFERENCES `user` (`u_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_short2` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of short --- ---------------------------- -INSERT INTO `short` VALUES (1, '1', '5', '王宝强回归现实题材算是找到根儿了,起家就是靠的这个,用了当年《盲井》里的校服照,请来李杨导演客串也是对自己处女作的致敬,足见这部作品对宝强的影响和在心目中的地位。这次第二部导演作品进步太多,从选材到镜头语言和主题表达都愈发成熟,还有不足和进步空间,但至少方向对了,很可贵,期待宝强下部导演作品。'); - --- ---------------------------- --- Table structure for user --- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `u_id` int(11) NOT NULL AUTO_INCREMENT, - `u_psw` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `u_IP` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `u_photo` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL, - `u_name` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`u_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '123', '中国', 'https://www.douban.com/people/88125304/', '玄长清'); - --- ---------------------------- --- Table structure for video --- ---------------------------- -DROP TABLE IF EXISTS `video`; -CREATE TABLE `video` ( - `v_id` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `v_url` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `v_cover` varchar(60) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`v_id`) USING BTREE, - INDEX `FK_Relationship_14`(`m_id`) USING BTREE, - CONSTRAINT `FK_Relationship_14` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of video --- ---------------------------- -INSERT INTO `video` VALUES ('1', '1', 'https://movie.douban.com/trailer/306358/#content', 'https://movie.douban.com/subject/35765480/photos?type=R'); - -SET FOREIGN_KEY_CHECKS = 1; - -``` \ No newline at end of file diff --git "a/34 \345\210\230\346\231\272\347\277\224/\345\233\276\344\274\240\343\200\201CDM.md" "b/34 \345\210\230\346\231\272\347\277\224/\345\233\276\344\274\240\343\200\201CDM.md" deleted file mode 100644 index 001fad0f1a3b19c7f98e05c8c84ebcd293792500..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/\345\233\276\344\274\240\343\200\201CDM.md" +++ /dev/null @@ -1,180 +0,0 @@ -![https://i.niupic.com/images/2023/09/12/bEaF.png](https://i.niupic.com/images/2023/09/12/bEaF.png) - -1、笔记 - - 1.找到PicGo的客户端,成功上传图片 - -2.在CDM模型中,实体与实体之间可以多条连线 - - - - - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : qiqi - Source Server Type : MySQL - Source Server Version : 50741 - Source Host : localhost:3306 - Source Schema : tushu - - Target Server Type : MySQL - Target Server Version : 50741 - File Encoding : 65001 - - Date: 12/09/2023 13:20:37 -*/ -drop DATABASE tushu; -CREATE DATABASE tushu charset utf8; -use tushu; - - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for actors --- ---------------------------- -DROP TABLE IF EXISTS `actors`; -CREATE TABLE `actors` ( - `fm_id` int(11) NOT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `zhiwu` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`fm_id`, `m_id`) USING BTREE, - INDEX `FK_actors2`(`m_id`) USING BTREE, - CONSTRAINT `FK_actors` FOREIGN KEY (`fm_id`) REFERENCES `filmmaker` (`fm_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_actors2` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of actors --- ---------------------------- - --- ---------------------------- --- Table structure for comment --- ---------------------------- -DROP TABLE IF EXISTS `comment`; -CREATE TABLE `comment` ( - `cm_id` int(11) NOT NULL AUTO_INCREMENT, - `u_idd` int(11) NULL DEFAULT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `c_disagree` int(11) NULL DEFAULT NULL, - `c_date` datetime NULL DEFAULT NULL, - `c_agree` int(11) NULL DEFAULT NULL, - PRIMARY KEY (`cm_id`) USING BTREE, - INDEX `FK_Relationship_1`(`u_idd`) USING BTREE, - INDEX `FK_Relationship_4`(`m_id`) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`u_idd`) REFERENCES `user` (`u_idd`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of comment --- ---------------------------- -INSERT INTO `comment` VALUES (1, 1, '1', 0, '2023-09-20 13:19:35', 1); -INSERT INTO `comment` VALUES (2, 3, '1', 0, '2023-09-15 13:20:06', 1); - --- ---------------------------- --- Table structure for country --- ---------------------------- -DROP TABLE IF EXISTS `country`; -CREATE TABLE `country` ( - `country_id` int(10) NOT NULL AUTO_INCREMENT, - `country_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `language` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`country_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of country --- ---------------------------- -INSERT INTO `country` VALUES (1, '美国', '英语'); -INSERT INTO `country` VALUES (2, '韩国', '韩语'); - --- ---------------------------- --- Table structure for filmmaker --- ---------------------------- -DROP TABLE IF EXISTS `filmmaker`; -CREATE TABLE `filmmaker` ( - `fm_id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `sex` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `age` int(11) NULL DEFAULT NULL, - `master_work` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `contact` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`fm_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of filmmaker --- ---------------------------- -INSERT INTO `filmmaker` VALUES (1, '席琳·宋', '女', 11, '导演,编剧', '1222'); -INSERT INTO `filmmaker` VALUES (2, ' 格蕾塔·李', '男', 22, '主演', '100'); -INSERT INTO `filmmaker` VALUES (3, '刘台午', '男', 33, '主演', '2222'); -INSERT INTO `filmmaker` VALUES (4, ' 约翰·马加罗', '女', 44, '主演', '4444'); -INSERT INTO `filmmaker` VALUES (5, ' 文胜雅', '男', 55, '主演', '5555'); -INSERT INTO `filmmaker` VALUES (6, '尹智慧', '女', 66, '主演', '6666'); - --- ---------------------------- --- Table structure for movie --- ---------------------------- -DROP TABLE IF EXISTS `movie`; -CREATE TABLE `movie` ( - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `type_id` int(11) NULL DEFAULT NULL, - `country_id` int(11) NULL DEFAULT NULL, - `m_name` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_award` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_length` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_intro` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`m_id`) USING BTREE, - INDEX `FK_Relationship_3`(`type_id`) USING BTREE, - INDEX `FK_Relationship_6`(`country_id`) USING BTREE, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`type_id`) REFERENCES `movietype` (`type_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_6` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of movie --- ---------------------------- -INSERT INTO `movie` VALUES ('1', 1, 1, '过往人生', '第73届柏林国际电影节', '106', 'Nora(Greta Lee 饰)自小便因家庭因素搬离首尔移居加拿大。她与青梅竹马 Hae Sung(刘台午 饰)的关系最终停留在稚幼的凝视不语。而在二十年后,命运令两人于纽约重逢。可此时 Nora已拥有新的身份,甚至已和Arthur(John Magaro 饰)建立家庭。和Hae Sung 分开二十年后的重逢,也令她重新思索生活中的真正渴望。'); - --- ---------------------------- --- Table structure for movietype --- ---------------------------- -DROP TABLE IF EXISTS `movietype`; -CREATE TABLE `movietype` ( - `type_id` int(10) NOT NULL AUTO_INCREMENT, - `type_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`type_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of movietype --- ---------------------------- -INSERT INTO `movietype` VALUES (1, '爱情'); - --- ---------------------------- --- Table structure for user --- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `u_idd` int(11) NOT NULL AUTO_INCREMENT, - `u_id` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `u_IP` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `u_name` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`u_idd`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '2', '美国', 'Seb’s '); -INSERT INTO `user` VALUES (3, '4', '法国', 'DeadVolcano '); - -SET FOREIGN_KEY_CHECKS = 1; - -``` - diff --git "a/34 \345\210\230\346\231\272\347\277\224/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232\345\222\214\347\254\224\350\256\260.md" "b/34 \345\210\230\346\231\272\347\277\224/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232\345\222\214\347\254\224\350\256\260.md" deleted file mode 100644 index 9d0fd6c160cca966ec2cb445568bd63ef4c5a872..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232\345\222\214\347\254\224\350\256\260.md" +++ /dev/null @@ -1,118 +0,0 @@ -``` -一对一 1-1 -一对多 1-n -多对多 n-m -方块 实体 -菱形 关系 -``` - -```mysql -create database school charset utf8; - -use school; - --- 院系表 -create table department( - d_id int primary key, - d_name varchar(10), - d_address varchar(10) -); -insert into department values -(123,'软件工程学院','望云楼'), -(456,'信息工程学院','辛耕楼'), -(789,'建筑工程学院','万源楼'); - --- 专业表 -create table speciality( - s_id int primary key, - s_name varchar(10), - d_id int, - foreign key (d_id) references department(d_id) -); -insert into speciality values -(11,'软件技术与开发',123), -(22,'信息技术',456), -(33,'建筑设计',789); - --- 教室表 -create table classroom( -r_id int PRIMARY KEY, -r_name varchar(10) -); -insert into classroom values -(1,'实训一'), -(2,'实训二'), -(3,'实训三'); - --- 班级表 -create table class( - c_id int primary key, - c_name varchar(10), - s_id int, - foreign key (s_id) references speciality(s_id) -); -insert into class values -(1,'软件技术1班',11), -(2,'软件技术2班',11), -(3,'软件技术3班',11); - --- 课程表 -CREATE TABLE course( - couseId int PRIMARY key, - courseName varchar(10), - c_id int, - r_id int, - foreign key (c_id) references class(c_id), - foreign key (r_id) references classroom(r_id) -); -insert into course VALUES -(1,'java',1,2), -(2,'html',2,3), -(3,'mysql',3,1); - --- 教师表 -create table teacher( - t_id int primary key, - t_name varchar(10), - couseId int, - foreign key (couseId) references course(couseId) -); -insert into teacher values -(1,'张三',1), -(2,'张四',2), -(3,'张五',3); - --- 选修表 -create table `select` ( - selectId int primary key, - couseId int, - time varchar(20), - t_id int, - r_id int, - foreign key (couseId) references course(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references classroom(r_id) -); -insert into `select` values -(1,1,'周一上午',2,3), -(2,2,'周二下午',1,2), -(3,3,'周三上午',3,1); - --- 学生表 -create table student ( - id int primary key, - name varchar(10), - sex varchar(5), - age int, - address varchar(20), - c_id int, - selectId int, - foreign key (c_id) references class(c_id), - foreign key (selectId) references `select`(selectId) -); -insert into student values -(11111,'小明','男',18,'团结里1',1,1), -(22222,'小花','女',118,'团结里2',2,2), -(33333,'小王','男',1118,'团结里3',3,3); -``` - diff --git "a/34 \345\210\230\346\231\272\347\277\224/\346\261\275\350\275\246.md" "b/34 \345\210\230\346\231\272\347\277\224/\346\261\275\350\275\246.md" deleted file mode 100644 index ce12d0c334beaed0f60351f4bcaa3bd441cf9034..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/\346\261\275\350\275\246.md" +++ /dev/null @@ -1,107 +0,0 @@ -![](https://img1.imgtp.com/2023/09/15/WzwAXXYp.png) - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : kjin - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : car - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 15/09/2023 17:26:52 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for car --- ---------------------------- -DROP TABLE IF EXISTS `car`; -CREATE TABLE `car` ( - `c_id` int NOT NULL AUTO_INCREMENT, - `c_brand` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `c_model` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`c_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of car --- ---------------------------- -INSERT INTO `car` VALUES (1, '火力赛车f1', '奥迪双钻'); -INSERT INTO `car` VALUES (2, '火力赛车f1二代', '奥迪双钻'); -INSERT INTO `car` VALUES (3, '摇摇车', '山寨贴牌'); - --- ---------------------------- --- Table structure for client --- ---------------------------- -DROP TABLE IF EXISTS `client`; -CREATE TABLE `client` ( - `k_id` int NOT NULL AUTO_INCREMENT, - `k_name` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `k_sex` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `k_call` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`k_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of client --- ---------------------------- -INSERT INTO `client` VALUES (1, '小黎', '男', '114514'); -INSERT INTO `client` VALUES (2, '小韩', '男', '119110'); - --- ---------------------------- --- Table structure for record --- ---------------------------- -DROP TABLE IF EXISTS `record`; -CREATE TABLE `record` ( - `rec_id` int NOT NULL AUTO_INCREMENT, - `k_id` int NOT NULL, - `s_id` int NOT NULL, - `c_id` int NULL DEFAULT NULL, - `r_price` int NULL DEFAULT NULL, - `date` date NULL DEFAULT NULL, - PRIMARY KEY (`rec_id`) USING BTREE, - INDEX `AK_Identifier_1`(`rec_id` ASC, `k_id` ASC, `s_id` ASC) USING BTREE, - INDEX `FK_Relationship_4`(`c_id` ASC) USING BTREE, - INDEX `FK_record`(`k_id` ASC) USING BTREE, - INDEX `FK_record2`(`s_id` ASC) USING BTREE, - CONSTRAINT `FK_record` FOREIGN KEY (`k_id`) REFERENCES `client` (`k_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_record2` FOREIGN KEY (`s_id`) REFERENCES `salesman` (`s_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`c_id`) REFERENCES `car` (`c_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of record --- ---------------------------- -INSERT INTO `record` VALUES (1, 1, 1, 1, 20, '2023-09-15'); -INSERT INTO `record` VALUES (2, 2, 1, 2, 80, '2023-09-15'); -INSERT INTO `record` VALUES (3, 2, 2, 3, 100, '2023-09-15'); - --- ---------------------------- --- Table structure for salesman --- ---------------------------- -DROP TABLE IF EXISTS `salesman`; -CREATE TABLE `salesman` ( - `s_id` int NOT NULL AUTO_INCREMENT, - `s_name` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `s_sex` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`s_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of salesman --- ---------------------------- -INSERT INTO `salesman` VALUES (1, '小王', '男'); -INSERT INTO `salesman` VALUES (2, '小八', '男'); - -SET FOREIGN_KEY_CHECKS = 1; - -``` - diff --git "a/34 \345\210\230\346\231\272\347\277\224/\347\254\254\344\270\200\350\257\276.md" "b/34 \345\210\230\346\231\272\347\277\224/\347\254\254\344\270\200\350\257\276.md" deleted file mode 100644 index 642eb81847ab752991b5eccaa6cfd57965e171eb..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/\347\254\254\344\270\200\350\257\276.md" +++ /dev/null @@ -1,5 +0,0 @@ -新学期规划 -学习方向 - -付费视频 vip解析 -网盘资源 盘搜搜 diff --git "a/34 \345\210\230\346\231\272\347\277\224/\350\214\203\345\274\217.md" "b/34 \345\210\230\346\231\272\347\277\224/\350\214\203\345\274\217.md" deleted file mode 100644 index af7778b59c85f964ac7d506d1893b35b04319aa6..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/\350\214\203\345\274\217.md" +++ /dev/null @@ -1,5 +0,0 @@ -``` -第一范式(1NF):原子性(存储的数据应该具有“不可再分性”) -第二范式(2NF):唯一性 (消除非主键部分依赖联合主键中的部分字段)(一定要在第一范式已经满足的情况下) -第三范式(3NF):独立性,消除传递依赖(非主键值不依赖于另一个非主键值) -``` \ No newline at end of file diff --git "a/34 \345\210\230\346\231\272\347\277\224/\350\247\206\345\233\276.md" "b/34 \345\210\230\346\231\272\347\277\224/\350\247\206\345\233\276.md" deleted file mode 100644 index dbfa6ee958cb70f6f68aadcb699f125c7510fe34..0000000000000000000000000000000000000000 --- "a/34 \345\210\230\346\231\272\347\277\224/\350\247\206\345\233\276.md" +++ /dev/null @@ -1,79 +0,0 @@ -# 笔记 - -```mysql -视图(View)是一种虚拟存在的表。视图中的数据并不在数据库中实际存在,行和列数据来自定义视 -图的查询中使用的表,并且是在使用视图时动态生成的。 -通俗的讲,视图只保存了查询的SQL逻辑,不保存查询结果。所以我们在创建视图的时候,主要的工作 -就落在创建这条SQL查询语句上。 -``` - -# 作业 - -```MySQL - -#第14章_视图的课后练习 - -USE view_db; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -CREATE VIEW employee_vu as -SELECT * from employees; - -#2. 显示视图的结构 -desc employee_vu; - -#3. 查询视图中的全部内容 -SELECT * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -CREATE or replace VIEW employee_vu as -SELECT * from employees WHERE department_id=80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -CREATE view emp_v1(姓名,工资,邮箱) as -SELECT CONCAT(first_name,last_name),salary,email from employees WHERE phone_number like '011%'; - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码 -CREATE or replace view emp_v1(姓名,邮箱,电话号码) as -SELECT CONCAT(first_name,last_name),email,phone_number from employees WHERE phone_number like '011%' and email like '%e%'; - - -#3. 向 emp_v1 插入一条记录,是否可以? -insert into emp_v1 VALUES -('jojo','maia','110110'); -不可以; - - - - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE employees set salary=salary+1000 WHERE email in (SELECT * from (SELECT 邮箱 from emp_v1) as a); - -#5. 删除emp_v1中姓名为Olsen的员工 -DELETE from emp_v1 WHERE 姓名 like '%Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -CREATE view emp_v2 as -SELECT department_id,max(salary) msa from employees GROUP BY department_id HAVING msa>12000; - - - - - -#7. 向 emp_v2 中插入一条记录,是否可以? -不可以; - - - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v2,emp_v1; -``` \ No newline at end of file diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230906 \347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" "b/37 \346\217\255\351\230\263\344\270\275/20230906 \347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" deleted file mode 100644 index 66dd441565321c009620a2cbec8f62f566e04762..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230906 \347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" +++ /dev/null @@ -1,160 +0,0 @@ -## 笔记 - -### 数据库 -关系是相互的,一个学生,可以选多个课,课也可以被多个学生选(多对多)这种关系应借助第三个表进行关联,将前面两张表的主键当作外键表与表的关系:1对1,1对多,多对多 -1对多:第二张的表的主键当另一个表的外键(多) -(1) 当1对1:将其中任一表的主键放在另一张表中的外键 -头脑风暴:院系、专业、班级、学生,教师、谢程、深程表、教室visio -链头变上有一个号数据库chen's -数据库设计方法 按住(f11,再抢动,可复制 -1.直观设计法 选中,一直抢动,不能点击 -2.规范设计法 多对多,用字日表行N.M… -3.算机辅助设计法 -E-R图(实体关系图) -3要表:实体(表)、属性(字段)和关系(类似外键约束) -实体:用矩形.主键:加下划线 外键:横线中间加菱形 - - - -### mysql - -``` mysql -CREATE DATABASE yangyang charset utf8; -use yangyang; -##学院表 -CREATE table college( -collegeName VARCHAR(12), -collegeId int PRIMARY key -); - -##专业表 -CREATE TABLE major( -majorId int PRIMARY key, -majorName VARCHAR(12), -collegeId int, -foreign KEY (collegeId) references college(collegeId) -); - -##班级表 -CREATE TABLE class( -classId int PRIMARY key, -className VARCHAR(12), -majorId int, -foreign KEY (majorId) references major(majorId) -); -#3教室表 -CREATE TABLE classroom( -classroomId int PRIMARY key , -classroomAddress VARCHAR(12), -classroomName VARCHAR(12) -); - -##教师表 -CREATE TABLE teacher( -teacherId int PRIMARY key, -teacherName VARCHAR(12), -courseld int -); -DROP TABLE student; - -##学生表 -CREATE TABLE student( -studentId int PRIMARY key, -studentName VARCHAR(12), -sex CHAR, -courseId int -); -drop TABLE course; -## 课程表 -CREATE TABLE course( -courseId int PRIMARY key, -courseName VARCHAR(12), -classroomId int, -teacherId int, -studentId int, -classId int, -foreign KEY (classId) references class(classId), -foreign KEY (classroomId) references classroom(classroomId), -foreign KEY (teacherId) references teacher(teacherId), -foreign KEY (studentId) references student(studentId) -); - -``` - - - -```mysql -CREATE DATABASE yangyang charset utf8; -use yangyang; -##学院表 -CREATE table college( -collegeName VARCHAR(12), -collegeId int PRIMARY key -); - -INSERT into college VALUES - ('软件工程学院',1), - ('信息技术学院',2), - ('软件工程学院',3); - - -##专业表 -CREATE TABLE major( -majorId int PRIMARY key, -majorName VARCHAR(12), -collegeId int, -foreign KEY (collegeId) references college(collegeId) -); - -INSERT into major VALUES -(1,'软件技术',1), -(2,'软件技术',2), -(3,'软件技术',3); - -##班级表 -CREATE TABLE class( -classId int PRIMARY key, -className VARCHAR(12), -majorId int, -foreign KEY (majorId) references major(majorId) -); -#3教室表 -CREATE TABLE classroom( -classroomId int PRIMARY key , -classroomAddress VARCHAR(12), -classroomName VARCHAR(12) -); - -##教师表 -CREATE TABLE teacher( -teacherId int PRIMARY key, -teacherName VARCHAR(12), -courseld int -); -DROP TABLE student; - -##学生表 -CREATE TABLE student( -studentId int PRIMARY key, -studentName VARCHAR(12), -sex CHAR, -courseId int -); -drop TABLE course; -## 课程表 -CREATE TABLE course( -courseId int PRIMARY key, -courseName VARCHAR(12), -classroomId int, -teacherId int, -studentId int, -classId int, -foreign KEY (classId) references class(classId), -foreign KEY (classroomId) references classroom(classroomId), -foreign KEY (teacherId) references teacher(teacherId), -foreign KEY (studentId) references student(studentId) -); - - -``` - diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230907 \345\244\264\350\204\221\351\243\216\346\232\264.txt" "b/37 \346\217\255\351\230\263\344\270\275/20230907 \345\244\264\350\204\221\351\243\216\346\232\264.txt" deleted file mode 100644 index 4b8307033730b1c52bf40bbebc81b05130de71a9..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230907 \345\244\264\350\204\221\351\243\216\346\232\264.txt" +++ /dev/null @@ -1,105 +0,0 @@ -## 笔记 - -### 数据库的范式: - -1.第一范式:要求字段的内容不可再分割,为的是保证数据的原子性 - -2、第二范式:要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键,要依赖整个联合主键),而不能只依赖部分例:小明的存在依赖于小明爸爸的存在,还得依赖小明妈妈的存在 - -3.第三范式:满足第二范式的前提下,要求,非主键属性要直接依赖于主键 - -注意:传递依赖现实中可以写,但不符合范式 - -### 另 - -picgo 上传图片 - -亿图图示 (绘制流程图) - -## 头脑风暴完整版 - -```mysql -CREATE DATABASE yangyang charset utf8; -use yangyang; -##学院表 -CREATE table college( -collegeName VARCHAR(12), -collegeId int PRIMARY key -); - -##专业表 -CREATE TABLE major( -majorId int PRIMARY key, -majorName VARCHAR(12), -collegeId int, -foreign KEY (collegeId) references college(collegeId) -); - -##班级表 -CREATE TABLE class( -classId int PRIMARY key, -className VARCHAR(12), -majorId int, -foreign KEY (majorId) references major(majorId) -); - -##学生表 -CREATE TABLE student( -studentId int PRIMARY key, -studentName VARCHAR(12), -sex CHAR, -courseId int, -classId int, -foreign KEY (classId) references class(classId) -); - - -##教师表 -CREATE TABLE teacher( -teacherId int PRIMARY key, -teacherName VARCHAR(12), -courseld int -); - -#3教室表 -CREATE TABLE classroom( -classroomId int PRIMARY key , -classroomAddress VARCHAR(12), -classroomName VARCHAR(12) -); - - -## 课程 -CREATE TABLE course( -courseId int PRIMARY key, -courseName VARCHAR(12), -teacherId int, -foreign KEY (teacherId) references teacher(teacherId) -); - -## 选修表 - -CREATE TABLE elective ( -score int PRIMARY key, -studentId int, -courseId int, -foreign KEY (studentId) references student(studentId), -foreign KEY (courseId) references course(courseId) -); - -## 课程表 -CREATE TABLE timetable( -section int PRIMARY key , -tim time, -classId int, -classroomId int, -courseId int, -teacherId int, - foreign KEY (classId) references class(classId), - foreign KEY (classroomId) references classroom(classroomId), - foreign KEY (courseId) references course(courseId), - foreign KEY (teacherId) references teacher(teacherId) -); - -``` - diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230908 PowerDesigner\347\254\224\350\256\260.txt" "b/37 \346\217\255\351\230\263\344\270\275/20230908 PowerDesigner\347\254\224\350\256\260.txt" deleted file mode 100644 index ae5ee3819c5fa8b5ef8602b61bd318b271f4855f..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230908 PowerDesigner\347\254\224\350\256\260.txt" +++ /dev/null @@ -1,66 +0,0 @@ -### 笔记 - -#### 软件: PowerDesigner - -#### -①创建,概名模型(类似 ER 图)(以用户的角度) - -#### ②转换成逻辑模型 LDM (以计算计的角度) - -#### ③转换成物理模型(以数据库角度) PDM - -#### ④生成 DDL - -#### generate 生成 - -#### Conceptual Data Model 概念模型 - -#### Logical Data Model 逻辑模型 - -#### Physical Data Model 物理模型 - -#### 上层: File :文件 - -#### View :视图 - -#### . Symbol :符号 - -#### Repository :仓库 - -#### Window :窗口 - -#### Edit :编辑 - -#### Model :模型 - -#### Report :报告 - -#### Tools :工具 - -#### Help :帮助 - -#### Model types 模型类型 - -#### conceptual Diagram 概念图 - -#### Categories 类别 - -#### Attributes 属性 - -#### Integer 整数 - -#### Characters 可变字符 - -#### short integer 短整型 - -#### Decimal 小数 - -#### Variable characters 可变字符 - -#### Date 日期 - -#### time 时间 - -#### Serial 自增 - -#### Long integer 长整数 \ No newline at end of file diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230909 \345\233\276\344\271\246\351\246\206\347\263\273\347\273\237.md" "b/37 \346\217\255\351\230\263\344\270\275/20230909 \345\233\276\344\271\246\351\246\206\347\263\273\347\273\237.md" deleted file mode 100644 index af28fae200df4d53372f578f339d8114d1ae8f64..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230909 \345\233\276\344\271\246\351\246\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,283 +0,0 @@ -```mysql --- 创建数据库 -create database t_books charset utf8; --- 使用数据库 -use t_books; - - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-11 20:27:33 */ -/*==============================================================*/ - - -drop table if exists bookinfo;-- 书籍具体信息表 - -drop table if exists borrow;-- 借阅信息表 - -drop table if exists floormassage;-- 楼层信息表 - -drop table if exists gett;-- 接收人 - -drop table if exists library;-- 图书馆表 - -drop table if exists put;-- 放置图书 - -drop table if exists return_book;-- 归还信息表 - -drop table if exists user;-- 用户登录表 - -drop table if exists userinfo;-- 用户信息表 - -drop table if exists work;-- 管理员信息表 - -/*==============================================================*/ -/* Table: bookinfo */ -/*==============================================================*/ - --- 书籍具体信息表 -create table bookinfo -( - book_ID int not null auto_increment, -- 书籍编号 - ID int not null, -- 楼层编号 - book_name char(20) not null, -- 书籍名称 - author varchar(15) not null, -- 书籍作者 - publish date not null, -- 出版时间 - book_price numeric(10,2) not null, -- 书籍价格 - primary key (book_ID) -); - -/*==============================================================*/ -/* Table: borrow */ -/*==============================================================*/ - --- 借阅信息表 -create table borrow -( - borrow_ID int not null auto_increment, -- 借阅编号 - book_ID int not null, -- 书籍编号 - borrow_date date not null, -- 借阅时间 - return_date date not null, -- 归还时间 - primary key (borrow_ID) -); - -/*==============================================================*/ -/* Table: floormassage */ -/*==============================================================*/ - --- 楼层信息表 -create table floormassage -( - ID int not null auto_increment, -- 楼层编号 - lib_ID int not null, -- 图书馆编号 - floor char(3) not null, -- 楼层 - shelf_ID int not null, -- 书架编号 - linenum int not null, -- 行号 - type char(10) not null, -- 类型 - primary key (ID) -); - -/*==============================================================*/ -/* Table: get */ -/*==============================================================*/ - --- 接收人 -create table gett -( - worker_ID int not null, -- 管理员编号 - return_ID int not null, -- 归还编号 - primary key (worker_ID, return_ID) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ - --- 图书馆表 -create table library -( - lib_ID int not null auto_increment, -- 图书馆编号 - user_ID int not null, -- 用户编号 - lib_name varchar(10) not null, -- 图书馆名称 - primary key (lib_ID) -); - -/*==============================================================*/ -/* Table: put */ -/*==============================================================*/ - --- 放置图书 -create table put -( - lib_ID int not null, -- 楼层编号 - worker_ID int not null, -- 管理员编号 - primary key (lib_ID, worker_ID) -); - -/*==============================================================*/ -/* Table: "return" */ -/*==============================================================*/ - --- 归还信息表 -create table return_book -( - return_ID int not null auto_increment, -- 归还编号 - user_ID int not null, -- 用户编号 - return_date date not null, -- 归还时间 - primary key (return_ID) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ - --- 用户登录表 -create table user -( - user_ID int not null auto_increment, -- 用户编号 - user_name varchar(5) not null, -- 用户姓名 - password varchar(10) not null, -- 密码 - primary key (user_ID) -); - -/*==============================================================*/ -/* Table: userinfo */ -/*==============================================================*/ - --- 用户信息表 -create table userinfo -( - userinfo_ID int not null auto_increment, -- 用户信息编号 - user_ID int not null, -- 用户编号 - userinfo_name varchar(6) not null, -- 用户姓名 - userinfo_sex char(1) not null, -- 用户性别 - college char(10) not null, -- 学院 - major char(15) not null, -- 专业 - grade char(20) not null, -- 年级 - class char(20) not null, -- 班级 - user_tel char(15) not null, -- 用户电话 - primary key (userinfo_ID) -); - -/*==============================================================*/ -/* Table: work */ -/*==============================================================*/ - --- 管理员信息表 -create table work -( - worker_ID int not null auto_increment, -- 员工编号 - worker_name varchar(5) not null, -- 员工姓名 - worker_sex char(1) not null, -- 员工性别 - worker_tel char(12) not null, -- 员工电话 - worker_salary int not null, -- 员工工资 - primary key (worker_ID) -); - -alter table bookinfo add constraint FK_check_book foreign key (ID) - references floormassage (ID) on delete restrict on update restrict; - -alter table borrow add constraint FK_borrow foreign key (book_ID) - references bookinfo (book_ID) on delete restrict on update restrict; - -alter table floormassage add constraint FK_check_floor foreign key (lib_ID) - references library (lib_ID) on delete restrict on update restrict; - -alter table gett add constraint FK_get foreign key (worker_ID) - references work (worker_ID) on delete restrict on update restrict; - -alter table gett add constraint FK_get2 foreign key (return_ID) - references return_book (return_ID) on delete restrict on update restrict; - -alter table library add constraint FK_check foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - -alter table put add constraint FK_put foreign key (lib_ID) - references library (lib_ID) on delete restrict on update restrict; - -alter table put add constraint FK_put2 foreign key (worker_ID) - references work (worker_ID) on delete restrict on update restrict; - -alter table return_book add constraint FK_return foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - -alter table userinfo add constraint FK_information foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - - ### 用户登录 - -insert into user values -- 用户登录 -(001,'小梅','123'), -(002,'小晶','456'), -(003,'小芳','789'); - - - ### 用户信息表 -insert into userinfo values -(101,001,'韩梅梅','女','软件工程学院','前端','22级','1班','1234567892'), -(102,002,'郭晶晶','女','软件工程学院','后端','22级','2班','2345678925'), -(103,003,'李静芳','女','软件工程学院','新媒体','22级','10班','1234567894'); - - -### 图书馆信息表 -insert into library values -(201,001,'北京市图书馆'), -(202,002,'龙岩市图书馆'), -(203,003,'厦门市图书馆'); - -### 楼层信息表 -insert into floormassage values -(301,201,'四楼',337,1,'外国著作'), -(302,202,'六楼',338,2,'文学经典'), -(303,203,'五楼',339,3,'仙侠类'); - -### 书籍具体信息表 -insert into bookinfo values -- 图书信息 -(401,301,'战争与和平','列夫托尔斯泰','1869-6-6',45), -(402,302,'活着','余华','1992-12-2',60), -(403,303,'花千骨','果果','2018-12-31',80.8); - - - - - -### 借阅信息表 -insert into borrow values -- 图书借阅 -(501,401,'2023-04-16','2023-05-16'), -(502,402,'2023-04-16','2023-05-16'), -(503,403,'2023-04-16','2023-05-16'); - - - - -### 归还信息表 -insert into return_book values -- 归还图书 -(601,001,'2023-04-25'), -(602,002,'2023-05-10'), -(603,003,'2023-05-16'); - - - -### 管理员 -insert into work values -(701,'张三','男','1594628347',5000), -(702,'李四','男','1569821347',4000), -(703,'李雪','女','1634957612',3000); - - --- 接受表 -insert into gett values -(701,601), -(702,602), -(703,603); - --- 放置表 -insert into put values -(201,701), -(202,702), -(203,703); - - -``` - diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230912 \347\224\265\345\275\261\347\263\273\347\273\237.md" "b/37 \346\217\255\351\230\263\344\270\275/20230912 \347\224\265\345\275\261\347\263\273\347\273\237.md" deleted file mode 100644 index 6f8d0394f5c46a00b3b0dc90fab6df838f57efff..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230912 \347\224\265\345\275\261\347\263\273\347\273\237.md" +++ /dev/null @@ -1,383 +0,0 @@ -```mysql --- 创建数据库 -create database film_message charset utf8; --- 使用数据库 -use film_message; - - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 20:13:50 */ -/*==============================================================*/ - - -drop table if exists actor_directors_screenwriters; - -drop table if exists actorr; - -drop table if exists collect; - -drop table if exists country; - -drop table if exists film; - -drop table if exists film_address; - -drop table if exists film_language; - -drop table if exists film_type; - -drop table if exists language; - -drop table if exists personal; - -drop table if exists phone; - -drop table if exists relation; - -drop table if exists short; - -drop table if exists type; - - -/*==============================================================*/ -/* Table: actor_directors_screenwriters */ -/*==============================================================*/ --- 演员,导演,编剧表 -create table actor_directors_screenwriters -( - films_id int not null, -- 影视编号 - actor_id int not null, -- 演员编号 - primary key (films_id, actor_id) -); - -/*==============================================================*/ -/* Table: actorr */ -/*==============================================================*/ --- 演员表 -create table actorr -( - actor_id int not null auto_increment,-- 演员编号 - actor_name char(20) not null, -- 演员姓名 - actor_sex char(1) not null, -- 演员性别 - primary key (actor_id) -); - -/*==============================================================*/ -/* Table: collect */ -/*==============================================================*/ --- 收藏片单表 -create table collect -( - collect_id int not null auto_increment,-- 收藏编号 - collect_time date not null, -- 收藏时间 - collect_language char(50) not null, -- 推荐语 - collect_join char(2) not null, -- 是否加入到豆列 - primary key (collect_id) -); - -/*==============================================================*/ -/* Table: country */ -/*==============================================================*/ --- 国家地区表 -create table country -( - country_id int not null auto_increment,-- 国家编号 - country_name char(15) not null, -- 国家名称 - primary key (country_id) -); - -/*==============================================================*/ -/* Table: film */ -/*==============================================================*/ --- 影视作品表 -create table film -( - films_id int not null auto_increment,-- 影视编号 - collect_id int not null, -- 收藏编号 - films_name char(10) not null, -- 影视名称 - films_date date not null, -- 上映日期 - films_duration int not null, -- 片长 - films_score numeric(4,2) not null, -- 豆瓣评分 - primary key (films_id) -); - -/*==============================================================*/ -/* Table: film_address */ -/*==============================================================*/ --- 影视地区表 -create table film_address -( - country_id int not null,-- 国家编号 - films_id int not null,-- 影视编号 - primary key (country_id, films_id) -); - -/*==============================================================*/ -/* Table: film_language */ -/*==============================================================*/ --- 影视语言表 -create table film_language -( - language_id int not null,-- 语言编号 - films_id int not null,-- 影视编号 - primary key (language_id, films_id) -); - -/*==============================================================*/ -/* Table: film_type */ -/*==============================================================*/ --- 影视类型表 -create table film_type -( - films_id int not null,-- 影视编号 - type_id int not null,-- 类型编号 - primary key (films_id, type_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ --- 语言表 -create table language -( - language_id int not null auto_increment,-- 语言编号 - language_name char(10) not null, -- 语言名称 - primary key (language_id) -); - -/*==============================================================*/ -/* Table: personal */ -/*==============================================================*/ --- 个人信息表 -create table personal -( - personal_id int not null auto_increment,-- 个人信息编号 - personal_name char(20) not null, -- 姓名 - personal_sex char(1) not null, -- 性别 - personal_date date not null, -- 出生日期 - personal_address char(10) not null, -- 出生地 - personal_star char(3) not null, -- 星座 - primary key (personal_id) -); - -/*==============================================================*/ -/* Table: phone */ -/*==============================================================*/ --- 图片表 -create table phone -( - phone_id int not null auto_increment,-- 图片编号 - films_id int not null, -- 影视编号 - phone_name char(50) not null, -- 图片地址 - primary key (phone_id) -); - -/*==============================================================*/ -/* Table: relation */ -/*==============================================================*/ --- 关系表 -create table relation -( - films_id int not null, -- 影视编号 - personal_id int not null, -- 个人信息编号 - primary key (films_id, personal_id) -); - -/*==============================================================*/ -/* Table: short */ -/*==============================================================*/ --- 短评表 -create table short· -( - short_id int not null auto_increment, -- 短评编号 - personal_id int not null, -- 个人信息编号 - films_id int not null, -- 影视编号 - short_want char(2) not null, -- 是否想看 - short_look char(2) not null, -- 是否看过 - short_rating char(10) not null, -- 评价等级 - short_label char(10) not null, -- 标签 - short_comment char(100) not null, -- 简短评论 - short_ilook char(5) not null, -- 是否仅自己可见 - primary key (short_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ --- 类型表 -create table type -( - type_id int not null auto_increment, -- 类型编号 - type_name char(10) not null, -- 类型名称 - primary key (type_id) -); - -alter table actor_directors_screenwriters add constraint FK_actor_directors_screenwriters foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table actor_directors_screenwriters add constraint FK_actor_directors_screenwriters2 foreign key (actor_id) - references actorr (actor_id) on delete restrict on update restrict; - -alter table film add constraint FK_enshrine foreign key (collect_id) - references collect (collect_id) on delete restrict on update restrict; - -alter table film_address add constraint FK_film_address foreign key (country_id) - references country (country_id) on delete restrict on update restrict; - -alter table film_address add constraint FK_film_address2 foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table film_language add constraint FK_film_language foreign key (language_id) - references language (language_id) on delete restrict on update restrict; - -alter table film_language add constraint FK_film_language2 foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table film_type add constraint FK_film_type foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table film_type add constraint FK_film_type2 foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table phone add constraint FK_poster foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table relation add constraint FK_relation foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - -alter table relation add constraint FK_relation2 foreign key (personal_id) - references personal (personal_id) on delete restrict on update restrict; - -alter table short add constraint FK_evaluation foreign key (personal_id) - references personal (personal_id) on delete restrict on update restrict; - -alter table short add constraint FK_loading foreign key (films_id) - references film (films_id) on delete restrict on update restrict; - - - - - - --- 电影类型表 -insert into type - values - (111,"剧情"), - (112,"爱情"), - (113,"动作"); - --- 国家地区表 -insert into country - values - (121,"中国"), - (122,"韩国"), - (123,"英国"); - --- 语言表 -insert into language - values - (131,"中文"), - (132,"英语"), - (133,"韩语"); - - --- 演员表actorr -insert into actorr - values - (401,'席琳·宋','女'), - (402,'刘台午','男'), - (403,'约翰·马加罗','男'); - - - - - - - - --- collect -insert into collect - values - (501,'2023-09-30','很好看','加入'), - (502,'2022-08-21','好好看','加入'), - (503,'2023-07-11','好看','加入'); - --- 个人信息表 -insert into personal - values - (221,"小小",'女','2004-06-10','云南','双子座'), - (222,"肖军",'男','2002-04-21','四川','白羊座'), - (223,"瑞芮",'女','2003-01-18','山东','狮子座'); - --- 影视作品表 -insert into film - values - (021,501,'过往人生','2023-01-21',106,7.7), - (022,502,'生化危机','2022-05-12',127,7.8), - (023,503,'八角笼中','2023-06-06',150,7.2); - - --- phone -insert into phone - values - (310,021,'s?id=1775102085983294863&wfr=spider&for=pc'), - (311,022,'s?id=1768674709626395274&wfr=spider&for=pc'), - (312,023,'s?id=1768165498462546544&wfr=spider&for=pc'); - - --- short --- -insert into short - values - (661,221,021,'想看','看过','4颗星','我的观后感','非常好看','仅自己可见'), - (662,222,022,'想看','看过','4颗星','我的观后感','好好看','仅自己可见'), - (663,223,023,'想看','看过','5颗星','我的观后感','值得一看','仅自己可见'); - - - -- actor_directors_screenwriters --- -insert into actor_directors_screenwriters - values - (021,401), - (022,401), - (023,401); - --- film_address --- -insert into film_address - values - (121,021), - (121,022), - (121,023); - - --- film_language --- -insert into film_language - values - (131,021), - (132,022), - (133,023); - --- film_type --- -insert into film_type - values - (021,111), - (022,112), - (023,113); - --- relation --- -insert into relation - values - (021,221), - (022,222), - (023,223); - - - -``` - diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230913 \345\214\273\351\231\242\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/37 \346\217\255\351\230\263\344\270\275/20230913 \345\214\273\351\231\242\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index 1ce58979c0c0831242f8b2f134c08f13da06ac04..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230913 \345\214\273\351\231\242\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,252 +0,0 @@ -## 笔记 - -需求分析:记住一句话,如果一个主体的属性有多个值,那这个属性就可以拆成一个新主体 - -当三张表都是多对多的关系时,可以建一个中间表,三张表以一对多的关系连接那张中间表 - - - -```mysql --- 创建数据库 -create database hospital charset utf8; - --- 使用数据库 -use hospital; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-13 19:43:32 */ -/*==============================================================*/ - - -drop table if exists administrative_office;-- 科室 - -drop table if exists doctor;-- 医生 - -drop table if exists drug;-- 药品 - -drop table if exists inpatient_ward;-- 病房 - -drop table if exists nurse;-- 护士 - -drop table if exists nurse2;-- 护理 - -drop table if exists patient;-- 病人 - -drop table if exists user;-- 用 - -drop table if exists ward_type;-- 病房类型 - -/*==============================================================*/ -/* Table: administrative_office */ -/*==============================================================*/ -create table administrative_office -- 科室 -( - administrative_office_id int not null auto_increment,-- 科室编号 - administrative_office_name char(10) not null,-- 科室名称 - administrative_office_phone numeric(11,0) not null,-- 科室电话 - administrative_office_address char(100) not null,-- 科室地址 - primary key (administrative_office_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor-- 医生 -( - doctor_id int not null auto_increment,-- 医生编号 - administrative_office_id int,-- 科室编号 - doctor_name char(10) not null,-- 医生姓名 - doctor_sex char(1) not null,-- 医生性别 - doctor_post char(10) not null,-- 医生职务 - doctor_age char(10) not null,-- 医生年龄 - doctor_price numeric(6,0) not null,-- 医生工资 - doctor_phone int not null,-- 医生电话 - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug-- 药品 -( - drug_id int not null auto_increment,-- 药品编号 - drug_name char(10) not null,-- 药品名称 - drug_manufacturers char(10) not null,-- 药品厂家 - drug_price float(8,2) not null,-- 药品价格 - drug_date date not null,-- 生产日期 - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: inpatient_ward */ -/*==============================================================*/ -create table inpatient_ward-- 病房 -( - inpatient_ward_id int not null auto_increment,-- 病房编号 - ward_type_id int not null,-- 病房类型编号 - inpatient_ward_name int not null,-- 病房名称 - inpatient_ward_floor char(10) not null,-- 病房楼层 - inpatient_ward_sum char(10) not null,-- 病房栋数 - primary key (inpatient_ward_id) -); - -/*==============================================================*/ -/* Table: nurse */ -/*==============================================================*/ -create table nurse-- 护士 -( - nurse_id int not null auto_increment,-- 护士编号 - nurse_name char(10) not null,-- 护士姓名 - nurse_sex char(1) not null,-- 护士性别 - nurse_age char(5) not null,-- 护士年龄 - nurse_price numeric(6,0) not null,-- 护士工资 - primary key (nurse_id) -); - -/*==============================================================*/ -/* Table: nurse2 */ -/*==============================================================*/ -create table nurse2-- 护理 -( - nurse_id int not null,-- 护士编号 - patient_id int not null,-- 患者编号 - primary key (nurse_id, patient_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient-- 病人 -( - patient_id int not null auto_increment,-- 患者编号 - doctor_id int,-- 医生编号 - inpatient_ward_id int,-- 病房编号 - patient_name char(10) not null,-- 患者名称 - patient_sex char(1) not null,-- 患者性别 - patient_age int not null,-- 患者年龄 - patient_history char(100) not null,-- 患者年龄 - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: "use" */ -/*==============================================================*/ -create table user-- 用 -( - drug_id int not null,-- 药品编号 - patient_id int not null,-- 患者编号 - primary key (drug_id, patient_id) -); - -/*==============================================================*/ -/* Table: ward_type */ -/*==============================================================*/ -create table ward_type-- 病房类型 -( - ward_type_id int not null auto_increment,-- 病房类型编号 - administrative_office_id int,-- 科室编号 - ward_type_name char(10) not null,-- 病房类型名称 - ward_type_price numeric(6,0) not null,-- 病房类型价格 - primary key (ward_type_id) -); - -alter table doctor add constraint FK_subordinate foreign key (administrative_office_id) - references administrative_office (administrative_office_id) on delete restrict on update restrict; - -alter table inpatient_ward add constraint FK_set foreign key (ward_type_id) - references ward_type (ward_type_id) on delete restrict on update restrict; - -alter table nurse2 add constraint FK_nurse foreign key (nurse_id) - references nurse (nurse_id) on delete restrict on update restrict; - -alter table nurse2 add constraint FK_nurse2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table patient add constraint FK_Indications foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table patient add constraint FK_check_in foreign key (inpatient_ward_id) - references inpatient_ward (inpatient_ward_id) on delete restrict on update restrict; - -alter table user add constraint FK_use foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -alter table user add constraint FK_use2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table ward_type add constraint FK_belong foreign key (administrative_office_id) - references administrative_office (administrative_office_id) on delete restrict on update restrict; - - - --- 添加数据 - --- 插入科室表 -INSERT INTO administrative_office VALUES -(1,'骨科','16022585641','5栋101'), -(2,'普外科','16045928945','5栋102'), -(3,'妇科','15856842584','5栋103'), -(4,'内科','16053985698','5栋104'); - --- 插入护士表 -INSERT INTO nurse VALUES -(331,'吴天灵','女','25','5600'), -(332,'刘桂花','女','28','5800'), -(333,'王娜娜','女','22','4500'), -(334,'吴胡丽','女','32','8200'); - - --- 插入病房类型表 -INSERT INTO ward_type VALUES -(441,1,'ICU','15000'), -(442,2,'普通病房','120'), -(443,3,'vip独立病房','560'); - --- 插入病房表 -INSERT INTO inpatient_ward VALUES -(551,441,101,'1层','6栋'), -(552,442,102,'2层','6栋'), -(553,443,103,'3层','7栋'), -(554,442,104,'4层','8栋'); - --- 插入药品表 -INSERT INTO drug VALUES -(221,'布洛芬缓释胶囊','北京同仁堂','11','2023-04-12'), -(222,'复方氨基比林','北京双鹤药业','42','2023-02-12'), -(223,'苯巴比妥钠','北京双鹤药业','15','2022-12-15'), -(224,'复方愈创木酚磺酸钾','厦门星鲨制药','15','2023-06-26'), -(225,'维生素B2片','吉林敖东药业集团','13','2023-2-08'); - - - --- 插入医生表 -INSERT INTO doctor VALUES -(111,'1','李斯','男','住院医师','45岁','6500','1505526528'), -(112,'2','张武','男','主治医师','32岁','5200','1605566656'), -(113,'3','王䦹福','女','副主任医师','52岁','7500','1605558551'), -(114,'2','刘民生','男','主任医师','56岁','5600','1803694413'); - --- 插入病人表 -INSERT INTO patient VALUES -(881,111,551,'李黎明','男','25','花粉过敏'), -(882,112,554,'张栋国','男','42','花生过敏'), -(883,114,552,'刘建国','男','56','无'), -(884,113,553,'张立业','男','45','无'); - - --- 插入护理表 -INSERT INTO nurse2 VALUES -(331,881), -(332,882), -(333,883); - --- 插入用药表 -INSERT INTO user VALUES -(221,881), -(222,882), -(223,883); - - -``` - diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230915 \346\261\275\350\275\246\351\224\200\345\224\256\347\263\273\347\273\237.md" "b/37 \346\217\255\351\230\263\344\270\275/20230915 \346\261\275\350\275\246\351\224\200\345\224\256\347\263\273\347\273\237.md" deleted file mode 100644 index 8aae99061c81f5f08979924c10b1a7bad3b1f465..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230915 \346\261\275\350\275\246\351\224\200\345\224\256\347\263\273\347\273\237.md" +++ /dev/null @@ -1,149 +0,0 @@ - - -## E-R图展示: - -https://s2.loli.net/2023/09/18/CsAfU2vqltVQGMH.png - -## 小测,汽车管理系统: - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 10:50:09 */ -/*==============================================================*/ -CREATE DATABASE uu charset utf8; -use uu; - -drop table if exists car; - -drop table if exists client; - -drop table if exists sales_record; - -drop table if exists salesman; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - car_name char(15) not null, - car_brand char(15) not null, - car_type char(15) not null, - primary key (car_id) -); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - client_id int not null auto_increment, - client_name char(15) not null, - client_sex char(3) not null, - client_age char(4) not null, - primary key (client_id) -); - -/*==============================================================*/ -/* Table: sales_record */ -/*==============================================================*/ -create table sales_record -( - sales_record_id int not null auto_increment, - car_id int, - client_id int, - salesman_id char(10), - sales_record_date date not null, - sales_record_price float(7,0) not null, - sales_record_much numeric(20,0) not null, - primary key (sales_record_id) -); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id char(10) not null, - salesman_name char(10) not null, - salesman_sex char(10) not null, - salesman_salary char(10) not null, - primary key (salesman_id) -); - -alter table sales_record add constraint FK_add foreign key (client_id) - references client (client_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_have foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_use foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - - -INSERT into salesman VALUES -(31,'张伞','女',6548), -(32,'李思','男',5566), -(33,'王舞','女',8852), -(34,'刘柳','男',6655); - -INSERT INTO client VALUES -(21,'张三','男','45岁'), -(22,'李四','女','36岁'), -(23,'王五','男','32岁'), -(24,'刘六','女','28岁'); - -INSERT INTO car VALUES -(1,'雷克萨斯','奔驰','敞篷车'), -(2,'英菲尼迪','宝马','高级乘用车'), -(3,'双龙','大众','舱背乘用车'), -(4,'五十铃','本田','普通乘用车'); - -INSERT INTO sales_record VALUES -(41,1,21,31,'2023-05-06',759854,1), -(42,2,22,32,'2023-05-07',500008,3), -(43,3,23,33,'2023-05-08',100052,3), -(44,4,24,34,'2023-05-09',95987,4); - - - -- 1.查询特定销售员的销售记录(查询王舞的销售记录) - - select * from sales_record WHERE salesman_id=( SELECT salesman_id from salesman WHERE salesman_name='王舞'); - - - -- 2.查找销售记录中销售价格最高的汽车 - - SELECT car_brand FROM car left join sales_record on car.car_id= sales_record.car_id where sales_record_price=( SELECT MAX(sales_record_price) from sales_record -); - - -- 3.统计某个销售员的销售总额(查询李思的销售总额) - - select SUM(sales_record_price*sales_record_much) FROM sales_record WHERE salesman_id=( SELECT salesman_id from salesman WHERE salesman_name='李思'); - - -- 4.根据客户信息查询其购买过的汽车(查询张三购买过的汽车) - - select * FROM car where car_id =( SELECT car_id From sales_record where client_id=( SELECT client_id from client WHERE client_name='张三')); - - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - - select car_brand 品牌,count(sales_record_much) 销售数量,sum(sales_record_price) 销售总额 from sales_record s left join car a on s.car_id=a.car_id GROUP BY a.car_brand; - - -- 6.检索特定日期范围内的销售了哪些汽车(指定日期为'2023-05-06') - - select car_name from car where car_id = (select car_id from sales_record where sales_record_date='2023-05-06'); - - - -- 7.查找某车型的销售历史。(查询高级乘用车的销售历史) - - select * from sales_record where car_id =(select car_id from car where car_type='高级乘用车'); - - -- 8.统计每个销售员的销售数量 - - select sm.salesman_name 销售员,count(sales_record_much) 销售数量 from salesman sm left join sales_record s on sm.salesman_id=s.salesman_id GROUP BY salesman_name; - - - -``` - diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230919 \346\237\245\350\257\242\347\273\203\344\271\240.md" "b/37 \346\217\255\351\230\263\344\270\275/20230919 \346\237\245\350\257\242\347\273\203\344\271\240.md" deleted file mode 100644 index ac686a9d274765443b73ef90cae13b9770fafcef..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230919 \346\237\245\350\257\242\347\273\203\344\271\240.md" +++ /dev/null @@ -1,297 +0,0 @@ -#第03章_基本的SELECT语句的课后练习 - - 1. 查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#理解2:计算12月的基本工资和奖金 - -ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - -select sum(salary*12) as 工资总和 FROM employees; - -2.查询employees表中去除重复的job_id以后的数据 - -#去除重复 distinct -select distinct job_id,employees.*from employees; - -3.查询工资大于12000的员工姓名和工资 - -select last_name,salary from employees where salary > 12000; - -4.查询员工号为176的员工的姓名和部门号 - -select last_name,department_id from employees where employee_id = 176; - -5.显示表 departments 的结构,并查询其中的全部数据 - -desc departments; -select * from departments; - -第04章_运算符课后练习 - -1.选择工资不在5000到12000的员工的姓名和工资 - -select last_name,salary from employees where salary < 5000 or salary > 12000; - -2.选择在20或50号部门工作的员工姓名和部门号 - -select last_name,department_id from employees where department_id in (20,50); - -3.选择公司中没有管理者的员工姓名及job_id - -select emp.last_name,emp.job_id from employees emp join departments dep on emp.department_id=dep.department_id where emp.manager_id is null; - -4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select * from employees where commission_pct is not null; - -5.选择员工姓名的第三个字是 尔 的员工姓名 - -select last_name from employees where last_name like '__尔%'; - -6.选择姓名中有 特 字和 尔 字的员工姓名 - -select last_name from employees where last_name like '%特%尔%' or last_name like '%尔%特%'; - -7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select * from employees where first_name like '%尔'; - -8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select last_name,job_title,department_id from employees join jobs on employees.job_id=jobs.job_id where department_id in (80,100); - -9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select last_name,salary,manager_id from employees where manager_id in (100,101,110); - - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select last_name,department_id,(salary+salary * IFNULL(commission_pct,0))*12 from employees ; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -select last_name,salary from employees where salary <8000 or salary>17000 ORDER BY salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select employees.*,email,length(email) 字节数 from employees where email like '%e%' order by 字节数 desc,department_id asc; - -# 第06章_多表查询的课后练习 - -1.显示所有员工的姓名,部门号和部门名称。 - -select e.last_name,e.department_id,d.department_name from employees e left join departments d on e.department_id=d.department_id; - -2.查询90号部门员工的job_id和90号部门的location_id - -select e.job_id,d.location_id,d.department_id from employees e left join departments d on e.department_id=d.department_id where d.department_id=90; - -3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select e.last_name , d.department_name , l.location_id , city from employees e -left join departments d on e.department_id=d.department_id -left join locations l on l.location_id=d.location_id; - -4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select e.last_name,e.job_id,d.department_id,d.department_name,city from employees e -left join departments d on e.department_id=d.department_id -left join locations l on l.location_id=d.location_id where city='多伦多'; - -#sql92语法(自然连接): - -5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -select dep.department_name 部门名称,loc.street_address 部门地址,emp.last_name 姓名,jobs.job_title 工作, emp.salary 工资 from employees emp -left join jobs on emp.job_id=jobs.job_id -left join departments dep on emp.department_id=dep.department_id -left join locations loc on dep.location_id=loc.location_id -where department_name='行政部'; - -6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 - --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 -select a.last_name,a.employee_id,b.last_name,b.employee_id from employees a inner join employees b on a.employee_id=b.manager_id; - -7.查询哪些部门没有员工 - -select d.department_name from employees e right join departments d on e.department_id=d.department_id where employee_id is null; - -8. 查询哪个城市没有部门 - -select city from departments dep right join locations loc on dep.location_id=loc.location_id where department_id is null; - -9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select * from employees e join departments d on e.department_id=d.department_id where department_name in ('销售部','信息技术部'); - -# 第08章_聚合函数的课后练习 - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -select job_id,max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees GROUP BY job_id; - -#4.查询各个job_id的员工人数 -select job_id,count(job_id) from employees GROUP BY job_id; - -5.查询员工最高工资和最低工资的差距 - -select max(salary)-min(salary) from employees; - -6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - -select * from employees where manager_id is not null group by manager_id having min(salary)>=6000; - - -7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name 部门名称,d.location_id 地点编号,count(employee_id) 员工数量,avg(salary) 平均工资 from employees e left join departments d on e.department_id=d.department_id GROUP by d.department_id ORDER BY 平均工资 desc; - -8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select job_title,department_name,min(salary) from employees emp -left join departments dep on emp.department_id=dep.department_id -left join jobs on emp.job_id=jobs.job_id group by job_title,department_name; - -# 第09章_子查询的课后练习 - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -select department_id from employees where last_name='兹洛特基'; -select last_name,salary from employees where department_id=(select department_id from employees where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -select avg(salary) from employees; -select employee_id,last_name,salary from employees where salary>(select avg(salary) from employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary -select max(salary) from employees left join jobs on employees.job_id=jobs.job_id where jobs.job_id='SA_MAN'; -select employees.last_name, jobs.job_id, employees.salary from employees left join jobs on employees.job_id=jobs.job_id where salary>(select max(salary) from employees left join jobs on employees.job_id=jobs.job_id where jobs.job_id='SA_MAN'); - -#! 4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 -SELECT department_id FROM employees where last_name like '%u%' or first_name like '%u%'; - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -select d.department_id from employees e right join departments d on e.department_id=d.department_id where location_id=1700 GROUP BY d.department_id; -select employee_id from employees e left join departments d on e.department_id=d.department_id where e.department_id in (select d.department_id from employees e right join departments d on e.department_id=d.department_id where location_id=1700 GROUP BY d.department_id); - -#6.查询管理者是 金 的员工姓名和工资 -select employee_id from employees where last_name='金'; -select last_name,salary from employees where manager_id in (select employee_id from employees where last_name='金'); - -#7.查询工资最低的员工信息: last_name, salary -select min(salary) from employees; -select last_name, salary from employees where salary=(select min(salary) from employees); - -#8.查询平均工资最低的部门信息 -select * from employees a left join departments b on a.department_id=b.department_id where salary=(select min(salary)from employees); - -#方式1: - -部门最低工资=全司最低 - -#方式2: - -部门平均<= 公司所有平均 - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -select b.*,avg(salary) from employees a left join departments b on a.department_id=b.department_id where salary=(select min(salary) from employees) group by department_id; - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 -select jobs.job_id,avg(salary) from employees left join jobs on employees.job_id=jobs.job_id GROUP BY job_id; -select * from employees a left join jobs b on a.job_id=b.job_id group by b.job_id having salary=(select max(salary) from employees) ; - -#11.查询平均工资高于公司平均工资的部门有哪些? -select department_id,avg(salary) from employees group by department_id having avg(salary)>(select avg(salary) from employees) ; - -#12.查询出公司中所有 manager 的详细信息 - -select * from employees a left join employees b on a.employee_id=b.manager_id; -#方式1:自连接 自己连自己 - - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - - - -​ -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? -select department_id,min(最高工资) from (select max(salary) 最高工资,department_id from employees group by department_id) as a group by department_id; - - -#方式: - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -select avg(salary) 平均工资 from employees group by department_id ; -select last_name,department_id,email,salary from employees group by department_id having avg(salary)=(select max(平均工资)from (select avg(salary) 平均工资 from employees group by department_id) as a); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: -select department_id from employees where job_id !='ST_CLERK'; - -#16. 选择所有没有管理者的员工的last_name -select last_name from employees where manager_id is null; - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: -#方式2: - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 -select avg(salary) 平均工资,department_id from employees group by department_id; -select * from employees a left join (select avg(salary) 平均工资,department_id from employees group by department_id) -b on a.department_id=b.department_id where a.salary>b.平均工资; - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -select department_id from employees group by department_id having count(department_id)>5; -select * from departments where department_id in(select department_id from employees group by department_id having count(department_id)>5); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) -select country_id,count(department_id) from departments a left join locations b on a.location_id=b.location_id group by country_id -having count(department_id)>2; - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - - - - - - - - - - - diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230920 RBAC.md" "b/37 \346\217\255\351\230\263\344\270\275/20230920 RBAC.md" deleted file mode 100644 index 66c49a343dca19522476c30643f84b6071f6d79d..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230920 RBAC.md" +++ /dev/null @@ -1,148 +0,0 @@ - - - - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:37:33 */ -/*==============================================================*/ - -CREATE DATABASE uu charset utf8; -use uu; - -drop table if exists power; - -drop table if exists role; - -drop table if exists role_power; - -drop table if exists user; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: power */ -/*==============================================================*/ -create table power -( - power_id char(10) not null, - power_name char(10) not null, - power_address char(10) not null, - primary key (power_id) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id char(10) not null, - role_name char(11) not null, - primary key (role_id) -); - -/*==============================================================*/ -/* Table: role_power */ -/*==============================================================*/ -create table role_power -( - power_id char(10) not null, - role_id char(10) not null, - primary key (power_id, role_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_name char(11) not null, - user_password char(11) not null, - primary key (user_id) -); - -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - role_id char(10) not null, - user_id int not null, - primary key (role_id, user_id) -); - -alter table role_power add constraint FK_role_power foreign key (power_id) - references power (power_id) on delete restrict on update restrict; - -alter table role_power add constraint FK_role_power2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - - -INSERT INTO user VALUES - -(1,'张三','111111'), -(2,'李四','666666'), -(3,'王五','888888'); - -INSERT INTO role VALUES -(11,'校长'), -(12,'老师'), -(13,'学生'); - - -INSERT into power VALUES -(01,'首页','www.com'), -(02,'教师列表','w.teacher'), -(03,'学生列表','w.student'), -(04,'工资','w.salary'); - - -INSERT INTO user_role VALUES -(11,1), -(12,2), -(13,3); - -INSERT INTO role_power VALUES -(01,11), -(02,11), -(03,11), -(04,11), -(01,12), -(02,12), -(03,12), -(01,13), -(03,13); - - -select * FROM -user u, -role r, -power p, -user_role ur, -role_power rp -WHERE -u.user_id=ur.user_id -and r.role_id=ur.role_id -and p.power_id=rp.power_id -and rp.role_id=ur.role_id -and rp.role_id=r.role_id -and user_name='张三'; - - - - - - - - - -``` - diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230921 sku\347\254\224\350\256\260.txt" "b/37 \346\217\255\351\230\263\344\270\275/20230921 sku\347\254\224\350\256\260.txt" deleted file mode 100644 index 8feb2a6d1b37ecaa4b579f6b5fe5360aa9fe5e53..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230921 sku\347\254\224\350\256\260.txt" +++ /dev/null @@ -1,11 +0,0 @@ -## 笔记 - -spu与sku: - -1.SPu指的是商品,spu届性就是不会影响到库存和价格的属性,又 -叫关键属性,与商品是一对一的关系 - -2.sku指的是具体规格单品,sku属性就是会影响到库存和价格的属性 -又叫销售属性,与商品是多对一的关系 - -3.一个spu有多个sku \ No newline at end of file diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230921 spu\345\222\214sku.md" "b/37 \346\217\255\351\230\263\344\270\275/20230921 spu\345\222\214sku.md" deleted file mode 100644 index 869cc1c80c22350319065f54485234cb0e3ae101..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230921 spu\345\222\214sku.md" +++ /dev/null @@ -1,156 +0,0 @@ -图片:![sku和spu](E:\sku和spu.png) - -代码: - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:27:34 */ -/*==============================================================*/ -CREATE DATABASE uu charset utf8; -use uu; - -drop table if exists property; - -drop table if exists property_value; - -drop table if exists sku; - -drop table if exists sku_property; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: property */ -/*==============================================================*/ -create table property -( - property_id int not null auto_increment, - property_name char(10) not null, - primary key (property_id) -); - -/*==============================================================*/ -/* Table: property_value */ -/*==============================================================*/ -create table property_value -( - property_value_id int not null auto_increment, - property_value_name char(20) not null, - primary key (property_value_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_inventory varchar(50) not null, - sku_price float(7,0) not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: sku_property */ -/*==============================================================*/ -create table sku_property -( - sku_property_id int not null auto_increment, - sku_id int, - property_id int, - property_value_id int, - primary key (sku_property_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_particulars varchar(100) not null, - primary key (spu_id) -); - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -alter table sku_property add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table sku_property add constraint FK_Relationship_3 foreign key (property_id) - references property (property_id) on delete restrict on update restrict; - -alter table sku_property add constraint FK_Relationship_4 foreign key (property_value_id) - references property_value (property_value_id) on delete restrict on update restrict; - - --- 商品表 -INSERT INTO spu VALUES -(1,'华为mate60','遥遥领先'), -(2,'畅享15plus','巨巨坑'); - - --- 规格表 -INSERT INTO sku VALUES -(1,1,'华为 mate60 pro 256G 雅丹黑','60',6999), -(2,1,'华为 mate60 pro 256G 雅川青','60',6999), -(3,1,'华为 mate60 pro 256G 南糥紫','66',6999), -(4,1,'华为 mate60 pro 512G 雅丹黑','80',7999), -(5,1,'华为 mate60 pro 512G 雅川青','120',7999), -(6,1,'华为 mate60 pro 512G 南糥紫','90',7999); - - --- 属性表 -INSERT INTO property VALUES -(1,'颜色'), -(2,'内存'); - - --- 属性值表 -INSERT INTO property_value VALUES -(1,'雅丹黑'), -(2,'雅川青'), -(3,'南糥紫'), -(4,'256G'), -(5,'512G'); - - - --- 规格属性关联表 -INSERT INTO sku_property VALUES -(1,1,1,1),-- 256G 雅丹黑 -(2,1,2,4),-- 256G 雅丹黑 -(3,2,1,2),-- 256G 雅川青 -(4,2,2,4),-- 256G 雅川青 -(5,3,1,3),-- 256G 南糥紫 -(6,3,2,4),-- 256G 南糥紫 -(7,4,1,1),-- 512G 雅丹黑 -(8,4,2,5),-- 512G 雅丹黑 -(9,5,1,2),-- 512G 雅川青 -(10,5,2,5),-- 512G 雅川青 -(11,6,1,3),-- 512G 南糥紫 -(12,6,2,5);-- 512G 南糥紫 - - --- 自然连接全部表,查询所有信息 -select * FROM -spu s, -sku sk, -property p, -property_value pv, -sku_property sp -WHERE -s.spu_id=sk.spu_id -and sk.sku_id=sp.sku_id -and p.property_id=sp.property_id -and pv.property_value_id=sp.property_value_id; - - - -``` - diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230922 \351\242\204\344\271\240\344\272\213\345\212\241\345\222\214\350\247\206\345\233\276.txt" "b/37 \346\217\255\351\230\263\344\270\275/20230922 \351\242\204\344\271\240\344\272\213\345\212\241\345\222\214\350\247\206\345\233\276.txt" deleted file mode 100644 index 91487c30efb8c1b24fbcf561d474afe020ad74cc..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230922 \351\242\204\344\271\240\344\272\213\345\212\241\345\222\214\350\247\206\345\233\276.txt" +++ /dev/null @@ -1,161 +0,0 @@ -## 笔记 - -### 1.事务 - -1什么是事务? -为了完成某个业务面对数居有进行一举列操作,这些操作要么全部成功,要么全部失败 -(2)事务的四个特性 -一致性:事务完成之后,不会将非法的数据写入数据库 -隔离性:多个事务可以在一定程度上并发执行 -持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上) -### 2.视图 - -视图是在已有的表或者视图上创建的虚拟表 - -创建视图:create view 视图名 as select - -删除视图:drop view 视图名 - -## 练习 - -图片:https://s2.loli.net/2023/09/25/AfF4CIiEUPxrawu.png - -课堂练习:水杯销售系统 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/23 22:34:22 */ -/*==============================================================*/ -CREATE DATABASE shuibei charset utf8; -use shuibei ; - -drop table if exists property; - -drop table if exists property_value; - -drop table if exists sku; - -drop table if exists sku_property; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: property */ -/*==============================================================*/ -create table property -( - property_id int not null auto_increment, - property_name char(20) not null, - primary key (property_id) -); - -/*==============================================================*/ -/* Table: property_value */ -/*==============================================================*/ -create table property_value -( - property_value_id int not null auto_increment, - property_value_name char(20) not null, - primary key (property_value_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price float(8,2) not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: sku_property */ -/*==============================================================*/ -create table sku_property -( - sku_property_id int not null auto_increment, - sku_id int, - property_value_id int, - property_id int, - primary key (sku_property_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(20) not null, - spu_particulars varchar(50) not null, - primary key (spu_id) -); - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -alter table sku_property add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table sku_property add constraint FK_Relationship_3 foreign key (property_value_id) - references property_value (property_value_id) on delete restrict on update restrict; - -alter table sku_property add constraint FK_Relationship_4 foreign key (property_id) - references property (property_id) on delete restrict on update restrict; --- 商品表 -INSERT INTO spu VALUES -(1,'水果温显水杯','保温效果好,颜值高,杠杠滴'); --- 规格表 -INSERT INTO sku VALUES -(1,1,'水果温显水杯 鸢尾蓝 280ML',36.9), -(2,1,'水果温显水杯 鸢尾蓝 360ML',66.9), -(3,1,'水果温显水杯 祭红 280ML',36.9), -(4,1,'水果温显水杯 祭红 360ML',66.9), -(5,1,'水果温显水杯 竹青 280ML',36.9), -(6,1,'水果温显水杯 竹青 360ML',66.9); - --- 属性表 -INSERT INTO property VALUES -(1,'颜色'), -(2,'容量'); - --- 属性值表 -INSERT INTO property_value VALUES -(1,'鸢尾蓝'), -(2,'祭红'), -(3,'竹青'), -(4,'280ML'), -(5,'360ML'); - --- 规格属性表 -INSERT INTO sku_property VALUES -(1,1,1,1), -- 鸢尾蓝 280ML -(2,1,4,2), -- 鸢尾蓝 280ML -(3,2,1,1), -- 鸢尾蓝 360ML -(4,2,5,2), -- 鸢尾蓝 360ML -(5,3,2,1), -- 祭红 280ML -(6,3,4,2), -- 祭红 280ML -(7,4,2,1), -- 祭红 360ML -(8,4,5,2), -- 祭红 360ML -(9,5,3,1), -- 竹青 280ML -(10,5,4,2),-- 竹青 280ML -(11,6,3,1),-- 竹青 360ML -(12,6,5,2);-- 竹青 360ML - -select * from -spu s, -sku sk, -property p, -property_value pv, -sku_property sp -where -s.spu_id=sk.spu_id -and sk.sku_id=sp.sku_id -and p.property_id=sp.property_id -and pv.property_value_id=sp.property_value_id; -``` - diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230926 \350\247\206\345\233\276\347\254\224\350\256\260.txt" "b/37 \346\217\255\351\230\263\344\270\275/20230926 \350\247\206\345\233\276\347\254\224\350\256\260.txt" deleted file mode 100644 index 7d4addf4569849fe29ec1560df955a8f9c40356a..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230926 \350\247\206\345\233\276\347\254\224\350\256\260.txt" +++ /dev/null @@ -1,57 +0,0 @@ -## 视图笔记 - -### check 约束 - -语法:check (表达式) - -在utf8中,一个汉字等于一个字符,等于三个字节(使用 length() 函数时注意) - -### 视图 - -在已有的表或者视图上创建的虚拟表 - -有利于数据安全,将过滤后的数据保存成一个视图 - -视图可以基于视图查询视图 - -可在视图名后加(),内放字段别名,但字段个数要相同 - -注意:可以对单表或者多表进行查询,数据库会将视图的定义保存下来,可以对单表进行一些增删改查操作,这些操作会影响原始表 - -#### 创建视图 - -create view 视图名称 as 查询语句; - -#### 查看表格的创建过程 - -show create table 表格名称; - -#### 查看视图的创建过程 - -show create view 视图名称; - -#### 修改视图 - -1.create or replace view 视图名 as 查询语句 (更灵活) - -2.alter view 视图名 as 查询语句 (前提是这个修改的视图一定要存在) - -#### 删除视图 - -drop view 视图名称; - -drop view if exists 视图名称 ;(存在删除,不存在不影响) - -#### 查看视图结构 - -desc 视图名称; - -#### 查询视图 - -select * from 视图名称; - -select 指定的字段名 from 视图名称; - -#### concat - -concat() 函数可以将两个字段连接起来 \ No newline at end of file diff --git "a/37 \346\217\255\351\230\263\344\270\275/20230926 \350\247\206\345\233\276\347\273\203\344\271\240.md" "b/37 \346\217\255\351\230\263\344\270\275/20230926 \350\247\206\345\233\276\347\273\203\344\271\240.md" deleted file mode 100644 index 6cdb8ac40506b3d6e81a9cda9f4b49fd60a1333f..0000000000000000000000000000000000000000 --- "a/37 \346\217\255\351\230\263\344\270\275/20230926 \350\247\206\345\233\276\347\273\203\344\271\240.md" +++ /dev/null @@ -1,83 +0,0 @@ -## 视图练习 - -```mysql - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -CREATE view employee_vu as -SELECT LAST_NAME 姓名, EMPLOYEE_ID 员工号, DEPARTMENT_ID 部门号 from employees; - - - -#2. 显示视图的结构 -desc employee_vu; - -#3. 查询视图中的全部内容 - -select * FROM employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 - -select * FROM employee_vu where 部门号 <=80; - - - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -CREATE view emp_v1 as -SELECT concat(first_name,' ',last_name) 员工姓名,salary 工资, email 邮箱 from employees where phone_number like '011%'; - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - -alter view emp_v1 as -SELECT concat(first_name,' ',last_name) 员工姓名,email 邮箱,phone_number 电话号码, salary 工资 from employees where phone_number like '011%' and email like '%e%'; - -#3. 向 emp_v1 插入一条记录,是否可以? - -不可以 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 - -alter view emp_v1 as -SELECT concat(first_name,' ',last_name) 员工姓名,email 邮箱,phone_number 电话号码, sum(salary+1000) 工资 from employees where phone_number like '011%' and email like '%e%' GROUP BY employee_id; - - -#5. 删除emp_v1中姓名为Olsen的员工 - --- 方法一 (修改视图 在查询语句中过滤掉姓名为Olsen的员工) -alter view emp_v1 as -SELECT concat(first_name,' ',last_name) 员工姓名,email 邮箱,phone_number 电话号码, sum(salary+1000) 工资 from employees where phone_number like '011%' and email like '%e%' and !(first_name like '%Olsen%' or last_name like '%Olsen%') GROUP BY employee_id; - --- 方法二 (在原表中删除姓名为Olsen的员工) -DELETE from employees where first_name like '%Olsen%' or last_name like '%Olsen%' - - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - - -CREATE view emp_v2 AS -select department_id 部门编号, max(salary) 最高工资 from employees where salary >12000 GROUP BY department_id; - - - -#7. 向 emp_v2 中插入一条记录,是否可以? - -不可以 - - -#8. 删除刚才的emp_v2 和 emp_v1 - -drop view emp_v1; -drop view emp_v2; -``` - diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230905 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" "b/39 \351\203\255\346\202\246\350\277\216/20230905 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" deleted file mode 100644 index e3941680ee2c90da1877eb4a609c4d805ed12356..0000000000000000000000000000000000000000 --- "a/39 \351\203\255\346\202\246\350\277\216/20230905 \345\274\200\345\255\246\347\254\254\344\270\200\350\257\276.md" +++ /dev/null @@ -1,3 +0,0 @@ -## 笔记 - -新学期好好学习 \ No newline at end of file diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" "b/39 \351\203\255\346\202\246\350\277\216/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" deleted file mode 100644 index 592a1fc22363feb530c159493bb2d6bdefa0acc9..0000000000000000000000000000000000000000 --- "a/39 \351\203\255\346\202\246\350\277\216/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" +++ /dev/null @@ -1,141 +0,0 @@ -## 数据库设计 - -- 表与表之间的关系:**一对多、一对一、多对多** - -- *关系是相互的*:一个学生,可以选多个课程;一个课程可以被多个学生选 - -### 一对一 - -将其中任一表中的主键放到另一个表中当外键 - -### 一对多 - -将一个所在表的主键,放到多的表当外键 - -### 多对多 - -必须第三张表,将前面两个表的主键放进来当外键 - ------- - -## E-R图 - -- 概念:实体关系图,以实体、关系、属性三个基本概念概括数据的基本结构,从而描述静态数据结构的概念模式 - -- 三要素:实体 属性 关系 - ------- - -## 作业 - -```mysql -create database StudentSystem charset utf-8; -use StudentSystem; --- 学院表 -create table college( - c_id int primary key, - c_name varchar(80), - c_tel varchar(20) -); -insert into college values -(1,'软件工程学院','167567'); - --- 专业表 -create table major( - m_id int primary key, - m_name varchar(20), - c_id int, - foreign key (c_id) reference college(c_id) -); -insert into major values -(1,'软件开发',1), -(2,'前端',2), -(3,'新媒体',3); - --- 班级表 -create table class( - s_grade varchar(10) primary key, - s_name varchar(20), - m_id int, - foreign key (m_id) reference major(m_id) -); -insert into class values -('22级','软件1班',1), -('22级','软件2班',1), -('22级','软件3班',2), -('22级','软件4班',3); - --- 教室表 -create table classroom( - r_id int primary key, - r_name varchar(20), - r_address varchar(20), - courseId int, - foreign key (courseId) reference course(courseId) -); -insert into classroom values -(1,'实训8','望云楼',1), -(2,'实训3','望云楼',3); - --- 课程 -create table course( - courseId int PRIMARY key, - courseName varchar(10), - s_grade varchar(10), - r_id int, - foreign key (s_id) references class(s_id), - foreign key (r_id) references classroom(r_id) -); -insert into course values - (1,'Java','22级',1), - (2,'html','22级',1), - (3,'MySQL','22级',2), - (4,'css','22级',2); - --- 课程表 -create table schedule( - sch_id int primary key, - time varchar(20), - couseId int, - t_id int, - r_id int, - foreign key (couseId) references course(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references classroom(r_id) -); -insert into schedule values -(1,'星期一',2,1), -(2,'星期三',3,2); - --- 教师表 -create table teacher( - t_id int primary key, - t_name varchar(10), - couseId int, - foreign key (couseId) references course(couseId) -); -insert into teacher values -(1,'丘',1), -(2,'李',2); - --- 学生表 -create table student( - stu_id int primary key, - stu_name varchar(20), - stu_age int, - stu_gender varchar(10), - s_grade varchar(10), - foreign -); -insert into student values -(1,'小米',16,'女','22级'), -(2,'小花',16,'女','22级'), -(3,'小红',16,'女','22级'), -(4,'小明',16,'男','22级'), -``` - - - -![01](C:\Users\Administrator\Desktop\01.png) - -![02](C:\Users\Administrator\Desktop\02.png) \ No newline at end of file diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230907 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\2412.md" "b/39 \351\203\255\346\202\246\350\277\216/20230907 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\2412.md" deleted file mode 100644 index 2cbaddf449c4bf068034868d79fdefc7f2fdda49..0000000000000000000000000000000000000000 --- "a/39 \351\203\255\346\202\246\350\277\216/20230907 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\2412.md" +++ /dev/null @@ -1,97 +0,0 @@ -## 数据库的范式 - -### 1、第一范式:要求字段的内容,不可分割,为的是保证数据的原则性 - -### 2、第二范式:要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键,要依赖整个联合主键),而不能只依赖部分 - -e.g. 小明的存在(不能单独存在),是依赖小明爸爸的存在,还得依赖小明妈妈存在 - -### 3、第三范式:满足第二范式的前提上,要求,非主键属性要直接依赖于主键 - ------- - -### 作业 - -```mysql --- 创建数据库 -create database schoolsystem charset utf8; - --- 使用数据库 -use schoolsystem; - --- 学院表 -create table college( - col_id int primary key, - col_name varchar(10), - col_tel varchar(11) -); - - --- 专业表 -create table major( - m_id int primary key, - m_name varchar(10), - col_id int, - foreign key (col_id) references college(col_id) -); - - --- 班级表 -create table class( - cla_id int primary key, - cla_name varchar(10), - m_id int, - foreign key (m_id) references major(m_id) -); - - --- 学生表 -create table student( - stu_id int primary key, - stu_name varchar(10), - stu_gender varchar(1), - stu_age int, - cla_id int, - foreign key (cla_id) references class(cla_id) -); - --- 课程信息表 -create table course( - cou_id int primary key, - cou_name varchar(10), - stu_id int, - foreign key (stu_id) references student(stu_id) -); - --- 教师表 -create table teacher( - t_id int primary key, - t_name varchar(5), - cou_id int, - foreign key (cou_id) references course(cou_id) -); - --- 教室表 -create table classroom( - csr_id int primary key, - csr_name varchar(10), - csr_address varchar(10), - cou_id int, - foreign key (cou_id) references course(cou_id) -); - --- 课程表 -create table timetable( - tt_week varchar(3), - tt_time int, - cla_id int, # 班级编号 - foreign key (cla_id) references class(cla_id), - stu_id int, # 学生编号 - foreign key (stu_id) references student(stu_id), - cou_id int, # 课程编号 - foreign key (cou_id) references course(cou_id), - t_id int, # 教师编号 - foreign key (t_id) references teacher(t_id) -); -``` - diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230908 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" "b/39 \351\203\255\346\202\246\350\277\216/20230908 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" deleted file mode 100644 index 20d7b8ab05413c6cd5b88c852e68782acba99f69..0000000000000000000000000000000000000000 --- "a/39 \351\203\255\346\202\246\350\277\216/20230908 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" +++ /dev/null @@ -1,132 +0,0 @@ -## 笔记 - -#### 使用**PowerDesigner** - -- 第一步:创建概念模型 CDM(类似E-R图)-----‘以用户的角度’ - -- 第二步:转换成逻辑模型 LDM -----‘以计算机的角度’ - -- 第三步:转换成物理模型 PDM -----(以数据库的角度) - -- 第四步:生成DDL - ------- - -## 单词注解 - -```mysql -1、entity 实体 - -2、inheritance 继承;传承 - -3、association 联合;联系 - -4、association link 连接线 - -5、general 综述;概要 - -6、indentifiers 标识符 - -7、cardinalities 基数 - -8、attributes 属性 - -9、mandatory 强制 -``` - - - -## 作业 - -```mysql -CREATE DATABASE Library charset utf8; -use Library; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-11 19:26:08 */ -/*==============================================================*/ - - -drop table if exists book; - -drop table if exists borrow; - -drop table if exists people; - -drop table if exists publish; - -drop table if exists type; - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - b_id int not null auto_increment, - pub_id int not null, - ty_id int not null, - b_name varchar(20) not null, - b_number varchar(10) not null, - b_address varchar(10) not null, - primary key (b_id) -); - -/*==============================================================*/ -/* Table: borrow */ -/*==============================================================*/ -create table borrow -( - p_id int not null, - b_id int not null, - primary key (p_id, b_id) -); - -/*==============================================================*/ -/* Table: people */ -/*==============================================================*/ -create table people -( - p_id int not null auto_increment, - p_name varchar(5) not null, - p_status varchar(5) not null, - primary key (p_id) -); - -/*==============================================================*/ -/* Table: publish */ -/*==============================================================*/ -create table publish -( - pub_id int not null auto_increment, - pub_name varchar(10) not null, - pub_tel varchar(11) not null, - pub_address varchar(20) not null, - pub_email varchar(20) not null, - primary key (pub_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - ty_id int not null auto_increment, - ty_name varchar(10) not null, - primary key (ty_id) -); - -alter table book add constraint FK_come foreign key (pub_id) - references publish (pub_id) on delete restrict on update restrict; - -alter table book add constraint FK_sort foreign key (ty_id) - references type (ty_id) on delete restrict on update restrict; - -alter table borrow add constraint FK_borrow foreign key (p_id) - references people (p_id) on delete restrict on update restrict; - -alter table borrow add constraint FK_borrow2 foreign key (b_id) - references book (b_id) on delete restrict on update restrict; - - -``` - diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230912 \350\261\206\347\223\243\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" "b/39 \351\203\255\346\202\246\350\277\216/20230912 \350\261\206\347\223\243\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" deleted file mode 100644 index 436f8967f1f3e88d2aba2b9acf8d5205493caaaa..0000000000000000000000000000000000000000 --- "a/39 \351\203\255\346\202\246\350\277\216/20230912 \350\261\206\347\223\243\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" +++ /dev/null @@ -1,176 +0,0 @@ -## 笔记 - -今天丘丘老师让我们写豆瓣电影数据库设计的作业。。。。。 - -## 作业 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 11:35:16 */ -/*==============================================================*/ - -create database - -drop table if exists actor; - -drop table if exists film_comment; - -drop table if exists movie; - -drop table if exists movie_comment; - -drop table if exists scriptwriter; - -drop table if exists sheet; - -drop table if exists short; - -drop table if exists user; - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - comment_id int not null, - movie_id int not null, - actor_name varchar(6) not null, - actor_gender char(1) not null, - actor_constellation varchar(3) not null, - actor_birthday date not null, - actor_birthplace varchar(10) not null, - actor_work varchar(10) not null, - actor_alias varchar(10) not null, - actor_family varchar(20) not null, - actor_intro varchar(100) not null, - primary key (comment_id, movie_id) -); - -/*==============================================================*/ -/* Table: film_comment */ -/*==============================================================*/ -create table film_comment -( - comment_id int not null auto_increment, - user_id int not null, - comment_name varchar(20) not null, - comment_title varchar(30) not null, - comment_time datetime not null, - comment_content varchar(500) not null, - comment_evaluate char(2) not null, - primary key (comment_id) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_id int not null auto_increment, - movie_name varchar(10) not null, - movie_country varchar(6) not null, - movie_language varchar(6) not null, - movie_date date not null, - movie_time varchar(5) not null, - movie_alias varchar(50) not null, - primary key (movie_id) -); - -/*==============================================================*/ -/* Table: movie_comment */ -/*==============================================================*/ -create table movie_comment -( - comment_id int not null, - movie_id int not null, - director_name char(10), - primary key (comment_id, movie_id) -); - -/*==============================================================*/ -/* Table: scriptwriter */ -/*==============================================================*/ -create table scriptwriter -( - comment_id int not null, - movie_id int not null, - scriptwriter_name varchar(10) not null, - primary key (comment_id, movie_id) -); - -/*==============================================================*/ -/* Table: sheet */ -/*==============================================================*/ -create table sheet -( - sheet_name varchar(10) not null, - sheet_recommend varchar(20), - sheet_id int not null auto_increment, - movie_id int not null, - primary key (sheet_id) -); - -/*==============================================================*/ -/* Table: short */ -/*==============================================================*/ -create table short -( - short_id int not null auto_increment, - movie_id int not null, - user_id int not null, - short_name varchar(20) not null, - short_score int not null, - short_tag varchar(50) not null, - short_content varchar(350) not null, - short_chose char(2) not null, - primary key (short_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - movie_id int not null, - user_name varchar(20) not null, - primary key (user_id) -); - -alter table actor add constraint FK_actor foreign key (comment_id) - references film_comment (comment_id) on delete restrict on update restrict; - -alter table actor add constraint FK_actor2 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table film_comment add constraint FK_Relationship_5 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table movie_comment add constraint FK_movie_comment foreign key (comment_id) - references film_comment (comment_id) on delete restrict on update restrict; - -alter table movie_comment add constraint FK_movie_comment2 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter foreign key (comment_id) - references film_comment (comment_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter2 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table sheet add constraint FK_Relationship_7 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table short add constraint FK_Relationship_4 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table short add constraint FK_Relationship_6 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table user add constraint FK_Relationship_11 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - - -``` - diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230913 \345\214\273\351\231\242\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" "b/39 \351\203\255\346\202\246\350\277\216/20230913 \345\214\273\351\231\242\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" deleted file mode 100644 index 9475636f62dbf1ff91c5ace660449253ea180df2..0000000000000000000000000000000000000000 --- "a/39 \351\203\255\346\202\246\350\277\216/20230913 \345\214\273\351\231\242\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" +++ /dev/null @@ -1,196 +0,0 @@ -## 笔记 - -- 如果一个主体的属性有多个值,那这个属性就可以拆成一个新主体 - -- 要学会分析 - -## 作业 - -![](C:\0914.png) - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 12:43:15 */ -/*==============================================================*/ - -create database hospital01 charset utf8; -use hospital01; - -drop table if exists department; - -drop table if exists details; - -drop table if exists doctor; - -drop table if exists floor; - -drop table if exists hospital; - -drop table if exists medicine; - -drop table if exists patient; - -drop table if exists pharmacy; - -drop table if exists prescription; - -drop table if exists result; - -/*==============================================================*/ -/* Table: department */ -/*==============================================================*/ -create table department -( - department_id int not null auto_increment, - floor_id int, - hospital_id int, - flo_floor_id int, - department_name varchar(10) not null, - primary key (department_id) -); - -/*==============================================================*/ -/* Table: details */ -/*==============================================================*/ -create table details -( - details_id int not null auto_increment, - medicine_id int, - prescription_id int, - details_use varchar(10) not null, - details_ban varchar(20) not null, - primary key (details_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - department_id int, - doctor_name varchar(4) not null, - doctor_gender char(1) not null, - doctor_tel varchar(11) not null, - doctor_position varchar(5) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: floor */ -/*==============================================================*/ -create table floor -( - floor_id int not null auto_increment, - floor_name varchar(5) not null, - primary key (floor_id) -); - -/*==============================================================*/ -/* Table: hospital */ -/*==============================================================*/ -create table hospital -( - hospital_id int not null auto_increment, - hospital_name varchar(10) not null, - hospital_address varchar(20) not null, - primary key (hospital_id) -); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - medicine_id int not null auto_increment, - pharmacy_id int, - medicine_name varchar(10) not null, - primary key (medicine_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(4) not null, - patient_gender char(1) not null, - patient_age int not null, - patient_address varchar(20) not null, - patient varchar(18) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: pharmacy */ -/*==============================================================*/ -create table pharmacy -( - pharmacy_id int not null auto_increment, - pharmacy_name varchar(10) not null, - primary key (pharmacy_id) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - prescription_id int not null auto_increment, - doctor_id int, - patient_id int, - prescription_use varchar(20) not null, - primary key (prescription_id) -); - -/*==============================================================*/ -/* Table: result */ -/*==============================================================*/ -create table result -( - results_id int not null auto_increment, - doctor_id int not null, - patient_id int, - results_result varchar(50) not null, - results_note varchar(50) not null, - primary key (results_id) -); - -alter table department add constraint FK_Relationship_11 foreign key (floor_id) - references floor (floor_id) on delete restrict on update restrict; - -alter table department add constraint FK_Relationship_7 foreign key (flo_floor_id) - references floor (floor_id) on delete restrict on update restrict; - -alter table department add constraint FK_divide foreign key (hospital_id) - references hospital (hospital_id) on delete restrict on update restrict; - -alter table details add constraint FK_contain foreign key (prescription_id) - references prescription (prescription_id) on delete restrict on update restrict; - -alter table details add constraint FK_refer foreign key (medicine_id) - references medicine (medicine_id) on delete restrict on update restrict; - -alter table doctor add constraint FK_department_doctor foreign key (department_id) - references department (department_id) on delete restrict on update restrict; - -alter table medicine add constraint FK_store foreign key (pharmacy_id) - references pharmacy (pharmacy_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_belongs foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_write foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table result add constraint FK_belong foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table result add constraint FK_doctor_results_give foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - - -``` - diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230915 \346\261\275\350\275\246\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" "b/39 \351\203\255\346\202\246\350\277\216/20230915 \346\261\275\350\275\246\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" deleted file mode 100644 index ba7501d57b0ae6dcbc1ce2e29ed0acd73edc27e0..0000000000000000000000000000000000000000 --- "a/39 \351\203\255\346\202\246\350\277\216/20230915 \346\261\275\350\275\246\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\344\275\234\344\270\232.md" +++ /dev/null @@ -1,125 +0,0 @@ -## 笔记 - - 要复习MySQL语句 - -## 作业 - -E-R图 - -![123.png](https://s2.loli.net/2023/09/17/mj1Hldq6YRzUNVC.png) - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/17 18:54:22 */ -/*==============================================================*/ -create database car01 charset utf8; -use car01; - -drop table if exists car; - -drop table if exists customer; - -drop table if exists salesman; - -drop table if exists salesman_car_sale; - -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - customer_id varchar(5) not null, - customer_name varchar(4) not null, - customer_gender varchar(2) not null, - customer_tel varchar(11) not null, - customer_buy varchar(11) , - primary key (customer_id) -); - -insert into customer values - ('Cus01','小红','女','19023','买过一辆凯迪拉克'), - ('Cus02','小花','女','15436','买过一辆雷克萨斯'), - ('Cus03','小草','男','14457','买过两辆大众'), - ('Cus04','小树','男','19755','买过一辆BMW'); - - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id varchar(5) not null, - customer_id varchar(5), - car_name varchar(5) not null, - car_model varchar(5) not null, - car_price varchar(10) not null, - primary key (car_id) -); - -insert into car values - ('Car01','Cus01','奔驰','大G','99w'), - ('Car02','Cus02','保时捷','帕拉梅拉','90w'), - ('Car03','Cus03','丰田','AE86','40w'), - ('Car04','Cus04','奥迪','A6','10w'); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id varchar(5) not null, - salesman_name varchar(4) not null, - salesman_gender char(2) not null, - salesman_tel varchar(11) not null, - primary key (salesman_id) -); -insert into salesman values - ('Sal01','张三','男','128943'), - ('Sal02','李四','女','128393'), - ('Sal03','王五','男','190894'), - ('Sal04','李杰','男','199283'); - -/*==============================================================*/ -/* Table: salesman_car_sale */ -/*==============================================================*/ -create table salesman_car_sale -( - car_id varchar(5) not null, - salesman_id varchar(5) not null, - sale_date date not null, - sale_price varchar(10) not null, - sale_number varchar(10) not null, - primary key (car_id, salesman_id) -); -insert into salesman_car_sale values - ('Car01','Sal01','2023-08-11','80w','3辆'), - ('Car02','Sal02','2022-10-28','60w','2辆'), - ('Car03','Sal03','2022-09-01','20w','8辆'), - ('Car04','Sal04','2023-11-03','20w','5辆'); - -alter table car add constraint FK_customer_car_buy foreign key (customer_id) - references customer (customer_id) on delete restrict on update restrict; - -alter table salesman_car_sale add constraint FK_salesman_car_sale foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table salesman_car_sale add constraint FK_salesman_car_sale2 foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - --- 1.查询特定销售员的销售记录 -select salesman_name,sale_number from salesman_car_sale a left join salesman s on a.salesman_id = s.salesman_id; --- 2.查找销售记录中销售价格最高的汽车 -select max(sale_price) from salesman_car_sale; --- 3.统计某个销售员的销售总额 -select sum(sale_number) from salesman_car_sale a left join salesman s on a.salesman_id = s.salesman_id where salesman_name = '李杰'; --- 4.根据客户信息查询其购买过的汽车 -select customer_name,customer_buy from customer; --- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 --- 6.检索特定日期范围内的销售了哪些汽车 -select car_name from salesman_car_sale a left join car c on a.salesman_id = c.car_id where sale_date between 2022-09-01 and 2023-08-11; --- 7.查找某车型的销售历史。 --- 8.统计每个销售员的销售数量 -select salesman_name,sale_number from salesman s left join salesman_car_sale a on s.salesman_id = a.salesman_id; -``` - diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230919 \344\275\234\344\270\232.md" "b/39 \351\203\255\346\202\246\350\277\216/20230919 \344\275\234\344\270\232.md" deleted file mode 100644 index 4e42c7dd3c946f1505f9f65ff3244f6f99869d1e..0000000000000000000000000000000000000000 --- "a/39 \351\203\255\346\202\246\350\277\216/20230919 \344\275\234\344\270\232.md" +++ /dev/null @@ -1,869 +0,0 @@ -## 笔记 - -如果值是null,那么所有的null参与的运算,返回的结果也都是null。 - -所以遇上null,却又必须让他参与运算,就使用ifnull(原值,新值),这是函数的作用,如果原值是null,就用新值代替,如果原值不null,就保持原值。 - -## 作业 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ -CREATE DATABASE Homework01 charset utf8; -USE Homework01; -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - - - -# 3.查询工资大于12000的员工姓名和工资 -SELECT first_name,salary FROM employees WHERE salary > 12000; - -# 4.查询员工号为176的员工的姓名和部门号 -SELECT first_name,employee_id FROM employees WHERE employee_id = 176; - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -DESC departments; -SELECT * FROM departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -SELECT first_name,salary FROM employees WHERE salary NOT BETWEEN 5000 AND 12000; - - -# 2.选择在20或50号部门工作的员工姓名和部门号 -SELECT first_name,department_id FROM employees WHERE department_id IN (20,50); - - -# 3.选择公司中没有管理者的员工姓名及job_id -SELECT first_name,job_id,manager_id FROM employees WHERE manager_id IS NULL; - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -SELECT first_name,salary,commission_pct FROM employees WHERE commission_pct IS NOT NULL; - - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 -SELECT first_name FROM employees WHERE first_name LIKE '__尔'; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -SELECT * FROM employees WHERE first_name LIKE '%特%' OR first_name LIKE '%尔%'; - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -SELECT first_name FROM employees WHERE first_name LIKE '%尔'; - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -SELECT d.department_id,e.first_name,d.department_name FROM employees e LEFT JOIN departments d ON e.department_id=d.department_id WHERE d.department_id BETWEEN 80 AND 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -SELECT first_name,salary,manager_id FROM employees WHERE manager_id IN (100,101,110); - - -#第05章_排序与分页的课后练习 -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -SELECT first_name,department_id,salary FROM employees ORDER BY salary DESC; -# - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -SELECT first_name,salary FROM employees WHERE salary NOT BETWEEN 8000 AND 17000 ORDER BY salary DESC LIMIT 20,20; - - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -SELECT * FROM employees WHERE email LIKE '%E%' - - -# 第06章_多表查询的课后练习 -# 1.显示所有员工的姓名,部门号和部门名称。 -SELECT d.department_id,e.first_name,d.department_name FROM employees e LEFT JOIN departments d ON e.department_id=d.department_id; - - -# 2.查询90号部门员工的job_id和90号部门的location_id - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - - - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - - - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 -SELECT e.department_id,e.first_name,d.department_name,salary FROM employees e LEFT JOIN departments d ON e.department_id=d.department_id WHERE department_name ='行政部门'; - - - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -# 7.查询哪些部门没有员工 -SELECT * FROM employees e LEFT JOIN departments d ON e.department_id=d.department_id WHERE department_name IS NULL; - -# 8. 查询哪个城市没有部门 - - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -SELECT * FROM employees e LEFT JOIN departments d ON e.department_id=d.department_id WHERE department_name ='销售部' OR department_name='信息技术部'; - - - -# 第08章_聚合函数的课后练习 -#2.查询公司员工工资的最大值,最小值,平均值,总和 -SELECT MAX(salary),MIN(salary),AVG(salary),SUM(salary) FROM employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -SELECT MAX(salary),MIN(salary),AVG(salary),SUM(salary) FROM employees - -#4.选择各个job_id的员工人数 - -# 5.查询员工最高工资和最低工资的差距 -SELECT MAX(salary) - (SELECT MIN(salary)FROM employees) FROM employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - - - - - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - - - - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - - - - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - - - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - - - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - - - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - --- SELECT employee_id,last_name --- FROM employees - - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - - - - -#6.查询管理者是 金 的员工姓名和工资 -SELECT first_name,salary FROM employees WHERE first_name=(SELECT * FROM employees WHERE first_name LIKE '%金%'); - - - -#7.查询工资最低的员工信息: last_name, salary -SELECT last_name, salary FROM employees WHERE salary=(SELECT MIN(salary) FROM employees); - - - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - - - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) - -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -select - d.*,( - select - avg( salary ) - from - employees - where - department_id = d.department_id - ) -from - departments d -where - department_id = ( - select - department_id - from - employees - group by - department_id - having - avg( salary ) = ( select min( dept_avgsal ) from ( select avg( salary ) dept_avgsal from employees group by department_id ) avg_sal ) - ); - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - -select - * -from - jobs -where - job_id = ( - select - job_id - from - employees - group by - job_id - having - avg( salary ) = ( select max( avg_sal ) from ( select avg( salary ) avg_sal from employees group by job_id ) job_avgsal ) - ); - - -#11.查询平均工资高于公司平均工资的部门有哪些? - -select - department_id -from - employees -where - department_id is not null -group by - department_id -having - avg( salary ) > ( select avg( salary ) from employees ); - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - -select - employee_id, - last_name, - salary -from - employees -where - employee_id in ( select distinct manager_id from employees ); - - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - -#方式: - -select - min( salary ) -from - employees -where - department_id = ( - select - department_id - from - employees - group by - department_id - having - max( salary ) = ( select min( dept_maxsal ) from ( select max( salary ) dept_maxsal from employees group by department_id ) max_sal ) - ); - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -select - employee_id, - last_name, - department_id, - email, - salary -from - employees -where - employee_id in ( - select distinct - manager_id - from - employees - where - department_id = ( - select - department_id - from - employees - group by - department_id - having - avg( salary ) = ( select max( avg_sal ) from ( select avg( salary ) avg_sal from employees group by department_id ) dept_sal ) - ) - ); - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - - - - - -#16. 选择所有没有管理者的员工的last_name - - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - - -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - -select - department_name -from - employees e, - departments d -where - d.department_id = e.department_id -group by - department_name -having - count( 1 )> 5; - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) -select - country_id, - count( 1 ) -from - ( - select distinct - country_id, - d.department_id - from - departments d, - employees e, - locations l - where - d.manager_id = e.manager_id - and l.location_id = d.location_id - ) a -group by - country_id; - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` - diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230920 RBAC.md" "b/39 \351\203\255\346\202\246\350\277\216/20230920 RBAC.md" deleted file mode 100644 index ff2ef783ae3d9346d8b981a588f0546931e844e5..0000000000000000000000000000000000000000 --- "a/39 \351\203\255\346\202\246\350\277\216/20230920 RBAC.md" +++ /dev/null @@ -1,30 +0,0 @@ -## 笔记 - -#### **基于角色的权限访问控制** : RBAC(Role-Based Access Control ) - -1、.概念:一种数据库设计思想,就是用户通过角色与权限进行关联。 - -2、RBAC的组成 ====》三部分: - -- 用户 -- 角色 -- 权限 - -> User(用户):每个用户都有唯一的UID <用户身份证明>识别,被授予不同的角色 -> -> Role(角色):不同角色具有不同的权限 -> -> Permission(权限):访问权限 - -3、RBAC权限模型: - -###### ![aHR0cHM6Ly91c2VyLWdvbGQtY2RuLnhpdHUuaW8vMjAxOS83LzI5LzE2YzNjZWE1OTU3ZGZkZWE.png](https://s2.loli.net/2023/09/20/WkOTMytZKsPoigu.png) - -PS: - -​ 1、用户和角色是多对一关系,即:一个用户只能充当一种角色,一种角色可以有多个用户担当 - -​ 2、角色和权限是多对多关系,即:一个用户可以同时充当多种角色,一种角色可以有多个用户担当 - ------- - diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230921 sku\344\272\254\344\270\234\344\275\234\344\270\232.md" "b/39 \351\203\255\346\202\246\350\277\216/20230921 sku\344\272\254\344\270\234\344\275\234\344\270\232.md" deleted file mode 100644 index 5b491fedc47f983a66b3b30cd343bc1f55c6a176..0000000000000000000000000000000000000000 --- "a/39 \351\203\255\346\202\246\350\277\216/20230921 sku\344\272\254\344\270\234\344\275\234\344\270\232.md" +++ /dev/null @@ -1,97 +0,0 @@ -## 笔记 - -**sku**是库存量单位。即库存进出计量的基本单元,可以是以件,盒,托盘等为单位。 - -一个门店中同一个项目可能有多个SKU。即使绝大部分项目储存在该店中的某一个位置,有些项目可能在多个位置销售,所以会生成额外的 SKU。此外,一款产品有可能根据尺码、颜色或调整等属性的不同而具有多种变化形式。所以,即使在考虑单个位置时,一种产品也可能关联多个SKU。 - -## 作业 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:41:07 */ -/*==============================================================*/ -create database Day0921 charset utf8; -use Day0921; - -drop table if exists attributes; - -drop table if exists attributes_value; - -drop table if exists relation; - -drop table if exists sku; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_id int not null auto_increment, - attributes_name varchar(50) not null, - primary key (attributes_id) -); - -/*==============================================================*/ -/* Table: attributes_value */ -/*==============================================================*/ -create table attributes_value -( - value_id int not null auto_increment, - value_content varchar(50) not null, - primary key (value_id) -); - -/*==============================================================*/ -/* Table: relation */ -/*==============================================================*/ -create table relation -( - relation_id int not null auto_increment, - sku_id int, - attributes_id int, - value_id int, - primary key (relation_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price decimal(9,2) not null, - sku_kc int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_content varchar(50) not null, - primary key (spu_id) -); - -alter table relation add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table relation add constraint FK_Relationship_3 foreign key (attributes_id) - references attributes (attributes_id) on delete restrict on update restrict; - -alter table relation add constraint FK_Relationship_4 foreign key (value_id) - references attributes_value (value_id) on delete restrict on update restrict; - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - - -``` - diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230924 \344\275\234\344\270\232.md" "b/39 \351\203\255\346\202\246\350\277\216/20230924 \344\275\234\344\270\232.md" deleted file mode 100644 index 68ba799f5e160585eec581be2050349755597ec7..0000000000000000000000000000000000000000 --- "a/39 \351\203\255\346\202\246\350\277\216/20230924 \344\275\234\344\270\232.md" +++ /dev/null @@ -1,254 +0,0 @@ -## 一、函数 - -### 1.创建自定义函数 - - (1)DELIMITER $$ 定义结束符。MySQL默认的结束符是分号,但是函数体中可能用到分号。为了避免冲突,需要另外定义结束符。 - - (2)DROP FUNCTION IF EXISTS genPerson$$ 如果函数genPerson已经存在了,就删除掉。 - - (3)CREATE FUNCTION 创建函数genPerson,函数的参数是name,返回值是varchar(50)。 - - (4)函数体放在BEGIN 与 END之间。 - - (5)DECLARE 声明变量,str类型是varchar(50),默认值是空。 - - (6)CONCAT连接多个字符串。 - - (7)RETURN 返回拼接后的字符串str。 - - - - -### 2.执行 - -select 函数名('字段名') - - - -## 二、视图 - -## 视图是虚拟表,本身不存储数据,而是按照指定的方式进行查询 - -创建视图 - -```mysql -CREATE VIEW 视图名(列1,列2...) AS SELECT (列1,列2...) FROM ...; -``` - -使用视图 - -```mysql -当成表使用就好 -``` - - - -修改视图 - -```mysql -CREATE OR REPLACE VIEW 视图名 AS SELECT [...] FROM [...]; -``` - - - -查看数据库已有视图 - -```mysql ->SHOW TABLES [like...];(可以使用模糊查找) -``` - - - -查看视图详情 - -```mysql -DESC 视图名或者SHOW FIELDS FROM 视图名 -``` - - - -视图条件限制 - -```mysql -[WITH CHECK OPTION] -``` - -#### 插入数据 -1. 视图不是表,不直接存储数据,是一张虚拟的表; -2. 一般情况下,在创建有条件限制的视图时,加上“WITH CHECK OPTION”命令*) - -1.通过视图插入数据 - -```mysql ->INSERT INTO v_order(pid,pname,price) VALUES('p010','柴油','34'); -``` - -2.不可以跨表插入数据 - -```mysql -可以通过视图插入数据,但是只能基于一个基础表进行插入,不能跨表更新数据。 -``` - -3.WITH CHECK OPTION -如果在创建视图的时候制定了“WITH CHECK OPTION”,那么更新数据时不能插入或更新不符合视图限制条件的记录。 - -通过视图修改,可能导致数据无故消失,因此: - -> 没有特殊的理由,建议加上“WITH CHECK OPTION”命令。 - -# 百度标准理解 - -#### 1.事务 - -- 原子性:事务包含的这一系列操作,要么全部成功,要么全部失败。(由DBMS的事务管理子系统来实现); -- 一致性:事务完成之后,不会将非法的数据写入数据库。(由DBMS的完整性子系统执行测试任务); -- 隔离性:多个事务可以在一定程度上并发执行。(由DBMS的[并发](https://so.csdn.net/so/search?q=并发&spm=1001.2101.3001.7020)控制子系统实现); - -隔离级别 - -读未提交:一个事务可以读取到另外一个事务尚未提交的数据。该隔离级别可能会产生“脏读”、“不可重复读取”和“幻影读取”问题。 - -读已提交:一个事务只能读取到另外一个事务已经提交的数据。该隔离级别解决了“脏读”问题,但是仍然可能会发生“不可重复读取”和“幻影读取”问题。 - - -可重复读取:在同一个事务当中,多次读取同一份数据,结果一样。该隔离级别解决了“脏读”和“不可重复读取”问题,但是仍然有可能会产生“幻影读取问题”(虚读)。 - -序列化:多个同务只能排队执行,即只有一个事务结束之后,另外一个事务才能开始执行。该隔离级别解决了“脏读”,“不可重复读取”和“幻影读取”问题,但是程序性能会下降。所以只有必要的时候(比如在银行系统里面)才会使用。 - -总结: - - 隔离级别从低到高依次是"读未提交"、“读已提交”、“可重复读取”和“序列化”,隔离级别越高,性能越低。mysql数据库默认隔离级别是“可重复读取”,oracle是“读已提交”。数据库底层使用的“加锁”的机制来实现不同的隔离级别,包括对整个表加锁,对表中的行加锁。 - - mysql数据库开始事务、提交事务、回滚事务 - -```MYSQL -begin; -commit; -rollback; -``` - - mysql数据库必须将数据库引擎设置为"innodb"才能支持事务。 - - - -- 持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上)(由DBMS的恢复管理子系统实现的); - - - -#### 2.视图 - -创建视图 - - create view 视图名 as select(注:可以对单表或者多表进行查询,数据库会将视图的定义保存下来。) - -删除视图 - - drop view 视图名 - -例子 - -```mysql -create table t_emp( - id int primary key auto_increment, - name varchar(50), - salary int, - age int -); - -create view v_emp as select * from t_emp; -create view v_emp2(name,salary) as select name,salary from t_emp; - -insert into v_emp2 values('Jhon',3000); - -create table t_dept( - id int primary key, - name varchar(50), - addr varchar(100) -); -insert into t_dept values(100,'财务部','北京'); -insert into t_dept values(200,'开发部','上海'); - -create table t_staff( - id int primary key auto_increment, - name varchar(30), - age int, - dept_id int -); -insert into t_staff values(null,'张三',33,100); -insert into t_staff values(null,'李四',23,100); -insert into t_staff values(null,'王五',43,200); - -create view v_staff_dept(sname,dname,addr) -as -select s.name sname,d.name dname,d.addr from t_staff s -join t_dept d on s.dept_id = d.id; - -drop view v_emp; - - -``` - -#### 3.索引 - -创建索引 - - create index 索引名 on 表名(字段列表) - -—— 为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - - 注:索引类似于一本书的目录 - -应该将经常作为查询条件的字段加索引,除此以外,还要在分组、过滤、排序及联合查询的字段上加索引 - -删除索引 - - drop index 索引名 on 表名 - -联合索引 - - 所谓联合索引(复合索引),指的是索引字段是多个 - -#### 4.存储过程 - - 存储在数据库端的一组为了完成特定功能的sql语句 - - create procedure 存储过程名([参数]) - - 参数格式 (参数类型 参数名 数据类型) - - 参数类型有三种: - - IN: 输入参数,该参数的值必须在调用该存储过程时指定,在存储过程内部使用, 不能返回。 - - 缺省值是IN。 - - OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - - INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回。 - -#### 5.约束 - -是一种限制,通过对表的行或者列的数据做出限制来确保数据的完整性和一致性。 - - - -主键:相当于唯一性约束 + 非空约束的组合。 - - 注:一张表只能一个主键,数据库会为主键添加主键索引 - - 外键:用于确保两个表之间的参照完整性。 - -插入记录时,要先插入主表中的记录。 -删除记录时,要先删除从表中的记录。 - - 非空: not null - - 唯一性:unique - - 检查(了解): - - 注:检查约束跟数据库版本有关系,mysql8.0.16之后才支持。 - - - -#### 6.Case表达式 \ No newline at end of file diff --git "a/39 \351\203\255\346\202\246\350\277\216/20230926 \350\247\206\345\233\276\344\275\234\344\270\232.md" "b/39 \351\203\255\346\202\246\350\277\216/20230926 \350\247\206\345\233\276\344\275\234\344\270\232.md" deleted file mode 100644 index 2e371faab7280c97b181555f1f5227e56be66fbf..0000000000000000000000000000000000000000 --- "a/39 \351\203\255\346\202\246\350\277\216/20230926 \350\247\206\345\233\276\344\275\234\344\270\232.md" +++ /dev/null @@ -1,366 +0,0 @@ -## 笔记 - -- #### **check约束** - - **作用**:检查某个字段的值是否符合xx要求,一般指的是值的范围(方便用户对数据的操作) - - **语法**:check(表达式) - - ```apl - PS:在utf8中,一个汉字是一个字符,所以一个中文输出的字节长度是3。 - ``` - - ------ - - - #### **视图** view - - `视图是一种虚拟表,本身是不具有数据的` - - - *视图建立在已有表的基础上*,视图赖以建立的这些表为基表 - -【1】创建视图 - -```mysql -create view 视图名称 as 查询语句 -或 -create view 视图名称(视图字段) as 查询语句 -- 小括号内字段个数与select中字段个数相同 -``` - -【2】查看创建的视图数据结构 - -```mysql -show create view 视图名称 -``` - -【3】修改视图 - -```mysql -① create or replace view 视图名称; -- 视图存在就修改,无则创建 -② alter view 视图名称; -- 前提是这个被修改的视图一定要存在 -``` - -【4】删除视图 - -```mysql -drop view 视图名称 -``` - -【5】查看视图 - -```mysql -describe/ desc 视图名称 -``` - - - -## 作业 - -```mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -#第14章_视图的课后练习 -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -CREATE VIEW employee_vu AS -- 视图要建立在已有表的基础上 -SELECT last_name 姓名,employee_id 员工号,department_id 部门号 FROM employees; - -SELECT * FROM employee_vu; - -#2. 显示视图的结构 - -DESC employee_vu; - -#3. 查询视图中的全部内容 - -SHOW CREATE VIEW employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 - -CREATE OR REPLACE VIEW employee_vu AS -SELECT last_name 姓名,employee_id 员工号,department_id 部门号 FROM employees -WHERE department_id = 80; - -SELECT * FROM employee_vu; - -#练习2: -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -CREATE VIEW emp_v1 AS -SELECT last_name 员工姓名,salary 工资,email 邮箱,FROM employees -WHERE phone_number LIKE '011%'; -SELECT * FROM emp_v1; - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - -CREATE OR REPLACE VIEW emp_v1 AS -SELECT last_name 员工姓名,salary 工资,email 邮箱,phone_number 电话号码 FROM employees -WHERE phone_number LIKE '011%' -AND email LIKE '%e%' ; -SELECT * FROM emp_v1; - -#3. 向 emp_v1 插入一条记录,是否可以? - -INSERT INTO emp_v1 VALUES -('jaypark',8000,'GYYYHHH','011.22.1090'); -- 不能向 emp_v1 插入一条记录 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 - -SELECT * FROM emp_v1 ; -UPDATE emp_v1 SET salary=salary+1000; - -#5. 删除emp_v1中姓名为Olsen的员工 - -SELECT * FROM emp_v1 ; -DELETE FROM emp_v1 WHERE last_name = 'Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -CREATE VIEW emp_v2 AS -SELECT department_id 部门id,max(salary) 工资 FROM employees -GROUP BY department_id -HAVING max(salary)>12000; -SELECT * FROM emp_v2 - -#7. 向 emp_v2 中插入一条记录,是否可以? - -INSERT INTO emp_v2 VALUES -(30,'12000'); --- 不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 - -DROP VIEW emp_v1,emp_v2; -SHOW TABLES; -``` - diff --git "a/40 \346\227\266\345\255\246\345\256\211/20230917\346\261\275\350\275\246\344\275\234\344\270\232.md" "b/40 \346\227\266\345\255\246\345\256\211/20230917\346\261\275\350\275\246\344\275\234\344\270\232.md" deleted file mode 100644 index 1a41b4a7b67b186501f8f499c15bd6c5e441740a..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/20230917\346\261\275\350\275\246\344\275\234\344\270\232.md" +++ /dev/null @@ -1,144 +0,0 @@ -~~~mysql -# 任务: - -- 给一个汽车商店设计销售系统的数据库 - -- 顶层实体:汽车、顾客、销售员 - -# 目标: - -- 完成概念模型、逻辑模型、物理模型 - -- 生成DDL SQL语句,建立对应数据库和表结构 - -- 模拟真实数据给每个表插入一些数据。并根据应用场景需求完成 DQL语句 - -# 需求: - -- 1.能记录在售车型的信息、销售员的基本信息、客户的基本信息 - -- 2.进行车辆售卖时,记录销售员、客户、销售日期、实际售卖价格等信息 - -- 3.满足实际应用场景下的数据查询功能 - - -# 应用场景: - -- 1.查询特定销售员的销售记录 - -- 2.查找销售记录中销售价格最高的汽车 - -- 3.统计某个销售员的销售总额 - -- 4.根据客户信息查询其购买过的汽车 - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - -- 8.统计每个销售员的销售数量 -CREATE DATABASE automobile charset utf8; -use automobile; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:58:41 */ -/*==============================================================*/ - - -drop table if exists car; - -drop table if exists client; - -drop table if exists contract; - -drop table if exists salesman; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - car_type varchar(20) not null, - car_introduce varchar(255) not null, - car_price numeric(8,0) not null, - primary key (car_id) -); -INSERT INTO car VALUES -(null,"兰博基尼","好的",200000), -(null,"A4","很好的",250000), -(null,"BMW","超级好的",500000), -(null,"玛莎","非常好的",300000); -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - client_id int not null auto_increment, - client_name varchar(5) not null, - client_sex char(1) not null, - client_age int not null, - primary key (client_id) -); -INSERT INTO client VALUES -(null,"子豪","男",20), -(null,"文诚","女",20), -(null,"凯韩","男",20), -(null,"阿炜","女",20); -/*==============================================================*/ -/* Table: contract */ -/*==============================================================*/ -create table contract -( - contract_id int not null auto_increment, - car_id int, - salesman_id int, - client_id int, - contract_date date not null, - contract_money numeric(8,0) not null, - primary key (contract_id) -); -INSERT INTO contract VALUES -(NULL,2,4,1,"2022-9-8",300000), -(NULL,1,3,3,"2022-12-9",250000), -(NULL,3,1,4,"2022-11-8",1000000), -(NULL,4,4,3,"2022-10-9",8888888), -(NULL,2,2,2,"2022-8-6",300000); - - - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id int not null auto_increment, - salesman_name varchar(5) not null, - salesman_sex char(1) not null, - salesman_age int not null, - primary key (salesman_id) -); -INSERT INTO salesman VALUES -(null,"张三","男",35), -(null,"李四","女",30), -(null,"王五","男",40), -(null,"赵六","女",20); -alter table contract add constraint FK_Relationship_1 foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table contract add constraint FK_Relationship_2 foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - -alter table contract add constraint FK_Relationship_3 foreign key (client_id) - references client (client_id) on delete restrict on update restrict; - --- 1.查询特定销售员的销售记录 -SELECT * from contract a LEFT JOIN salesman b on a.salesman_id=b.salesman_id WHERE salesman_name="张三"; - -- 2.查找销售记录中销售价格最高的汽车 - SELECT car_type , contract_money FROM contract a LEFT JOIN car b on a.car_id = b.car_id WHERE contract_money in( SELECT max(contract_money) FROM contract ) ; - - -- 3.统计某个销售员的销售总额 -SELECT salesman_name 销售员,sum(contract_money) 销售总额 from contract a LEFT JOIN salesman b on a.salesman_id=b.salesman_id WHERE salesman_name in (SELECT salesman_name FROM salesman WHERE salesman_name = "赵六"); - - -- 4.根据客户信息查询其购买过的汽车 - SELECT client_name,car_type FROM client a LEFT JOIN contract b on a.client_id = b.client_id LEFT JOIN car c on b.car_id = c.car_id; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - SELECT car_type 品牌,sum(contract_money) 销售总额,count(c.car_id) 销售数量 FROM contract b LEFT JOIN car c on b.car_id = c.car_id GROUP BY car_type; - -- 6.检索特定日期范围内的销售了哪些汽车 - SELECT * FROM contract a LEFT JOIN car c on a.car_id = c.car_id WHERE contract_date between "2022-10-1" and "2022-12-30"; - -- 7.查找某车型的销售历史。 - SELECT car_type,contract_date FROM contract a LEFT JOIN car c on a.car_id = c.car_id WHERE car_type = "兰博基尼" ; - -- 8.统计每个销售员的销售数量 - SELECT salesman_name 销售员, count(b.salesman_id) 销售数量 from contract a LEFT JOIN salesman b on a.salesman_id = b.salesman_id GROUP BY salesman_name; - - - - -~~~ - diff --git "a/40 \346\227\266\345\255\246\345\256\211/20230920\347\254\224\350\256\260.md" "b/40 \346\227\266\345\255\246\345\256\211/20230920\347\254\224\350\256\260.md" deleted file mode 100644 index c5f89ad71baba9ba6af9a430c38f8c8493c8b521..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/20230920\347\254\224\350\256\260.md" +++ /dev/null @@ -1,114 +0,0 @@ -~~~ mysql -数据库能存什么: - -1业务数据表:用户,商品 - -2功能资源表:菜单信息表,页面代码 - -权限的使用: - -1菜单权限:不同用户登入系统后展示的菜单不同。 - -2按钮权限:不同用户查看同一个对象时展示按钮不一样。 - -3数据权限:可见数据不同 - -4操作权限:可以看未必能用 - -RBAC组成部分:用户,角色,权限。 (角色最重要) - -RBAC跟加便捷了权限对用户的使用。 - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 16:10:02 */ -/*==============================================================*/ - -CREATE DATABASE quanxian charset utf8; - -use quanxian; - -SELECT * FROM `user` WHERE user_id=3; - -SELECT * FROM meun ,rold,`user` WHERE user_id = rold_id and user_id = meun_id; - -drop table if exists meun; - -drop table if exists rold; - -drop table if exists rold_meun; - -drop table if exists user; - -drop table if exists user_rold; - -/*==============================================================*/ -/* Table: meun */ -/*==============================================================*/ -create table meun -( - meun_sy varchar(11) not null, - meun_pt varchar(11) not null, - meun_vip varchar(11) not null, - meun_sw varchar(11) not null, - meun_id int not null auto_increment, - primary key (meun_id) -); - - -/*==============================================================*/ -/* Table: rold */ -/*==============================================================*/ -create table rold -( - rold_ordynary varchar(11) not null, - rold_try varchar(11) not null, - rold_vip varchar(11) not null, - rold_id int not null auto_increment, - primary key (rold_id) -); - -/*==============================================================*/ -/* Table: rold_meun */ -/*==============================================================*/ -create table rold_meun -( - meun_id int not null, - rold_id int not null, - primary key (meun_id, rold_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_permissions varchar(11) not null, - user_name varchar(11) not null, - primary key (user_id) -); - -/*==============================================================*/ -/* Table: user_rold */ -/*==============================================================*/ -create table user_rold -( - rold_id int not null, - user_id int not null, - primary key (rold_id, user_id) -); - -alter table rold_meun add constraint FK_rold_meun foreign key (meun_id) - references meun (meun_id) on delete restrict on update restrict; - -alter table rold_meun add constraint FK_rold_meun2 foreign key (rold_id) - references rold (rold_id) on delete restrict on update restrict; - -alter table user_rold add constraint FK_user_rold foreign key (rold_id) - references rold (rold_id) on delete restrict on update restrict; - -alter table user_rold add constraint FK_user_rold2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; -~~~ - diff --git "a/40 \346\227\266\345\255\246\345\256\211/20230921.md" "b/40 \346\227\266\345\255\246\345\256\211/20230921.md" deleted file mode 100644 index ab762066158d68dc4ec76b41752dfd1e43da52ae..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/20230921.md" +++ /dev/null @@ -1,108 +0,0 @@ -~~~ mysq -# 笔记 - -1.SPU 全称 Standard Product Unit,是标准产品单位。SPU 描述一个产品的各种特性。 - -SKU 全称 Stock Keeping Unit ,库存进出计量的单位 - -所有属性为 一种规格,通过规格定位价格还有库存。 - -# 建库建表 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : kjin - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : taob - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 21/09/2023 11:19:29 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for model --- ---------------------------- -DROP TABLE IF EXISTS `model`; -CREATE TABLE `model` ( - `sku_id` int NOT NULL AUTO_INCREMENT, - `m_name` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`sku_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of model --- ---------------------------- -INSERT INTO `model` VALUES (1, '华为matex5'); - --- ---------------------------- --- Table structure for price --- ---------------------------- -DROP TABLE IF EXISTS `price`; -CREATE TABLE `price` ( - `p_id` int NOT NULL AUTO_INCREMENT, - `pr_id` int NULL DEFAULT NULL, - `p_pr` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`p_id`) USING BTREE, - INDEX `FK_Relationship_3`(`pr_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`pr_id`) REFERENCES `property` (`pr_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of price --- ---------------------------- -INSERT INTO `price` VALUES (1, 1, '16+1t'); -INSERT INTO `price` VALUES (2, 2, '白色'); - --- ---------------------------- --- Table structure for property --- ---------------------------- -DROP TABLE IF EXISTS `property`; -CREATE TABLE `property` ( - `pr_id` int NOT NULL AUTO_INCREMENT, - `sp_id` int NULL DEFAULT NULL, - `pr_name` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`pr_id`) USING BTREE, - INDEX `FK_Relationship_2`(`sp_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`sp_id`) REFERENCES `specification` (`sp_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of property --- ---------------------------- -INSERT INTO `property` VALUES (1, 1, '内存'); -INSERT INTO `property` VALUES (2, 1, '颜色'); - --- ---------------------------- --- Table structure for specification --- ---------------------------- -DROP TABLE IF EXISTS `specification`; -CREATE TABLE `specification` ( - `sp_id` int NOT NULL AUTO_INCREMENT, - `sku_id` int NULL DEFAULT NULL, - `sp_price` decimal(9, 2) NULL DEFAULT NULL, - `inventory` int NULL DEFAULT NULL, - PRIMARY KEY (`sp_id`) USING BTREE, - INDEX `FK_price`(`sku_id` ASC) USING BTREE, - CONSTRAINT `FK_price` FOREIGN KEY (`sku_id`) REFERENCES `model` (`sku_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of specification --- ---------------------------- -INSERT INTO `specification` VALUES (1, 1, 1999.00, 10); - -SET FOREIGN_KEY_CHECKS = 1; - -``` -~~~ - diff --git "a/40 \346\227\266\345\255\246\345\256\211/\344\275\234\344\270\232.md" "b/40 \346\227\266\345\255\246\345\256\211/\344\275\234\344\270\232.md" deleted file mode 100644 index 296b55c9cb1ffe2ab73636f40cc9b67a26b4e719..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/\344\275\234\344\270\232.md" +++ /dev/null @@ -1,90 +0,0 @@ -CREATE DATABASE school CHARSET utf8; -use school; --- 院系表 -CREATE TABLE faculty( - d_id INT PRIMARY KEY, - d_name VARCHAR(255) -); -INSERT INTO faculty VALUES - (1,'软件工程学院'); --- 专业表 -CREATE TABLE specialty( - S_id int PRIMARY KEY, - S_name VARCHAR(255), - d_id int, - FOREIGN KEY (d_id) REFERENCES faculty(d_id) -); -INSERT INTO specialty VALUES - (1,'软件技术',1); --- 班级表 -CREATE TABLE class( - C_id INT PRIMARY KEY, - C_name VARCHAR(20), - grade VARCHAR(5), - s_id INT, - FOREIGN KEY (s_id) REFERENCES specialty(s_id) -); -INSERT INTO class VALUES - (1,'软件技术1班','22级',1), - (2,'软件技术2班','22级',1), - (3,'软件技术7班','22级',1), - (4,'软件技术9班','22级',1); --- 课程 -CREATE TABLE course( - couseId int PRIMARY key, - courseName varchar(10), - c_id int, - r_id int, - foreign key (c_id) references class(C_id), - foreign key (r_id) references classroom(r_id) -); -insert into course VALUES - (1,'Java',1,1), - (2,'MySQL',2,2); --- 教室 -create table classroom( - r_id int PRIMARY KEY, - r_name varchar(10) -); - insert into classroom values -(1,'实训一'), -(2,'实训二'); --- 课程表 -create table `select` ( - selectId int primary key, - couseId int, - time varchar(20), - t_id int, - r_id int, - foreign key (couseId) references course(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references classroom(r_id) -); -insert into `select` values -(1,1,'周一8:00-11:40',2,1), -(2,2,'周一14:00-17:40',1,2); --- 教师 -create table teacher( - t_id int primary key, - t_name varchar(10), - couseId int, - foreign key (couseId) references course(couseId) -); -insert into teacher values -(1,'丘丘',1), -(2,'黑马pink',2); --- 学生 -CREATE TABLE student ( - stu_name VARCHAR(25), - stu_id INT PRIMARY KEY, - C_id INT, - select_id INT, - foreign key (C_id) references class(C_id), - FOREIGN KEY (select_id) REFERENCES `select`(selectId) -); -INSERT INTO student VALUES - ('王影',17,1,1), - ('程舜',52,2,2), - ('李陈毅',49,3,1), - ('李文璐',22,4,1); -~~~ \ No newline at end of file diff --git "a/40 \346\227\266\345\255\246\345\256\211/\345\214\273\351\231\242.md" "b/40 \346\227\266\345\255\246\345\256\211/\345\214\273\351\231\242.md" deleted file mode 100644 index d0b9d5ae663ed2ce501a40b96122120b26345ec9..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/\345\214\273\351\231\242.md" +++ /dev/null @@ -1,171 +0,0 @@ -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 20:31:06 */ -/*==============================================================*/ -drop database if exists doctor; -create database if not exists doctor charset utf8; -use doctor; - -drop table if exists chu_fang; - -drop table if exists dep; - -drop table if exists doctor; - -drop table if exists fee_record; - -drop table if exists guahao; - -drop table if exists medicine; - -drop table if exists patient; - -drop table if exists registration_fee; - -drop table if exists yi_zhu; - -/*==============================================================*/ -/* Table: chu_fang */ -/*==============================================================*/ -create table chu_fang -( - chu_fang_No int not null auto_increment, - doctor_No char(10), - yao_pin_No int not null, - count int not null, - primary key (chu_fang_No) -); - -/*==============================================================*/ -/* Table: dep */ -/*==============================================================*/ -create table dep -( - dep_No int not null auto_increment, - dep_name varchar(10) not null, - dep_tel numeric(11,0) not null, - kezhang_No int not null, - primary key (dep_No) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_No char(10) not null, - doctor_job2 varchar(10), - dep_No int, - dep_name varchar(10) not null, - dep_tel numeric(11,0) not null, - kezhang_No int not null, - doctor_job char(10) not null, - primary key (doctor_No) -); - -/*==============================================================*/ -/* Table: fee_record */ -/*==============================================================*/ -create table fee_record -( - record_No int not null auto_increment, - patient_No int, - patinent_No numeric(9,0) not null, - deal_fee decimal(9,2) not null, - record_time datetime not null, - primary key (record_No) -); - -/*==============================================================*/ -/* Table: guahao */ -/*==============================================================*/ -create table guahao -( - doctor_No char(10) not null, - patient_No int not null, - guahao_No char(10) not null, - primary key (doctor_No, patient_No, guahao_No) -); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - medicine_No int not null auto_increment, - medicine_name char(10) not null, - medicine_type char(10) not null, - medicine_specification varchar(10) not null, - medicine_price decimal(9,2) not null, - medicine_repertory int not null, - primary key (medicine_No) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_No int not null auto_increment, - patient_name char(10) not null, - patient_gender char(1) not null, - patient_ID numeric(18,0) not null, - patient_tel numeric(11,0) not null, - patient_balance decimal(9,2) not null, - primary key (patient_No) -); - -/*==============================================================*/ -/* Table: registration_fee */ -/*==============================================================*/ -create table registration_fee -( - doctor_job2 varchar(10) not null, - registration_fee decimal(9,2) not null, - primary key (doctor_job2) -); - -/*==============================================================*/ -/* Table: yi_zhu */ -/*==============================================================*/ -create table yi_zhu -( - yi_zhu_No int not null auto_increment, - chu_fang_No int, - medicine_No int, - yao_pin_No int not null, - count int not null, - danciyongliang int not null, - pinci int not null, - geiyaofangfa varchar(10) not null, - doctor_No2 int not null, - chufang_No int not null, - primary key (yi_zhu_No) -); - -alter table chu_fang add constraint FK_kaichufang foreign key (doctor_No) - references doctor (doctor_No) on delete restrict on update restrict; - -alter table doctor add constraint FK_have2 foreign key (doctor_job2) - references registration_fee (doctor_job2) on delete restrict on update restrict; - -alter table doctor add constraint FK_pin_yonng foreign key (dep_No) - references dep (dep_No) on delete restrict on update restrict; - -alter table fee_record add constraint FK_have foreign key (patient_No) - references patient (patient_No) on delete restrict on update restrict; - -alter table guahao add constraint FK_Relationship_2 foreign key (doctor_No) - references doctor (doctor_No) on delete restrict on update restrict; - -alter table guahao add constraint FK_Relationship_3 foreign key (patient_No) - references patient (patient_No) on delete restrict on update restrict; - -alter table yi_zhu add constraint FK_kaiyao foreign key (medicine_No) - references medicine (medicine_No) on delete restrict on update restrict; - -alter table yi_zhu add constraint FK_shuyu foreign key (chu_fang_No) - references chu_fang (chu_fang_No) on delete restrict on update restrict; -~~~ - diff --git "a/40 \346\227\266\345\255\246\345\256\211/\345\233\276\344\271\246\351\246\206\344\275\234\344\270\232.md" "b/40 \346\227\266\345\255\246\345\256\211/\345\233\276\344\271\246\351\246\206\344\275\234\344\270\232.md" deleted file mode 100644 index fa474d055e38bce82a0f38da798505199bc31ef3..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/\345\233\276\344\271\246\351\246\206\344\275\234\344\270\232.md" +++ /dev/null @@ -1,294 +0,0 @@ -~~~~mysql -~~~mysql - -~~~ - -/*==============================================================*/ -/* Index: Admin_PK */ -/*==============================================================*/ -create unique index Admin_PK on Admin ( -AdminID ASC -); - -/*==============================================================*/ -/* Index: 拥有_FK */ -/*==============================================================*/ -create index 拥有_FK on Admin ( -r_id ASC -); - -/*==============================================================*/ -/* Table: BookInfo */ -/*==============================================================*/ -create table BookInfo -( - BB—_id char(20) not null, - CC_id integer not null, - AdminID char(5) not null, - CataID char(5) not null, - BB_name char(20) not null, - B_Author char(5) not null, - Press char(20) not null, - Pubdate date not null, - Price numeric(5,1) not null, - B_RRID char(5) not null, - EnterTime timestamp not null, - BB_AdminID char(20) not null, - constraint PK_BOOKINFO primary key (BB—_id) -); - -/*==============================================================*/ -/* Index: BookInfo_PK */ -/*==============================================================*/ -create unique index BookInfo_PK on BookInfo ( -BB—_id ASC -); - -/*==============================================================*/ -/* Index: 包含_FK */ -/*==============================================================*/ -create index 包含_FK on BookInfo ( -CC_id ASC -); - -/*==============================================================*/ -/* Index: 管理1_FK */ -/*==============================================================*/ -create index 管理1_FK on BookInfo ( -AdminID ASC -); - -/*==============================================================*/ -/* Table: BorrowInfo */ -/*==============================================================*/ -create table BorrowInfo -( - b_id char(20) not null, - AdminID char(5) not null, - C_ID integer not null, - BB—_id char(20) not null, - re_id char(20) not null, - reader_id char(20) not null, - BookID char(20) not null, - Btime timestamp not null, - Deadline timestamp not null, - Rtime timestamp null, - State integer not null, - BAdminID char(20) not null, - constraint PK_BORROWINFO primary key (b_id) -); - -/*==============================================================*/ -/* Index: BorrowInfo_PK */ -/*==============================================================*/ -create unique index BorrowInfo_PK on BorrowInfo ( -b_id ASC -); - -/*==============================================================*/ -/* Index: 管理_FK */ -/*==============================================================*/ -create index 管理_FK on BorrowInfo ( -AdminID ASC -); - -/*==============================================================*/ -/* Index: jiaofei_FK */ -/*==============================================================*/ -create index jiaofei_FK on BorrowInfo ( -C_ID ASC -); - -/*==============================================================*/ -/* Index: 借阅1_FK */ -/*==============================================================*/ -create index 借阅1_FK on BorrowInfo ( -BB—_id ASC -); - -/*==============================================================*/ -/* Index: 借阅_FK */ -/*==============================================================*/ -create index 借阅_FK on BorrowInfo ( -re_id ASC -); - -/*==============================================================*/ -/* Table: Catagory */ -/*==============================================================*/ -create table Catagory -( - CC_id integer not null default (S_Catagory.nextval), - CC_name char(20) not null, - constraint PK_CATAGORY primary key (CC_id) -); - -/*==============================================================*/ -/* Index: Catagory_PK */ -/*==============================================================*/ -create unique index Catagory_PK on Catagory ( -CC_id ASC -); - -/*==============================================================*/ -/* Table: Charge */ -/*==============================================================*/ -create table Charge -( - C_ID integer not null, - AdminID char(5) not null, - b_id char(20) null, - C_BID integer not null, - Amount numeric(5,1) not null, - ExecTime timestamp not null, - C_AdminID char(20) not null, - constraint PK_CHARGE primary key (C_ID) -); - -/*==============================================================*/ -/* Index: Charge_PK */ -/*==============================================================*/ -create unique index Charge_PK on Charge ( -C_ID ASC -); - -/*==============================================================*/ -/* Index: 收费_FK */ -/*==============================================================*/ -create index 收费_FK on Charge ( -AdminID ASC -); - -/*==============================================================*/ -/* Index: jiaofei2_FK */ -/*==============================================================*/ -create index jiaofei2_FK on Charge ( -b_id ASC -); - -/*==============================================================*/ -/* Table: Privilege */ -/*==============================================================*/ -create table Privilege -( - Level integer not null, - MaxBookNum integer not null, - MaxDays integer not null, - constraint PK_PRIVILEGE primary key (Level) -); - -/*==============================================================*/ -/* Index: Privilege_PK */ -/*==============================================================*/ -create unique index Privilege_PK on Privilege ( -Level ASC -); - -/*==============================================================*/ -/* Table: ReaderInfo */ -/*==============================================================*/ -create table ReaderInfo -( - re_id char(20) not null, - Level integer not null, - re_name char(5) not null, - dept char(30) null, - re_pwd char(30) not null, - Regtime timestamp not null, - re_Le integer not null, - constraint PK_READERINFO primary key (re_id) -); - -/*==============================================================*/ -/* Index: ReaderInfo_PK */ -/*==============================================================*/ -create unique index ReaderInfo_PK on ReaderInfo ( -re_id ASC -); - -/*==============================================================*/ -/* Index: 限制_FK */ -/*==============================================================*/ -create index 限制_FK on ReaderInfo ( -Level ASC -); - -/*==============================================================*/ -/* Table: ReadingRoom */ -/*==============================================================*/ -create table ReadingRoom -( - r_id char(5) not null, - r_name char(30) not null, - r_address char(30) not null, - constraint PK_READINGROOM primary key (r_id) -); - -/*==============================================================*/ -/* Index: ReadingRoom_PK */ -/*==============================================================*/ -create unique index ReadingRoom_PK on ReadingRoom ( -r_id ASC -); - -alter table Admin - add constraint FK_ADMIN_拥有_READINGR foreign key (r_id) - references ReadingRoom (r_id) - on update restrict - on delete restrict; - -alter table BookInfo - add constraint FK_BOOKINFO_包含_CATAGORY foreign key (CC_id) - references Catagory (CC_id) - on update restrict - on delete restrict; - -alter table BookInfo - add constraint FK_BOOKINFO_管理1_ADMIN foreign key (AdminID) - references Admin (AdminID) - on update restrict - on delete restrict; - -alter table BorrowInfo - add constraint FK_BORROWIN_JIAOFEI_CHARGE foreign key (C_ID) - references Charge (C_ID) - on update restrict - on delete restrict; - -alter table BorrowInfo - add constraint FK_BORROWIN_借阅_READERIN foreign key (re_id) - references ReaderInfo (re_id) - on update restrict - on delete restrict; - -alter table BorrowInfo - add constraint FK_BORROWIN_借阅1_BOOKINFO foreign key (BB—_id) - references BookInfo (BB—_id) - on update restrict - on delete restrict; - -alter table BorrowInfo - add constraint FK_BORROWIN_管理_ADMIN foreign key (AdminID) - references Admin (AdminID) - on update restrict - on delete restrict; - -alter table Charge - add constraint FK_CHARGE_JIAOFEI2_BORROWIN foreign key (b_id) - references BorrowInfo (b_id) - on update restrict - on delete restrict; - -alter table Charge - add constraint FK_CHARGE_收费_ADMIN foreign key (AdminID) - references Admin (AdminID) - on update restrict - on delete restrict; - -alter table ReaderInfo - add constraint FK_READERIN_限制_PRIVILEG foreign key (Level) - references Privilege (Level) - on update restrict - on delete restrict;) - -~~~~ \ No newline at end of file diff --git "a/40 \346\227\266\345\255\246\345\256\211/\345\244\215\344\271\240or\351\242\204\344\271\240.md" "b/40 \346\227\266\345\255\246\345\256\211/\345\244\215\344\271\240or\351\242\204\344\271\240.md" deleted file mode 100644 index 1eaada7c18147f6de5637bb3d0de64c2fc8e5991..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/\345\244\215\344\271\240or\351\242\204\344\271\240.md" +++ /dev/null @@ -1,69 +0,0 @@ -~~~ mys -## 复习 -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不null,就保持原值 - -#### ifnull - -计算时,ifnull(xx,代替值)当xx是null时,用代替值计算 - -使用方式:ifnull(字段名) - -limit 起始数,显示数 - -desc 库名:显示表结构 - -length(email):email的字节长度 - -#### 自然连接 - -表,表 where 字段=字段 and 字段=字段 - -#### 联表区间 - -表 left join 表 on 表.字段 between 表.字段 and 表.字段(不支持别名) - -#### 自连接 - -inner join - -not in(条件,条件) - -!(between 20 and 50) -\ No newline at end of file - +30 08 官文诚/20230924 预习.md 0 → 100644 -### 预习 - - #### 1.事务 - -为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - - #### 事务的四个特性 - -1.原子性:事务包含的这一系列操作,要么全部成功,要么全部失败 2.一致性:事务完成之后,不会将非法的数据写入数据库。 - -3.隔离性:多个事务可以在一定程度上并发执行 - -​ 4.持久性:事务完成之后,数据要永久保存 - -#### 2.视图 在已有的表或者视图上创建的虚拟表 - -创建视图: create view 视图名 asselect 可以对(单表)视图进行一些增删改查的操作,这些操作会影响到原始的表 删除视图:drop view 视图名 - -#### 3.索引 - -为了提高查询的速度而在数据库断创建的一种排序的数据结构 - -#### 4.储存过程 - -存储在数据库端的一组为了完成特点功能的sql语句 - -存储过程:create procedure 存储过程名(【参数】) - -参数格式(参数类型 参数名 数据类型) - -~~~ - diff --git "a/40 \346\227\266\345\255\246\345\256\211/\346\237\245\350\257\242.md" "b/40 \346\227\266\345\255\246\345\256\211/\346\237\245\350\257\242.md" deleted file mode 100644 index 0755137ff6c94e8e066a62ae817796936ccd14ed..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/\346\237\245\350\257\242.md" +++ /dev/null @@ -1,826 +0,0 @@ -~~~ mysql -create database work2_6 charset utf8; -use work2_6; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- - --- Table structure for countries - --- ---------------------------- - -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of countries - --- ---------------------------- - -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- - --- Table structure for departments - --- ---------------------------- - -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of departments - --- ---------------------------- - -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- - --- Table structure for employees - --- ---------------------------- - -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of employees - --- ---------------------------- - -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- - --- Table structure for job_grades - --- ---------------------------- - -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of job_grades - --- ---------------------------- - -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- - --- Table structure for job_history - --- ---------------------------- - -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of job_history - --- ---------------------------- - -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- - --- Table structure for jobs - --- ---------------------------- - -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of jobs - --- ---------------------------- - -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- - --- Table structure for locations - --- ---------------------------- - -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of locations - --- ---------------------------- - -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- - --- Table structure for order - --- ---------------------------- - -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of order - --- ---------------------------- - -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- - --- Table structure for regions - --- ---------------------------- - -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of regions - --- ---------------------------- - -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- - --- View structure for emp_details_view - --- ---------------------------- - -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -#; - -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - -select sum(salary*12) as 工资总和 FROM employees; - -# 2.查询employees表中去除重复的job_id以后的数据 - -#去除重复 distinct -select distinct job_id,employees.*from employees; - -# 3.查询工资大于12000的员工姓名和工资 - -select last_name,salary from employees where salary > 12000; - -# 4.查询员工号为176的员工的姓名和部门号 - -select last_name,department_id from employees where employee_id = 176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -select last_name,salary from employees where salary < 5000 or salary > 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select last_name,department_id from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -select emp.last_name,emp.job_id from employees emp join departments dep on emp.department_id=dep.department_id where emp.manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select * from employees where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select last_name from employees where last_name like '__尔%'; - - - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -select * from employees where first_name like '%特%' or first_name like '%尔%'; - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select * from employees where first_name like '%尔'; - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select first_name 姓名,job_id 工种 from employees where department_id BETWEEN 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select last_name,salary,manager_id from employees where manager_id in (100,101,110); - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select last_name,department_id,(salary+salary * IFNULL(commission_pct,0))*12 from employees ; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -select last_name,salary from employees where salary <8000 or salary>17000 ORDER BY salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select employees.*,email,length(email) 字节数 from employees where email like '%e%' order by 字节数 desc,department_id asc; - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - -select e.last_name,e.department_id,d.department_name from employees e left join departments d on e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -select e.job_id,d.location_id,d.department_id from employees e left join departments d on e.department_id=d.department_id where d.department_id=90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select e.last_name , d.department_name , l.location_id , city from employees e -left join departments d on e.department_id=d.department_id -left join locations l on l.location_id=d.location_id; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select e.last_name,e.job_id,d.department_id,d.department_name,city from employees e -left join departments d on e.department_id=d.department_id -left join locations l on l.location_id=d.location_id where city='多伦多'; - -#sql92语法(自然连接): - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -select dep.department_name 部门名称,loc.street_address 部门地址,emp.last_name 姓名,jobs.job_title 工作, emp.salary 工资 from employees emp -left join jobs on emp.job_id=jobs.job_id -left join departments dep on emp.department_id=dep.department_id -left join locations loc on dep.location_id=loc.location_id -where department_name='行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 - --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 -select a.last_name,a.employee_id,b.last_name,b.employee_id from employees a inner join employees b on a.employee_id=b.manager_id; - -# 7.查询哪些部门没有员工 - -select d.department_name from employees e right join departments d on e.department_id=d.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - -select city from departments dep right join locations loc on dep.location_id=loc.location_id where department_id is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select * from employees e join departments d on e.department_id=d.department_id where department_name in ('销售部','信息技术部'); - -# 第08章_聚合函数的课后练习 - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -select job_id,max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees GROUP BY job_id; - -#4.查询各个job_id的员工人数 -select job_id,count(job_id) from employees GROUP BY job_id; - -# 5.查询员工最高工资和最低工资的差距 - -select max(salary)-min(salary) from employees; - - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name,d.location_id,count(e.employee_id) 员工数量,avg(e.salary) 平均工资 from employees e left join departments d on e.department_id=d.department_id group by e.department_id order by avg(e.salary) desc; - - - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - SELECT - j.job_title 工种名, - d.department_name 部门名, - min( salary ) 最低工资 - FROM - jobs j - LEFT JOIN employees e ON j.job_id = e.job_id - LEFT JOIN departments d ON e.department_id = d.department_id - GROUP BY - j.job_title,d.department_name; - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - -select first_name,last_name,salary from employees where department_id =(select department_id from employees where last_name ='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - -select employee_id,first_name,last_name,salary from employees where salary >(select avg(salary) from employees ); - - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name,job_id,salary from employees where salary>(select max(salary) from employees where JOB_ID = 'SA_MAN'); - - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -select employee_id,first_name from employees where department_id =(SELECT department_id from employees where first_name like '%u%'); - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -select employee_id from employees where department_id= any(select department_id from departments where location_id=1700); - -#6.查询管理者是 金 的员工姓名和工资 - -select first_name,salary from employees where last_name like '金'; - -#7.查询工资最低的员工信息: last_name, salary - -select last_name,salary from employees where salary =(select min(salary) from employees); - -#8.查询平均工资最低的部门信息 - -select * from departments d left join employees e on d.department_id=e.department_id where e.salary=(select min(salary) from employees); - -#方式1: - -# 部门最低工资=全司最低 - -#方式2: - -# 部门平均<= 公司所有平均 - - - - -​ -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -select d.*,min(salary) from departments d left join employees e on d.department_id=e.department_id where e.salary=(select min(salary) from employees)group by e.department_id; - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -select * from jobs j left join employees e on j.job_id=e.job_id where salary=(select max(salary) from employees); - -#方式2:平均工资>=所有平均工资 - - -#11.查询平均工资高于公司平均工资的部门有哪些? - -select avg(salary) from employees; -select ifnull(department_id,0) from employees group by department_id having avg(salary)>(select avg(salary) from employees); - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - - -#方式2:子查询 -#员工编号=(管理员编号有哪些) -select * from employees a left join employees b on a.employee_id=b.manager_id; - - - -​ -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? -select department_id,min(最高工资) from (select max(salary) 最高工资,department_id from employees group by department_id) as a group by department_id; - - - -#方式: - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -select avg(salary) 平均工资 from employees group by department_id ; -select last_name,department_id,email,salary from employees group by department_id having avg(salary)=(select max(平均工资)from (select avg(salary) 平均工资 from employees group by department_id) as a); - - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: -select department_id from employees where job_id !='ST_CLERK'; - - - - - -#16. 选择所有没有管理者的员工的last_name -select last_name from employees where manager_id is null; - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: -select * from employees where last_name - -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -select department_id from employees group by department_id having count(department_id)>5; -select * from departments where department_id in(select department_id from employees group by department_id having count(department_id)>5); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -~~~ - diff --git "a/40 \346\227\266\345\255\246\345\256\211/\347\224\265\345\275\261\344\277\241\346\201\257.md" "b/40 \346\227\266\345\255\246\345\256\211/\347\224\265\345\275\261\344\277\241\346\201\257.md" deleted file mode 100644 index 6ec135dc4140b1194b74d2211d5fe81b5a94c035..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/\347\224\265\345\275\261\344\277\241\346\201\257.md" +++ /dev/null @@ -1,122 +0,0 @@ -~~~mysql - -CREATE DATABASE aa; -use aa; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 11:28:33 */ -/*==============================================================*/ - - -drop table if exists a; - -drop table if exists dianying; - -drop table if exists doubandianying; - -drop table if exists xieyingping; - -drop table if exists yanyuanxinxi; - -drop table if exists ²é¿´ÆÀÂÛ; - -/*==============================================================*/ -/* Table: a */ -/*==============================================================*/ -create table a -( - imdb_id varchar(20) not null, - IMDb varchar(20) not null, - dy_name varchar(20) not null, - primary key (imdb_id, IMDb) -); - -/*==============================================================*/ -/* Table: dianying */ -/*==============================================================*/ -create table dianying -( - IMDb varchar(20) not null, - wz varchar(20), - dy_name varchar(20) not null, - dy_lx varchar(20) not null, - zpgj varchar(20) not null, - dy_language varchar(20) not null, - sy_time date not null, - time time not null, - dy_ym varchar(20), - primary key (IMDb) -); - -/*==============================================================*/ -/* Table: doubandianying */ -/*==============================================================*/ -create table doubandianying -( - wz varchar(20) not null, - mc varchar(20) not null, - primary key (wz) -); - -/*==============================================================*/ -/* Table: xieyingping */ -/*==============================================================*/ -create table xieyingping -( - re_id int not null auto_increment, - IMDb varchar(20), - re_evaluate varchar(20) not null, - re_headline varchar(20) not null, - re_text varchar(999) not null, - primary key (re_id) -); - -/*==============================================================*/ -/* Table: yanyuanxinxi */ -/*==============================================================*/ -create table yanyuanxinxi -( - imdb_id varchar(20) not null, - name varchar(20) not null, - sex char(1) not null, - constellation varchar(20) not null, - birthday varchar(20) not null, - birthplace varchar(20) not null, - occupation varchar(20) not null, - more_name varchar(20) not null, - family varchar(20) not null, - introduction varchar(200) not null, - primary key (imdb_id) -); - -/*==============================================================*/ -/* Table: ²é¿´ÆÀÂÛ */ -/*==============================================================*/ -create table ²é¿´ÆÀÂÛ -( - re_id1 char(10) not null, - IMDb varchar(20), - re_evaluate varchar(20) not null, - re_name char(10) not null, - re_time char(10) not null, - re_text1 char(10) not null, - reply char(10) not null, - primary key (re_id1) -); - -alter table a add constraint FK_Relationship_2 foreign key (imdb_id) - references yanyuanxinxi (imdb_id) on delete restrict on update restrict; - -alter table a add constraint FK_Relationship_5 foreign key (IMDb) - references dianying (IMDb) on delete restrict on update restrict; - -alter table dianying add constraint FK_Relationship_1 foreign key (wz) - references doubandianying (wz) on delete restrict on update restrict; - -alter table xieyingping add constraint FK_Relationship_3 foreign key (IMDb) - references dianying (IMDb) on delete restrict on update restrict; - -alter table ²é¿´ÆÀÂÛ add constraint FK_Relationship_4 foreign key (IMDb) - references dianying (IMDb) on delete restrict on update restrict; -~~~ - diff --git "a/40 \346\227\266\345\255\246\345\256\211/\347\254\224\350\256\2601.md" "b/40 \346\227\266\345\255\246\345\256\211/\347\254\224\350\256\2601.md" deleted file mode 100644 index 40394c1e7ca984e15fa3dea80200e21296fab1a8..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/\347\254\224\350\256\2601.md" +++ /dev/null @@ -1,13 +0,0 @@ -数据库高级 (MySQL) - -JavaScript (Ajax) - -MVC 框架 (Maven,spring,springMvc,Mybatis)java经典框架 俗称SSM - -node.js - -vue.js 简化开发 有UI框架配合 - -springboot (Redis,webAPI) - -node.js 和 vue.js 属于前端 \ No newline at end of file diff --git "a/40 \346\227\266\345\255\246\345\256\211/\347\254\224\350\256\2602.md" "b/40 \346\227\266\345\255\246\345\256\211/\347\254\224\350\256\2602.md" deleted file mode 100644 index 352e2779fa46b3d8b464ff8971310d99ebb150b8..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/\347\254\224\350\256\2602.md" +++ /dev/null @@ -1,17 +0,0 @@ -# 表与表之间的关系: - -一对一的关系:将其中任意表的主键放到另一个表当外键 - -一对多的关系:将一所在的表的主键放到多的表当外键 - -多对多的关系:必须建立第三张表,将前两个表主键当外键 - -# E-R图 - -概念: - -ER图:实体关系图,指**实体,关系,属性**三个具体概念的概括 - -要素: - -3要素:实体(表),属性(字段)和关系(类似外键) \ No newline at end of file diff --git "a/40 \346\227\266\345\255\246\345\256\211/\347\254\224\350\256\2603.md" "b/40 \346\227\266\345\255\246\345\256\211/\347\254\224\350\256\2603.md" deleted file mode 100644 index 04b75198f59baabe31a9b612d2fc98e25d0b4b2c..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/\347\254\224\350\256\2603.md" +++ /dev/null @@ -1,7 +0,0 @@ -# 数据库的范式 - -第一范式:要求字段的内容,不可再分割为保证数据的原子性 - -第二范式:要求在满足第一范式的基础上要求非主键字段要完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 - -第三范式:满足第二范式的前提下要求非主键属性要直接依赖于主键 \ No newline at end of file diff --git "a/40 \346\227\266\345\255\246\345\256\211/\347\254\224\350\256\2604.md" "b/40 \346\227\266\345\255\246\345\256\211/\347\254\224\350\256\2604.md" deleted file mode 100644 index b14024c27f377ebb74f2357b75edbc0c3fec0f51..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/\347\254\224\350\256\2604.md" +++ /dev/null @@ -1,9 +0,0 @@ -# Power Designer: - -第一步:创建概念模型(类似ER图)CDM - -第二步:转换成逻辑模型 LDM - -第三步:转换成物理模型 PDM - -第四步:生成 DDL \ No newline at end of file diff --git "a/40 \346\227\266\345\255\246\345\256\211/\350\247\206\345\233\276.md" "b/40 \346\227\266\345\255\246\345\256\211/\350\247\206\345\233\276.md" deleted file mode 100644 index 8a4d70b81d2dd3cd0b73a8909148efc765e6a7db..0000000000000000000000000000000000000000 --- "a/40 \346\227\266\345\255\246\345\256\211/\350\247\206\345\233\276.md" +++ /dev/null @@ -1,138 +0,0 @@ -~~~~sql -## 笔记 - -### check约束 - -作用:检查某个字段是否符合要求,一般指的是值的范围 age int age>0 - -~~~ sql -语法:create table 表名( - -sex char(1), - -check (sex in ('男','女')) - -); -~~~ - - - -### 在utf8中一个汉字等于一个字符,等于三个字节 - - - -# 视图 - -1.视图是一种虚拟表,本身是不具有数据的,占用很少的内存空间,它是sql中一个重要概念。 - -2.视图建立在已有表的基础上,视图赖从建立的这些表为基表。 - -### 创建视图 - -~~~ sql -create view 视图名 as 查询语句 ---- 将过滤后的数据,保存成一个视图,有利于数据的安全性 -~~~ - -### 基于视图建立视图 - -建立好一个视图后,在这个视图的基础上,继续建视图 - -### 查看表格的创建过程 - -~~~sql -show create table 表名 -show create table 视图名 -~~~ - -### 更新视图数据 - -视图中的行和底层基表中的行之间必须存在一对一的关系(视图虽然可以更新,但总得来说视图作为虚拟表 不建议更新) - -~~~sql -方法一: -create or replace view 视图名 ---- (有这个视图就更新,没有就创建) -方法二: -alter view ---- (前提是这个修改的视图一定有在) - -~~~ - -### 删除视图 - -语法: - -drop view 视图名 - -drop view if exists 视图名 - -## 作业 - -~~~ sql -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE VIEW employee_vu as -SELECT last_name 姓名,employee_id 员工号 , department_id 部门号 FROM employees; - - -#2. 显示视图的结构 - -show CREATE TABLE employee_vu; -#3. 查询视图中的全部内容 - -SELECT * FROM employee_vu; -#4. 将视图中的数据限定在部门号是80的范围内 - -SELECT * FROM employee_vu WHERE 部门号 >=0 and 部门号 <=80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -CREATE VIEW emp_v1 AS -SELECT last_name 员工姓名,salary 工资,email 邮箱 FROM employees where phone_number like '011%'; - - -SELECT * FROM emp_v1; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - -ALTER VIEW emp_v1 as SELECT last_name 员工姓名,salary 工资,phone_number 电话号码, email 邮箱 FROM employees where phone_number like '011%' and email like '%e%'; - -SELECT * FROM emp_v1; - - -#3. 向 emp_v1 插入一条记录,是否可以? - -不可以 - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE emp_v1 set 工资 = 工资+1000; -#5. 删除emp_v1中姓名为Olsen的员工 - -DELETE from emp_v1 where 员工姓名 ='Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -CREATE view emp_v2 as -SELECT d.department_id,max(salary) FROM employees e,departments d WHERE e.department_id=d.department_id and e.salary > 12000 GROUP BY d.department_id; - - -SELECT * FROM emp_v2; -#7. 向 emp_v2 中插入一条记录,是否可以? - -不可以 - - -#8. 删除刚才的emp_v2 和 emp_v1 -DROP VIEW if exists emp_v2; -DROP VIEW if exists emp_v1; -~~~ -~~~~ - diff --git "a/41 \345\221\250\344\272\232\350\276\211/.keep" "b/41 \345\221\250\344\272\232\350\276\211/.keep" deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git "a/41 \345\221\250\344\272\232\350\276\211/20230907\346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" "b/41 \345\221\250\344\272\232\350\276\211/20230907\346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" deleted file mode 100644 index 95bb56f94146c6c1bde591c132fe47a418416063..0000000000000000000000000000000000000000 --- "a/41 \345\221\250\344\272\232\350\276\211/20230907\346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" +++ /dev/null @@ -1,7 +0,0 @@ -## 数据库范式 - -第一范式(1NF):原子性(存储的数据应该具有“不可再分性”) - -第二范式(2NF):唯一性 (消除非主键部分依赖联合主键中的部分字段)(一定要在第一范式已经满足的情况下) - -第三范式(3NF):独立性,消除传递依赖(非主键值不依赖于另一个非主键值) \ No newline at end of file diff --git "a/41 \345\221\250\344\272\232\350\276\211/20230910\345\233\276\344\271\246\351\246\206.md" "b/41 \345\221\250\344\272\232\350\276\211/20230910\345\233\276\344\271\246\351\246\206.md" deleted file mode 100644 index ef9fb2e43d86eb831b43c7be8a6d4112ff68cb17..0000000000000000000000000000000000000000 --- "a/41 \345\221\250\344\272\232\350\276\211/20230910\345\233\276\344\271\246\351\246\206.md" +++ /dev/null @@ -1,271 +0,0 @@ -## 笔记 - -1.先创建概念模型ER表 CDM - -2.将概念转成逻辑模型 LDM - -3.最后转成物理模型 PDM - -## 图书馆 - -```mysql -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW2_BORROW_LIBRARY') then - alter table Borrow2 - delete foreign key FK_BORROW2_BORROW_LIBRARY -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_BORROW2_BORROW2_BORROW') then - alter table Borrow2 - delete foreign key FK_BORROW2_BORROW2_BORROW -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_MANAGE_MANAGE_LIBRARY') then - alter table manage - delete foreign key FK_MANAGE_MANAGE_LIBRARY -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_MANAGE_MANAGE2_WORKING') then - alter table manage - delete foreign key FK_MANAGE_MANAGE2_WORKING -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_SERVE_SERVE_WORKING') then - alter table serve - delete foreign key FK_SERVE_SERVE_WORKING -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_SERVE_SERVE2_BORROW') then - alter table serve - delete foreign key FK_SERVE_SERVE2_BORROW -end if; - -drop index if exists Borrow.Borrow_PK; - -drop table if exists Borrow; - -drop index if exists Borrow2.Borrow2_FK; - -drop index if exists Borrow2.Borrow_FK; - -drop index if exists Borrow2.Borrow2_PK; - -drop table if exists Borrow2; - -drop index if exists library.library_PK; - -drop table if exists library; - -drop index if exists manage.manage2_FK; - -drop index if exists manage.manage_FK; - -drop index if exists manage.manage_PK; - -drop table if exists manage; - -drop index if exists serve.serve_FK; - -drop index if exists serve.serve2_FK; - -drop index if exists serve.serve_PK; - -drop table if exists serve; - -drop index if exists "working personnel"."working personnel_PK"; - -drop table if exists "working personnel"; - -/*==============================================================*/ -/* Table: Borrow */ -/*==============================================================*/ -create table Borrow -( - Bor_id integer not null, - Bor_name varchar(10) not null, - Bor_level integer not null, - Bor_blacklist varchar(10) not null, - constraint PK_BORROW primary key (Bor_id) -); - -/*==============================================================*/ -/* Index: Borrow_PK */ -/*==============================================================*/ -create unique index Borrow_PK on Borrow ( -Bor_id ASC -); - -/*==============================================================*/ -/* Table: Borrow2 */ -/*==============================================================*/ -create table Borrow2 -( - lib_id integer not null, - Bor_id integer not null, - situation char(4) not null, - constraint PK_BORROW2 primary key (lib_id, Bor_id) -); - -/*==============================================================*/ -/* Index: Borrow2_PK */ -/*==============================================================*/ -create unique index Borrow2_PK on Borrow2 ( -lib_id ASC, -Bor_id ASC -); - -/*==============================================================*/ -/* Index: Borrow_FK */ -/*==============================================================*/ -create index Borrow_FK on Borrow2 ( -lib_id ASC -); - -/*==============================================================*/ -/* Index: Borrow2_FK */ -/*==============================================================*/ -create index Borrow2_FK on Borrow2 ( -Bor_id ASC -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - lib_id integer not null, - lib_name varchar(20) not null, - lib_state varchar(3) not null, - lib_author varchar(10) not null, - lib_publish varchar(20) not null, - lib_classes integer not null, - constraint PK_LIBRARY primary key (lib_id) -); - -/*==============================================================*/ -/* Index: library_PK */ -/*==============================================================*/ -create unique index library_PK on library ( -lib_id ASC -); - -/*==============================================================*/ -/* Table: manage */ -/*==============================================================*/ -create table manage -( - lib_id integer not null, - wor_id integer not null, - lib_state varchar(2) not null, - constraint PK_MANAGE primary key (lib_id, wor_id) -); - -/*==============================================================*/ -/* Index: manage_PK */ -/*==============================================================*/ -create unique index manage_PK on manage ( -lib_id ASC, -wor_id ASC -); - -/*==============================================================*/ -/* Index: manage_FK */ -/*==============================================================*/ -create index manage_FK on manage ( -lib_id ASC -); - -/*==============================================================*/ -/* Index: manage2_FK */ -/*==============================================================*/ -create index manage2_FK on manage ( -wor_id ASC -); - -/*==============================================================*/ -/* Table: serve */ -/*==============================================================*/ -create table serve -( - wor_id integer not null, - Bor_id integer not null, - constraint PK_SERVE primary key (wor_id, Bor_id) -); - -/*==============================================================*/ -/* Index: serve_PK */ -/*==============================================================*/ -create unique index serve_PK on serve ( -wor_id ASC, -Bor_id ASC -); - -/*==============================================================*/ -/* Index: serve2_FK */ -/*==============================================================*/ -create index serve2_FK on serve ( -Bor_id ASC -); - -/*==============================================================*/ -/* Index: serve_FK */ -/*==============================================================*/ -create index serve_FK on serve ( -wor_id ASC -); - -/*==============================================================*/ -/* Table: "working personnel" */ -/*==============================================================*/ -create table "working personnel" -( - wor_id integer not null, - wor_name varchar(4) not null, - wor_position varchar(10) not null, - wor_range varchar(20) not null, - wor_state varchar(4) not null, - constraint "PK_WORKING PERSONNEL" primary key (wor_id) -); - -/*==============================================================*/ -/* Index: "working personnel_PK" */ -/*==============================================================*/ -create unique index "working personnel_PK" on "working personnel" ( -wor_id ASC -); - -alter table Borrow2 - add constraint FK_BORROW2_BORROW_LIBRARY foreign key (lib_id) - references library (lib_id) - on update restrict - on delete restrict; - -alter table Borrow2 - add constraint FK_BORROW2_BORROW2_BORROW foreign key (Bor_id) - references Borrow (Bor_id) - on update restrict - on delete restrict; - -alter table manage - add constraint FK_MANAGE_MANAGE_LIBRARY foreign key (lib_id) - references library (lib_id) - on update restrict - on delete restrict; - -alter table manage - add constraint FK_MANAGE_MANAGE2_WORKING foreign key (wor_id) - references "working personnel" (wor_id) - on update restrict - on delete restrict; - -alter table serve - add constraint FK_SERVE_SERVE_WORKING foreign key (wor_id) - references "working personnel" (wor_id) - on update restrict - on delete restrict; - -alter table serve - add constraint FK_SERVE_SERVE2_BORROW foreign key (Bor_id) - references Borrow (Bor_id) - on update restrict - on delete restrict; -``` \ No newline at end of file diff --git "a/41 \345\221\250\344\272\232\350\276\211/20230913 \347\224\265\345\275\261\347\256\241\347\220\206.md" "b/41 \345\221\250\344\272\232\350\276\211/20230913 \347\224\265\345\275\261\347\256\241\347\220\206.md" deleted file mode 100644 index c508181d03ad5f29657ef45a5a64547b654c8952..0000000000000000000000000000000000000000 --- "a/41 \345\221\250\344\272\232\350\276\211/20230913 \347\224\265\345\275\261\347\256\241\347\220\206.md" +++ /dev/null @@ -1,168 +0,0 @@ -## 作业 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : qiqi - Source Server Type : MySQL - Source Server Version : 50741 - Source Host : localhost:3306 - Source Schema : tushu - - Target Server Type : MySQL - Target Server Version : 50741 - File Encoding : 65001 - - Date: 12/09/2023 13:20:37 -*/ -drop DATABASE tushu; -CREATE DATABASE tushu charset utf8; -use tushu; - - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for actors --- ---------------------------- -DROP TABLE IF EXISTS `actors`; -CREATE TABLE `actors` ( - `fm_id` int(11) NOT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `zhiwu` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`fm_id`, `m_id`) USING BTREE, - INDEX `FK_actors2`(`m_id`) USING BTREE, - CONSTRAINT `FK_actors` FOREIGN KEY (`fm_id`) REFERENCES `filmmaker` (`fm_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_actors2` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of actors --- ---------------------------- - --- ---------------------------- --- Table structure for comment --- ---------------------------- -DROP TABLE IF EXISTS `comment`; -CREATE TABLE `comment` ( - `cm_id` int(11) NOT NULL AUTO_INCREMENT, - `u_idd` int(11) NULL DEFAULT NULL, - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `c_disagree` int(11) NULL DEFAULT NULL, - `c_date` datetime NULL DEFAULT NULL, - `c_agree` int(11) NULL DEFAULT NULL, - PRIMARY KEY (`cm_id`) USING BTREE, - INDEX `FK_Relationship_1`(`u_idd`) USING BTREE, - INDEX `FK_Relationship_4`(`m_id`) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`u_idd`) REFERENCES `user` (`u_idd`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`m_id`) REFERENCES `movie` (`m_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of comment --- ---------------------------- -INSERT INTO `comment` VALUES (1, 1, '1', 0, '2023-09-20 13:19:35', 1); -INSERT INTO `comment` VALUES (2, 3, '1', 0, '2023-09-15 13:20:06', 1); - --- ---------------------------- --- Table structure for country --- ---------------------------- -DROP TABLE IF EXISTS `country`; -CREATE TABLE `country` ( - `country_id` int(10) NOT NULL AUTO_INCREMENT, - `country_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `language` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`country_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of country --- ---------------------------- -INSERT INTO `country` VALUES (1, '美国', '英语'); -INSERT INTO `country` VALUES (2, '韩国', '韩语'); - --- ---------------------------- --- Table structure for filmmaker --- ---------------------------- -DROP TABLE IF EXISTS `filmmaker`; -CREATE TABLE `filmmaker` ( - `fm_id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `sex` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `age` int(11) NULL DEFAULT NULL, - `master_work` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `contact` varchar(18) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`fm_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of filmmaker --- ---------------------------- -INSERT INTO `filmmaker` VALUES (1, '席琳·宋', '女', 11, '导演,编剧', '1222'); -INSERT INTO `filmmaker` VALUES (2, ' 格蕾塔·李', '男', 22, '主演', '100'); -INSERT INTO `filmmaker` VALUES (3, '刘台午', '男', 33, '主演', '2222'); -INSERT INTO `filmmaker` VALUES (4, ' 约翰·马加罗', '女', 44, '主演', '4444'); -INSERT INTO `filmmaker` VALUES (5, ' 文胜雅', '男', 55, '主演', '5555'); -INSERT INTO `filmmaker` VALUES (6, '尹智慧', '女', 66, '主演', '6666'); - --- ---------------------------- --- Table structure for movie --- ---------------------------- -DROP TABLE IF EXISTS `movie`; -CREATE TABLE `movie` ( - `m_id` varchar(14) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `type_id` int(11) NULL DEFAULT NULL, - `country_id` int(11) NULL DEFAULT NULL, - `m_name` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_award` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_length` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `m_intro` varchar(300) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`m_id`) USING BTREE, - INDEX `FK_Relationship_3`(`type_id`) USING BTREE, - INDEX `FK_Relationship_6`(`country_id`) USING BTREE, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`type_id`) REFERENCES `movietype` (`type_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_6` FOREIGN KEY (`country_id`) REFERENCES `country` (`country_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of movie --- ---------------------------- -INSERT INTO `movie` VALUES ('1', 1, 1, '过往人生', '第73届柏林国际电影节', '106', 'Nora(Greta Lee 饰)自小便因家庭因素搬离首尔移居加拿大。她与青梅竹马 Hae Sung(刘台午 饰)的关系最终停留在稚幼的凝视不语。而在二十年后,命运令两人于纽约重逢。可此时 Nora已拥有新的身份,甚至已和Arthur(John Magaro 饰)建立家庭。和Hae Sung 分开二十年后的重逢,也令她重新思索生活中的真正渴望。'); - --- ---------------------------- --- Table structure for movietype --- ---------------------------- -DROP TABLE IF EXISTS `movietype`; -CREATE TABLE `movietype` ( - `type_id` int(10) NOT NULL AUTO_INCREMENT, - `type_name` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - PRIMARY KEY (`type_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of movietype --- ---------------------------- -INSERT INTO `movietype` VALUES (1, '爱情'); - --- ---------------------------- --- Table structure for user --- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `u_idd` int(11) NOT NULL AUTO_INCREMENT, - `u_id` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, - `u_IP` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - `u_name` varchar(15) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`u_idd`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '2', '美国', 'Seb’s '); -INSERT INTO `user` VALUES (3, '4', '法国', 'DeadVolcano '); - -SET FOREIGN_KEY_CHECKS = 1; -``` \ No newline at end of file diff --git "a/41 \345\221\250\344\272\232\350\276\211/20230914\345\214\273\347\224\237\357\274\214\347\227\205\344\272\272\344\270\216\350\215\257\345\223\201.md" "b/41 \345\221\250\344\272\232\350\276\211/20230914\345\214\273\347\224\237\357\274\214\347\227\205\344\272\272\344\270\216\350\215\257\345\223\201.md" deleted file mode 100644 index f6f09be6fdf09f216819299812d1694ce50df03e..0000000000000000000000000000000000000000 --- "a/41 \345\221\250\344\272\232\350\276\211/20230914\345\214\273\347\224\237\357\274\214\347\227\205\344\272\272\344\270\216\350\215\257\345\223\201.md" +++ /dev/null @@ -1,105 +0,0 @@ -## 笔记 - -如果一个主体的属性有多个值,那这个属性就可以拆成一个新主体 - -## 作业 - -医生,病人,药品制表 - -``` mysql - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-14 08:55:14 */ -/*==============================================================*/ - - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists medical; - -drop table if exists patients; - -drop table if exists prescription; - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doc_id int not null auto_increment, - doc_no varchar(20) not null, - doc_name varchar(10) not null, - doc_sex varchar(5), - primary key (doc_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - dro_id int not null auto_increment, - dro_name varchar(20) not null, - primary key (dro_id) -); - -/*==============================================================*/ -/* Table: medical */ -/*==============================================================*/ -create table medical -( - ca_id int not null auto_increment, - doc_id int, - bat_no int, - date date, - diagnose varchar(50), - primary key (ca_id) -); - -/*==============================================================*/ -/* Table: patients */ -/*==============================================================*/ -create table patients -( - bat_no int not null auto_increment, - bat_name varchar(10) not null, - bat_age int, - bat_sex varchar(5), - primary key (bat_no) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - dro_id int not null, - ca_id int not null, - bat_no int, - usa varchar(20), - dosage varchar(20), - primary key (dro_id, ca_id) -); - -alter table medical add constraint FK_Relationship_1 foreign key (doc_id) - references doctor (doc_id) on delete restrict on update restrict; - -alter table medical add constraint FK_Relationship_2 foreign key (bat_no) - references patients (bat_no) on delete restrict on update restrict; - -alter table prescription add constraint FK_Relationship_5 foreign key (bat_no) - references patients (bat_no) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription foreign key (dro_id) - references drug (dro_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription2 foreign key (ca_id) - references medical (ca_id) on delete restrict on update restrict; -``` - - - diff --git "a/41 \345\221\250\344\272\232\350\276\211/20230915\346\261\275\350\275\246.md" "b/41 \345\221\250\344\272\232\350\276\211/20230915\346\261\275\350\275\246.md" deleted file mode 100644 index e2c9a2ab19217a00abe7b667d3394fd2fa6471b0..0000000000000000000000000000000000000000 --- "a/41 \345\221\250\344\272\232\350\276\211/20230915\346\261\275\350\275\246.md" +++ /dev/null @@ -1,107 +0,0 @@ -作业 - -以汽车,用户,销售为题制表 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : kjin - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : car - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 15/09/2023 17:26:52 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for car --- ---------------------------- -DROP TABLE IF EXISTS `car`; -CREATE TABLE `car` ( - `c_id` int NOT NULL AUTO_INCREMENT, - `c_brand` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `c_model` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`c_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of car --- ---------------------------- -INSERT INTO `car` VALUES (1, '火力赛车f1', '奥迪双钻'); -INSERT INTO `car` VALUES (2, '火力赛车f1二代', '奥迪双钻'); -INSERT INTO `car` VALUES (3, '摇摇车', '山寨贴牌'); - --- ---------------------------- --- Table structure for client --- ---------------------------- -DROP TABLE IF EXISTS `client`; -CREATE TABLE `client` ( - `k_id` int NOT NULL AUTO_INCREMENT, - `k_name` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `k_sex` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - `k_call` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`k_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of client --- ---------------------------- -INSERT INTO `client` VALUES (1, '小黎', '男', '114514'); -INSERT INTO `client` VALUES (2, '小韩', '男', '119110'); - --- ---------------------------- --- Table structure for record --- ---------------------------- -DROP TABLE IF EXISTS `record`; -CREATE TABLE `record` ( - `rec_id` int NOT NULL AUTO_INCREMENT, - `k_id` int NOT NULL, - `s_id` int NOT NULL, - `c_id` int NULL DEFAULT NULL, - `r_price` int NULL DEFAULT NULL, - `date` date NULL DEFAULT NULL, - PRIMARY KEY (`rec_id`) USING BTREE, - INDEX `AK_Identifier_1`(`rec_id` ASC, `k_id` ASC, `s_id` ASC) USING BTREE, - INDEX `FK_Relationship_4`(`c_id` ASC) USING BTREE, - INDEX `FK_record`(`k_id` ASC) USING BTREE, - INDEX `FK_record2`(`s_id` ASC) USING BTREE, - CONSTRAINT `FK_record` FOREIGN KEY (`k_id`) REFERENCES `client` (`k_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_record2` FOREIGN KEY (`s_id`) REFERENCES `salesman` (`s_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`c_id`) REFERENCES `car` (`c_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of record --- ---------------------------- -INSERT INTO `record` VALUES (1, 1, 1, 1, 20, '2023-09-15'); -INSERT INTO `record` VALUES (2, 2, 1, 2, 80, '2023-09-15'); -INSERT INTO `record` VALUES (3, 2, 2, 3, 100, '2023-09-15'); - --- ---------------------------- --- Table structure for salesman --- ---------------------------- -DROP TABLE IF EXISTS `salesman`; -CREATE TABLE `salesman` ( - `s_id` int NOT NULL AUTO_INCREMENT, - `s_name` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `s_sex` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`s_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of salesman --- ---------------------------- -INSERT INTO `salesman` VALUES (1, '小王', '男'); -INSERT INTO `salesman` VALUES (2, '小八', '男'); - -SET FOREIGN_KEY_CHECKS = 1; -``` \ No newline at end of file diff --git "a/41 \345\221\250\344\272\232\350\276\211/20230920mysql\345\244\215\344\271\240.md" "b/41 \345\221\250\344\272\232\350\276\211/20230920mysql\345\244\215\344\271\240.md" deleted file mode 100644 index ea75960d9aed14e90f570533569f8eb8557261af..0000000000000000000000000000000000000000 --- "a/41 \345\221\250\344\272\232\350\276\211/20230920mysql\345\244\215\344\271\240.md" +++ /dev/null @@ -1,266 +0,0 @@ -## 作业 - -```mysql -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -SELECT SUM(salary+(salary*IFNULL(commission_pct,1)))*12 工资总和 FROM employees; -#理解1:计算12月的基本工资 -#SELECT sum(salary*12) as 工资总和 FROM employees; -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的 job_id 以后的数据 -#去除重复 distinct -SELECT DISTINCT job_id FROM employees; - - -# 3.查询工资大于12000的员工姓名和工资 -SELECT first_name,last_name,salary FROM employees WHERE salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 -SELECT first_name,last_name,job_id FROM employees WHERE employee_id=176; - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -DESC departments; -SELECT * FROM departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -SELECT * FROM employees WHERE salary NOT in (5000,12000); - - -# 2.选择在20或50号部门工作的员工姓名和部门号 -SELECT * FROM employees WHERE department_id=20 OR department_id=50; - -# 3.选择公司中没有管理者的员工姓名及job_id -SELECT first_name,last_name,job_id FROM employees WHERE manager_id IS NULL; - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -SELECT first_name,last_name,salary,commission_pct FROM employees WHERE commission_pct IS NOT NULL; - - - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 -SELECT * FROM employees WHERE last_name like '__尔%'; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -SELECT * FROM employees WHERE last_name like '%尔%' or '%特%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -SELECT * FROM employees WHERE last_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -SELECT * FROM employees WHERE department_id BETWEEN 80 AND 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -SELECT * FROM employees WHERE department_id in(100,101,110); - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -SELECT * FROM employees ORDER BY salary DESC; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -SELECT * FROM employees WHERE salary not BETWEEN 8000 AND 17000 ORDER BY salary DESC LIMIT 20,20; - - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -SELECT * FROM employees WHERE email LIKE '%e%' ORDER BY LENGTH(email) DESC , department_id; - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -SELECT e.first_name,e.last_name,e.department_id,d.department_name FROM employees e INNER JOIN departments d ON e.department_id=d.department_id; - -# 2.查询90号部门员工的 job_id 和90号部门的location_id -SELECT e.job_id,e.department_id,d.location_id FROM employees e INNER JOIN departments d ON e.department_id=d.department_id WHERE e.department_id=90; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city -SELECT e.last_name,d.department_name,d.location_id,l.city -FROM - employees e - INNER JOIN departments d -on - e.department_id = d.department_id - INNER JOIN locations l ON d.location_id = l.location_id -WHERE - e.commission_pct IS NOT NULL; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -SELECT e.last_name,e.job_id,e.department_id,d.department_name from employees e INNER JOIN departments d on e.department_id=d.department_id where d.location_id= -(SELECT location_id FROM locations WHERE city='多伦多'); - - -#sql92语法(自然连接) - -# 5.查询 行政部 门员工的部门名称、部门地址、姓名、工作、工资 -SELECT d.department_name,l.city,e.last_name,j.job_title,e.salary from departments d INNER JOIN locations l on d.location_id=l.location_id INNER JOIN employees e on d.department_id=e.department_id INNER JOIN jobs j on e.job_id=j.job_id WHERE d.department_name='行政部'; - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 -SELECT e1.last_name,e1.employee_id,e2.last_name,e2.employee_id from employees e1 INNER JOIN employees e2 on e1.manager_id=e2.employee_id; - -# 7.查询哪些部门没有员工 -SELECT d.department_name from employees e RIGHT JOIN departments d on e.department_id=d.department_id WHERE e.employee_id IS null; -# 8. 查询哪个城市没有部门 -SELECT city from departments d RIGHT JOIN locations l on d.location_id=l.location_id where department_id IS NULL; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -SELECT e.* FROM employees e INNER JOIN departments d on e.department_id=d.department_id where d.department_name='销售部'or '信息技术部'; -# 第08章_聚合函数的课后练习 - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -SELECT MAX(salary),MIN(salary),AVG(salary),SUM(salary) FROM employees; - -#3.查询各 job_id 的员工工资的最大值,最小值,平均值,总和 -SELECT job_id,MAX(salary),MIN(salary),AVG(salary),SUM(salary) FROM employees GROUP BY job_id; - -#4.选择各个job_id的员工人数 -SELECT job_id,COUNT(job_id) from employees GROUP BY job_id; - -# 5.查询员工最高工资和最低工资的差距 -SELECT MAX(salary)-MIN(salary) FROM employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 -SELECT manager_id,MIN(salary) FROM employees WHERE manager_id IS NOT NULL GROUP BY manager_id HAVING MIN(salary)>6000; - -# 7.查询所有部门的名字,location_id,员工数量 和 平均工资,并按平均工资降序 -SELECT d.department_name,location_id,e1.`员工数量`,e1.`平均工资` FROM departments d INNER JOIN ( -SELECT e.department_id,COUNT(e.salary) 员工数量,AVG(e.salary) 平均工资 FROM employees e GROUP BY e.department_id) e1 on d.department_id=e1.department_id ORDER BY e1.`平均工资` DESC; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 -SELECT e.job_id,d.department_name,MIN(e.salary) FROM jobs j INNER JOIN employees e ON j.job_id=e.job_id INNER JOIN departments d on d.department_id=e.department_id GROUP BY e.job_id,d.department_name; - - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -SELECT last_name,salary from employees WHERE department_id= -(SELECT department_id FROM employees WHERE last_name='兹洛特基') AND last_name != '兹洛特基'; - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -SELECT employee_id,last_name,salary FROM employees WHERE salary>( -SELECT AVG(salary) FROM employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary -SELECT last_name,job_id,salary FROM employees WHERE salary>( -SELECT MAX(salary) from employees WHERE job_id='SA_MAN'); - -#4.查询和姓名中包含 尔 的员工在相同部门的员工的员工号和姓名 -SELECT employee_id,last_name from employees WHERE department_id IN( -SELECT DISTINCT department_id FROM employees WHERE last_name LIKE '%尔%') AND last_name NOT LIKE '%尔%'; - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -SELECT e.employee_id FROM employees e INNER JOIN departments d ON e.department_id=d.department_id where d.location_id=1700; - -#6.查询管理者是 金 的员工姓名和工资 -SELECT e1.last_name,e1.salary FROM employees e1 INNER JOIN employees e2 on e1.manager_id=e2.employee_id where e2.last_name='金'; - -#7.查询工资最低的员工信息: last_name, salary -SELECT last_name,salary FROM employees WHERE salary=( -SELECT MIN(salary) FROM employees); -#8.查询平均工资最低的部门信息 -SELECT * FROM departments d INNER JOIN -(SELECT department_id,AVG(salary) as a FROM employees WHERE department_id IS NOT NULL GROUP BY department_id) e ON d.department_id=e.department_id where e.a=( -SELECT MIN(e.a) FROM departments d INNER JOIN -(SELECT department_id,AVG(salary) as a FROM employees WHERE department_id IS NOT NULL GROUP BY department_id) e ON d.department_id=e.department_id); -#方式1 -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -SELECT * FROM departments d INNER JOIN -(SELECT department_id,AVG(salary) as a FROM employees WHERE department_id IS NOT NULL GROUP BY department_id) e ON d.department_id=e.department_id where e.a=( -SELECT MIN(e.a) FROM departments d INNER JOIN -(SELECT department_id,AVG(salary) as a FROM employees WHERE department_id IS NOT NULL GROUP BY department_id) e ON d.department_id=e.department_id); - -#10.查询平均工资最高的 job 信息 -SELECT job_id,AVG(salary) a1 FROM employees GROUP BY job_id HAVING a1= -(SELECT max(e.a) FROM( -SELECT job_id,AVG(salary) a FROM employees GROUP BY job_id) as e); - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - - -#11.查询平均工资高于公司平均工资的部门有哪些? -SELECT department_id,AVG(salary) a FROM employees GROUP BY department_id HAVING a>( -(SELECT AVG(salary) FROM employees)); - -#12.查询出公司中所有 manager 的详细信息 -SELECT * FROM employees WHERE employee_id in ( -SELECT manager_id FROM employees); -#方式1:自连接 自己连自己 - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? -#方式: -SELECT MIN(salary) FROM employees WHERE department_id=( -SELECT department_id FROM employees GROUP BY department_id HAVING MAX(salary)=( -SELECT MIN(a.m) FROM (SELECT department_id,MAX(salary) m FROM employees GROUP BY department_id ) a)); - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -SELECT last_name,department_id,email,salary FROM employees WHERE department_id=( -SELECT department_id from employees GROUP BY department_id ORDER BY AVG(salary) LIMIT 1); - -#15. 查询部门的部门号,其中不包括job_id是" ST_CLERK "的部门号 -#方式1: - -SELECT DISTINCT department_id FROM employees WHERE job_id != 'ST_CLERK' - -#16. 选择所有没有管理者的员工的last_name -SELECT last_name FROM employees WHERE manager_id IS NULL; -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 金 -SELECT employee_id,last_name,hire_date,salary FROM employees WHERE manager_id in( -SELECT employee_id FROM employees WHERE last_name='金'); - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) -SELECT - e1.employee_id,e1.last_name,e1.salary,e2.a -FROM - employees e1 - INNER JOIN ( SELECT department_id, AVG( salary ) a FROM employees GROUP BY department_id ) e2 - ON e1.department_id=e2.department_id HAVING e1.salary>e2.a; - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -SELECT d.department_name FROM departments d INNER JOIN ( -SELECT department_id,COUNT(department_id) FROM employees GROUP BY department_id HAVING COUNT(department_id)>5) d2 on d.department_id=d2.department_id; -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -SELECT country_id FROM locations l INNER JOIN departments d on l.location_id=d.location_id GROUP BY country_id HAVING COUNT(department_id)>2; -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` \ No newline at end of file diff --git "a/41 \345\221\250\344\272\232\350\276\211/20230921squ,sku.md" "b/41 \345\221\250\344\272\232\350\276\211/20230921squ,sku.md" deleted file mode 100644 index 7ccbf0fcf61b61910e6ee8e47fad2b05c09c9b19..0000000000000000000000000000000000000000 --- "a/41 \345\221\250\344\272\232\350\276\211/20230921squ,sku.md" +++ /dev/null @@ -1,115 +0,0 @@ -# 笔记 - -1.SPU 全称 Standard Product Unit,是标准产品单位。SPU 描述一个产品的各种特性。 - -SKU 全称 Stock Keeping Unit ,库存进出计量的单位 - -所有属性为 一种规格,通过规格定位价格还有库存。 - -# 建库建表 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : kjin - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : taob - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 21/09/2023 11:19:29 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for model --- ---------------------------- -DROP TABLE IF EXISTS `model`; -CREATE TABLE `model` ( - `sku_id` int NOT NULL AUTO_INCREMENT, - `m_name` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`sku_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of model --- ---------------------------- -INSERT INTO `model` VALUES (1, '华为matex5'); - --- ---------------------------- --- Table structure for price --- ---------------------------- -DROP TABLE IF EXISTS `price`; -CREATE TABLE `price` ( - `p_id` int NOT NULL AUTO_INCREMENT, - `pr_id` int NULL DEFAULT NULL, - `p_pr` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`p_id`) USING BTREE, - INDEX `FK_Relationship_3`(`pr_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`pr_id`) REFERENCES `property` (`pr_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of price --- ---------------------------- -INSERT INTO `price` VALUES (1, 1, '16+1t'); -INSERT INTO `price` VALUES (2, 2, '白色'); - --- ---------------------------- --- Table structure for property --- ---------------------------- -DROP TABLE IF EXISTS `property`; -CREATE TABLE `property` ( - `pr_id` int NOT NULL AUTO_INCREMENT, - `sp_id` int NULL DEFAULT NULL, - `pr_name` varchar(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`pr_id`) USING BTREE, - INDEX `FK_Relationship_2`(`sp_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`sp_id`) REFERENCES `specification` (`sp_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of property --- ---------------------------- -INSERT INTO `property` VALUES (1, 1, '内存'); -INSERT INTO `property` VALUES (2, 1, '颜色'); - --- ---------------------------- --- Table structure for specification --- ---------------------------- -DROP TABLE IF EXISTS `specification`; -CREATE TABLE `specification` ( - `sp_id` int NOT NULL AUTO_INCREMENT, - `sku_id` int NULL DEFAULT NULL, - `sp_price` decimal(9, 2) NULL DEFAULT NULL, - `inventory` int NULL DEFAULT NULL, - PRIMARY KEY (`sp_id`) USING BTREE, - INDEX `FK_price`(`sku_id` ASC) USING BTREE, - CONSTRAINT `FK_price` FOREIGN KEY (`sku_id`) REFERENCES `model` (`sku_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of specification --- ---------------------------- -INSERT INTO `specification` VALUES (1, 1, 1999.00, 10); - -SET FOREIGN_KEY_CHECKS = 1; - -``` - -# 查询 - -```mysql -SELECT * FROM model,specification,price,property -WHERE model.sku_id=specification.sku_id -and specification.sp_id=property.sp_id -and property.pr_id=price.pr_id -``` - diff --git "a/41 \345\221\250\344\272\232\350\276\211/20230921\346\235\203\351\231\220.md" "b/41 \345\221\250\344\272\232\350\276\211/20230921\346\235\203\351\231\220.md" deleted file mode 100644 index 87a6ca544f1b121f16da9ccd7127c70f64d4a0bf..0000000000000000000000000000000000000000 --- "a/41 \345\221\250\344\272\232\350\276\211/20230921\346\235\203\351\231\220.md" +++ /dev/null @@ -1,142 +0,0 @@ -## 作业 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : dsa - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : ren - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 19/09/2023 17:27:01 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for menu --- ---------------------------- -DROP TABLE IF EXISTS `menu`; -CREATE TABLE `menu` ( - `menu_id` int NOT NULL AUTO_INCREMENT, - `menu_name1` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`menu_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 104 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of menu --- ---------------------------- -INSERT INTO `menu` VALUES (100, '出场臭鸡蛋特效'); -INSERT INTO `menu` VALUES (101, '出场五个舍友抬轿子特效'); -INSERT INTO `menu` VALUES (102, '出场御龙传说特效'); -INSERT INTO `menu` VALUES (103, '出场三星瑞兹召唤10个窈窕淑女特效'); - --- ---------------------------- --- Table structure for role --- ---------------------------- -DROP TABLE IF EXISTS `role`; -CREATE TABLE `role` ( - `role_id` int NOT NULL AUTO_INCREMENT, - `role_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `role_tel` char(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`role_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 41 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role --- ---------------------------- -INSERT INTO `role` VALUES (10, '渣渣辉', '12345679811'); -INSERT INTO `role` VALUES (20, '贫民玩家', '12345679812'); -INSERT INTO `role` VALUES (30, '氪金大大佬', '12345679813'); -INSERT INTO `role` VALUES (40, '科技不要脸玩家', '12345679814'); - --- ---------------------------- --- Table structure for role_menu --- ---------------------------- -DROP TABLE IF EXISTS `role_menu`; -CREATE TABLE `role_menu` ( - `rm_id` int NOT NULL AUTO_INCREMENT, - `role_id` int NULL DEFAULT NULL, - `menu_id` int NULL DEFAULT NULL, - PRIMARY KEY (`rm_id`) USING BTREE, - INDEX `role_id`(`role_id` ASC) USING BTREE, - INDEX `menu_id`(`menu_id` ASC) USING BTREE, - CONSTRAINT `role_menu_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `role_menu_ibfk_2` FOREIGN KEY (`menu_id`) REFERENCES `menu` (`menu_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 51 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role_menu --- ---------------------------- -INSERT INTO `role_menu` VALUES (1, 10, 100); -INSERT INTO `role_menu` VALUES (2, 20, 100); -INSERT INTO `role_menu` VALUES (3, 20, 101); -INSERT INTO `role_menu` VALUES (4, 30, 100); -INSERT INTO `role_menu` VALUES (5, 30, 101); -INSERT INTO `role_menu` VALUES (6, 30, 102); -INSERT INTO `role_menu` VALUES (7, 40, 100); -INSERT INTO `role_menu` VALUES (8, 40, 101); -INSERT INTO `role_menu` VALUES (9, 40, 102); -INSERT INTO `role_menu` VALUES (10, 40, 103); - --- ---------------------------- --- Table structure for user --- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `user_id` int NOT NULL AUTO_INCREMENT, - `user_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `user_tel` char(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`user_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '凯撒大帝', '12346578911'); -INSERT INTO `user` VALUES (2, '凯尔大帝', '12346578912'); -INSERT INTO `user` VALUES (3, '凯皇大帝', '12346578913'); -INSERT INTO `user` VALUES (4, '普洱大帝', '12346578914'); -INSERT INTO `user` VALUES (5, '盖伦大帝', '12346578915'); -INSERT INTO `user` VALUES (6, '刀妹大帝', '12346578916'); -INSERT INTO `user` VALUES (7, '旭旭大帝', '12346578917'); -INSERT INTO `user` VALUES (8, '丘丘大帝', '12346578918'); -INSERT INTO `user` VALUES (9, '宝宝大帝', '12346578919'); - --- ---------------------------- --- Table structure for user_role --- ---------------------------- -DROP TABLE IF EXISTS `user_role`; -CREATE TABLE `user_role` ( - `ur_id` int NOT NULL AUTO_INCREMENT, - `user_id` int NULL DEFAULT NULL, - `role_id` int NULL DEFAULT NULL, - PRIMARY KEY (`ur_id`) USING BTREE, - INDEX `user_id`(`user_id` ASC) USING BTREE, - INDEX `role_id`(`role_id` ASC) USING BTREE, - CONSTRAINT `user_role_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `user_role_ibfk_2` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user_role --- ---------------------------- -INSERT INTO `user_role` VALUES (1, 1, 10); -INSERT INTO `user_role` VALUES (2, 2, 20); -INSERT INTO `user_role` VALUES (3, 3, 30); -INSERT INTO `user_role` VALUES (4, 4, 40); -INSERT INTO `user_role` VALUES (5, 5, 10); -INSERT INTO `user_role` VALUES (6, 6, 20); -INSERT INTO `user_role` VALUES (7, 7, 30); -INSERT INTO `user_role` VALUES (8, 8, 40); -INSERT INTO `user_role` VALUES (9, 9, 10); - -SET FOREIGN_KEY_CHECKS = 1; -``` \ No newline at end of file diff --git "a/41 \345\221\250\344\272\232\350\276\211/20230924\350\257\276\345\240\202\347\273\203\344\271\240.md" "b/41 \345\221\250\344\272\232\350\276\211/20230924\350\257\276\345\240\202\347\273\203\344\271\240.md" deleted file mode 100644 index 5ee6bc85359727eefd4d0583119807892333b983..0000000000000000000000000000000000000000 --- "a/41 \345\221\250\344\272\232\350\276\211/20230924\350\257\276\345\240\202\347\273\203\344\271\240.md" +++ /dev/null @@ -1,188 +0,0 @@ -# 笔记 - -自连接就是两张表结构和数据内容完全一样的表,在做数据处理的时候,我们通常会给它们分别重命名来加以区分(不重命名也不行啊,不然数据库也不认识它们谁是谁),然后进行关联。 - -# 数据库 - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : kjijn - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : nevada - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 22/09/2023 16:22:04 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for commodity --- ---------------------------- -DROP TABLE IF EXISTS `commodity`; -CREATE TABLE `commodity` ( - `com_id` int NOT NULL AUTO_INCREMENT, - `com_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`com_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 47 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of commodity --- ---------------------------- -INSERT INTO `commodity` VALUES (1, '七彩虹3090ti 16g樱花粉'); -INSERT INTO `commodity` VALUES (2, '微星4060ti 12g纯白'); -INSERT INTO `commodity` VALUES (3, '盈通4070 16g花嫁'); -INSERT INTO `commodity` VALUES (4, '技嘉4090 24g纯白'); -INSERT INTO `commodity` VALUES (5, '黄伟达9090ti 36g花嫁'); - --- ---------------------------- --- Table structure for intermediate --- ---------------------------- -DROP TABLE IF EXISTS `intermediate`; -CREATE TABLE `intermediate` ( - `sp_id` int NULL DEFAULT NULL, - `pp_id` int NULL DEFAULT NULL, - `va_id` int NULL DEFAULT NULL, - INDEX `FK_Relationship_2`(`sp_id` ASC) USING BTREE, - INDEX `FK_Relationship_3`(`pp_id` ASC) USING BTREE, - INDEX `FK_Relationship_4`(`va_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`sp_id`) REFERENCES `specification` (`sp_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`pp_id`) REFERENCES `property` (`pp_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`va_id`) REFERENCES `value` (`va_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of intermediate --- ---------------------------- -INSERT INTO `intermediate` VALUES (1, 1, 1); -INSERT INTO `intermediate` VALUES (1, 2, 5); -INSERT INTO `intermediate` VALUES (2, 1, 2); -INSERT INTO `intermediate` VALUES (2, 2, 6); -INSERT INTO `intermediate` VALUES (3, 1, 1); -INSERT INTO `intermediate` VALUES (3, 2, 7); -INSERT INTO `intermediate` VALUES (4, 1, 3); -INSERT INTO `intermediate` VALUES (4, 2, 6); -INSERT INTO `intermediate` VALUES (5, 1, 4); -INSERT INTO `intermediate` VALUES (5, 2, 7); - --- ---------------------------- --- Table structure for property --- ---------------------------- -DROP TABLE IF EXISTS `property`; -CREATE TABLE `property` ( - `pp_id` int NOT NULL AUTO_INCREMENT, - `pp_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`pp_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of property --- ---------------------------- -INSERT INTO `property` VALUES (1, '显存'); -INSERT INTO `property` VALUES (2, '样式'); - --- ---------------------------- --- Table structure for specification --- ---------------------------- -DROP TABLE IF EXISTS `specification`; -CREATE TABLE `specification` ( - `sp_id` int NOT NULL AUTO_INCREMENT, - `com_id` int NULL DEFAULT NULL, - `price` int NULL DEFAULT NULL, - `inventory` int NULL DEFAULT NULL, - PRIMARY KEY (`sp_id`) USING BTREE, - INDEX `FK_Relationship_1`(`com_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`com_id`) REFERENCES `commodity` (`com_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of specification --- ---------------------------- -INSERT INTO `specification` VALUES (1, 1, 12000, 200); -INSERT INTO `specification` VALUES (2, 2, 4000, 300); -INSERT INTO `specification` VALUES (3, 3, 6499, 300); -INSERT INTO `specification` VALUES (4, 4, 12999, 300); -INSERT INTO `specification` VALUES (5, 5, 1999, 60); - --- ---------------------------- --- Table structure for value --- ---------------------------- -DROP TABLE IF EXISTS `value`; -CREATE TABLE `value` ( - `va_id` int NOT NULL AUTO_INCREMENT, - `content` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`va_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of value --- ---------------------------- -INSERT INTO `value` VALUES (1, '16g'); -INSERT INTO `value` VALUES (2, '12g'); -INSERT INTO `value` VALUES (3, '24g'); -INSERT INTO `value` VALUES (4, '36g'); -INSERT INTO `value` VALUES (5, '樱花粉'); -INSERT INTO `value` VALUES (6, '纯白'); -INSERT INTO `value` VALUES (7, '花嫁'); - -SET FOREIGN_KEY_CHECKS = 1; -``` - -# 查询 - -```mysql -SELECT i.com_name,i.price,i.inventory,i.content '显存',j.content '样式' from -( SELECT - a.com_name, - b.price, - b.inventory, - d.pp_name, - e.content - FROM - commodity a, - specification b, - intermediate c, - property d, - `value` e - WHERE - a.com_id = b.com_id - AND b.sp_id = c.sp_id - AND c.pp_id = d.pp_id - AND c.va_id = e.va_id - and pp_name='显存' - ORDER BY com_name - ) i, - ( - SELECT - a.com_name, - b.price, - b.inventory, - d.pp_name, - e.content - FROM - commodity a, - specification b, - intermediate c, - property d, - `value` e - WHERE - a.com_id = b.com_id - AND b.sp_id = c.sp_id - AND c.pp_id = d.pp_id - AND c.va_id = e.va_id - and pp_name='样式' - ORDER BY com_name - ) j -WHERE - i.com_name = j.com_name - AND i.content = '12g' - AND j.content = '纯白'; -``` \ No newline at end of file diff --git "a/41 \345\221\250\344\272\232\350\276\211/20230926\350\247\206\345\233\276.md" "b/41 \345\221\250\344\272\232\350\276\211/20230926\350\247\206\345\233\276.md" deleted file mode 100644 index b0c740133fe655e6509da02200a5718d76e3dad4..0000000000000000000000000000000000000000 --- "a/41 \345\221\250\344\272\232\350\276\211/20230926\350\247\206\345\233\276.md" +++ /dev/null @@ -1,305 +0,0 @@ -## 笔记 - -``` mysql -创建视图 -create view 视图名称(字段,字段...) as 查询语句 ---字段必须一一对应。 -修改视图 -create or replace view 视图名称 as 查询语句 ---视图存在就更新,不存在就新增。 -alter 视图名称 as 查询语句 ---视图必须存在,不然报错。 -``` - -## 作业 - -``` mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - - - -#第14章_视图的课后练习 -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE VIEW employee_vu AS SELECT -LAST_NAME 姓名, -EMPLOYEE_ID 员工号, -DEPARTMENT_ID 部门号 -FROM - employees; -#2. 显示视图的结构 -desc employee_vu; -#3. 查询视图中的全部内容 -SELECT * from employee_vu; -#4. 将视图中的数据限定在部门号是80的范围内 -SELECT * from employee_vu where 部门号<80; -#练习2: -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -CREATE VIEW emp_v1 AS SELECT -LAST_NAME 姓名, -salary 工资, -email 邮箱 -FROM - employees -WHERE - phone_number LIKE '011%'; -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -CREATE - OR REPLACE VIEW emp_v1 AS SELECT - LAST_NAME 姓名, - salary 工资, - email 邮箱, - phone_number 电话号码 -FROM - employees -WHERE - phone_number LIKE '011%' - AND email LIKE '%e%'; -#3. 向 emp_v1 插入一条记录,是否可以? -否 -#4. 修改emp_v1中员工的工资,每人涨薪1000 -update emp_v1 set 工资=工资+1000; -#5. 删除emp_v1中姓名为Olsen的员工 -delete emp_v1 where 姓名=olsen; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create view emp_v2 as -SELECT -department_id 部门编号, -max(salary) 最高工资 -FROM - employees - where salary>12000 - group by 部门编号; -#7. 向 emp_v2 中插入一条记录,是否可以? -否 -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v1,emp_v2; -``` - diff --git "a/41 \345\221\250\344\272\232\350\276\211/\345\274\200\345\255\246\347\254\254\344\270\200\350\257\276\345\277\203\345\276\227.md" "b/41 \345\221\250\344\272\232\350\276\211/\345\274\200\345\255\246\347\254\254\344\270\200\350\257\276\345\277\203\345\276\227.md" deleted file mode 100644 index 8ac961567469370b5afa262b557c335938018e35..0000000000000000000000000000000000000000 --- "a/41 \345\221\250\344\272\232\350\276\211/\345\274\200\345\255\246\347\254\254\344\270\200\350\257\276\345\277\203\345\276\227.md" +++ /dev/null @@ -1,7 +0,0 @@ -新学期新气象。 - -好好学习,天天向上。 - -做好学习规划,网络资源利用,不局限于课堂。 - -学习新思想,争做新青年。 \ No newline at end of file diff --git "a/41 \345\221\250\344\272\232\350\276\211/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" "b/41 \345\221\250\344\272\232\350\276\211/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" deleted file mode 100644 index 5d5ec70e3c81fb96e9253b82a44e6bf99e0ac793..0000000000000000000000000000000000000000 --- "a/41 \345\221\250\344\272\232\350\276\211/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" +++ /dev/null @@ -1,134 +0,0 @@ -## 笔记 - -### 表与表之间的关系(和关联方法): - -1.一对一 1-1 - -2.一对多 1-n - -一对一和一对多的关联:都是将一所在表的主键放在另一张表里当外键。 - -3.多对多 n-m - -多对多的关联:引入第三张表,前两张表的主键放入表中做外键。 - -### E-R图设计 - -方块 实体 - -菱形 关系 - -椭圆 属性 - -## 练习 - -```mysql -院系,专业,学生,教师,课程,教室等图表设计 -create database school charset utf8; - -use school; - --- 院系表 -create table department( - d_id int primary key, - d_name varchar(10), - d_address varchar(10) -); -insert into department values -(110,'软件工程学院','望云楼'), -(120,'信息工程学院','辛耕楼'), -(119,'建筑工程学院','万源楼'); - --- 专业表 -create table speciality( - s_id int primary key, - s_name varchar(10), - d_id int, - foreign key (d_id) references department(d_id) -); -insert into speciality values -(11,'软件技术与开发',110), -(22,'信息技术',120), -(33,'建筑设计',119); - --- 教室表 -create table classroom( -r_id int PRIMARY KEY, -r_name varchar(10) -); -insert into classroom values -(1,'实训一'), -(2,'实训二'), -(3,'实训三'); - --- 班级表 -create table class( - c_id int primary key, - c_name varchar(10), - s_id int, - foreign key (s_id) references speciality(s_id) -); -insert into class values -(1,'软件技术1班',11), -(2,'软件技术2班',11), -(3,'软件技术3班',11); - --- 课程表 -CREATE TABLE course( - couseId int PRIMARY key, - courseName varchar(10), - c_id int, - r_id int, - foreign key (c_id) references class(c_id), - foreign key (r_id) references classroom(r_id) -); -insert into course VALUES -(1,'java',1,2), -(2,'html',2,3), -(3,'mysql',3,1); - --- 教师表 -create table teacher( - t_id int primary key, - t_name varchar(10), - couseId int, - foreign key (couseId) references course(couseId) -); -insert into teacher values -(1,'张三',1), -(2,'张四',2), -(3,'张五',3); - --- 选修表 -create table `select` ( - selectId int primary key, - couseId int, - time varchar(20), - t_id int, - r_id int, - foreign key (couseId) references course(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references classroom(r_id) -); -insert into `select` values -(1,1,'周一上午',2,3), -(2,2,'周二下午',1,2), -(3,3,'周三上午',3,1); - --- 学生表 -create table student ( - id int primary key, - name varchar(10), - sex varchar(5), - age int, - address varchar(20), - c_id int, - selectId int, - foreign key (c_id) references class(c_id), - foreign key (selectId) references `select`(selectId) -); -insert into student values -(11111,'小明','男',18,'团结里1',1,1), -(22222,'小花','女',118,'团结里2',2,2), -(33333,'小王','男',1118,'团结里3',3,3); -``` \ No newline at end of file diff --git "a/42 \346\226\271\345\242\236\345\205\264/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/42 \346\226\271\345\242\236\345\205\264/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index 21c4917853f0f485c825bc27ac715c8fe514dec5..0000000000000000000000000000000000000000 --- "a/42 \346\226\271\345\242\236\345\205\264/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,52 +0,0 @@ -# 图书管理系统 - -```mysql -create database book_admin; -use book_admin; -CREATE TABLE `admin` ( - `admin_id` int NOT NULL AUTO_INCREMENT, - `admin_name` char(5) DEFAULT NULL, - PRIMARY KEY (`admin_id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3; - -CREATE TABLE `admin_to_book_type` ( - `book_type_id` int NOT NULL AUTO_INCREMENT, - `type_name` varchar(10) DEFAULT NULL, - `admin_id` int DEFAULT NULL, - PRIMARY KEY (`book_type_id`), - KEY `admin_id` (`admin_id`), - CONSTRAINT `admin_to_book_type_ibfk_1` FOREIGN KEY (`admin_id`) REFERENCES `admin` (`admin_id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3; - -CREATE TABLE `author_info` ( - `author_id` int NOT NULL AUTO_INCREMENT, - `author_name` varchar(10) DEFAULT NULL, - `author_age` char(5) DEFAULT NULL, - `author_address` varchar(10) DEFAULT NULL, - `book_id` int DEFAULT NULL, - PRIMARY KEY (`author_id`), - KEY `book_id` (`book_id`), - CONSTRAINT `author_info_ibfk_1` FOREIGN KEY (`book_id`) REFERENCES `book_info` (`book_id`) -) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3; - -CREATE TABLE `book_info` ( - `book_id` int NOT NULL AUTO_INCREMENT, - `book_name` varchar(10) DEFAULT NULL, - `book_number` varchar(10) DEFAULT NULL, - `book_status` char(2) DEFAULT NULL, - `book_type_id` int DEFAULT NULL, - PRIMARY KEY (`book_id`), - KEY `book_type_id` (`book_type_id`), - CONSTRAINT `book_info_ibfk_1` FOREIGN KEY (`book_type_id`) REFERENCES `admin_to_book_type` (`book_type_id`) -) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb3; - - - -SELECT admin.admin_id, admin.admin_name, admin_to_book_type.book_type_id, admin_to_book_type.type_name, book_info.book_id, book_info.book_name, book_info.book_number, book_info.book_status, author_info.author_id, author_info.author_name, author_info.author_age, author_info.author_address -FROM admin -LEFT JOIN admin_to_book_type ON admin.admin_id = admin_to_book_type.admin_id -LEFT JOIN book_info ON admin_to_book_type.book_type_id = book_info.book_type_id -LEFT JOIN author_info ON book_info.book_id = author_info.book_id; -``` - -![image-20230910233634407](https://gitee.com/fang-zengxing/database-advanced/raw/master/image-20230910233634407.png) \ No newline at end of file diff --git "a/42 \346\226\271\345\242\236\345\205\264/\346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" "b/42 \346\226\271\345\242\236\345\205\264/\346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" deleted file mode 100644 index 8522d1de754ad4c1d15781b8f0d925e2df54bfce..0000000000000000000000000000000000000000 --- "a/42 \346\226\271\345\242\236\345\205\264/\346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" +++ /dev/null @@ -1,8 +0,0 @@ -# 数据库范式 - -```mysql -范式1:要求字段的内容,不可在分割,位的是保证数据的原子性 -范式2:要求满足第一范式的基础上,要求非主键字段要求完全依赖主键(非主键,要依赖整个联合主键),而不能只依赖部分 -范式3:满足一、二范式的前提下,要求非主键属要直接依赖主键 -``` - diff --git "a/42 \346\226\271\345\242\236\345\205\264/\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\200\350\257\276\347\254\224\350\256\260.md" "b/42 \346\226\271\345\242\236\345\205\264/\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\200\350\257\276\347\254\224\350\256\260.md" deleted file mode 100644 index 9b06e10d197b43bcae2a8e90965bbcbcf9310ebc..0000000000000000000000000000000000000000 --- "a/42 \346\226\271\345\242\236\345\205\264/\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\200\350\257\276\347\254\224\350\256\260.md" +++ /dev/null @@ -1,11 +0,0 @@ -# 开学第一课笔记 - -```mysql -大二学习计划: -1、做好学习规划 -2、安排合理的学习时间 -3、做到让效率达到最高 -4、不限于书本知识 -5、自学其他语言和框架 -``` - diff --git "a/42 \346\226\271\345\242\236\345\205\264/\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\272\214\350\257\276\347\254\224\350\256\260.md" "b/42 \346\226\271\345\242\236\345\205\264/\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\272\214\350\257\276\347\254\224\350\256\260.md" deleted file mode 100644 index 903b846f611641fbe1d71a47fb8b7840dad03eac..0000000000000000000000000000000000000000 --- "a/42 \346\226\271\345\242\236\345\205\264/\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\272\214\350\257\276\347\254\224\350\256\260.md" +++ /dev/null @@ -1,100 +0,0 @@ -# 数据库高级第二课笔记 - -```mysql -1、一对多:是最基础的表间关系,意思是一张表A中的一条记录可以对应另一张表B中的多条记录,另一张表B中的一条记录只能对应一张表A中的一条记录 -2、一对多:在多的那一端设置外键 -3、多对多:引入第三张表,将两个主键放进来当外键 -E-R图组成:实体,关系,属性 - - -总结 -在写sql语句中最重要的就是找表之间的关系,只有搞清楚各种表之间的联系,才不容易出错; - -这两句口诀再强调一下: - -一对多,两张表,多的表加外键 - -多对多,三张表,关系表加外键 - - - - - - - -use blog; -# ----------------------------------------院系表---------------------------- - -create table faculty( - id int primary key auto_increment, - faculty_name char(20) -); -# ----------------------------------------专业表---------------------------- - -create table specialty( - id int primary key auto_increment, - specialty_name char(20), - specialty_id int, - foreign key (specialty_id) references faculty (id), - foreign key (specialty_id) references student_info (studentId) -); - -# ----------------------------------------学生表---------------------------- - -# 1、-------------------将专业表的specialty_id和班级表的class_room_id进行连接(一对多)--- -# 2、-------------------将专业表的faculty_id和院系表的id进行连接(一对多)--------------- - -create table class_room( - id int primary key auto_increment , - class_room_name char(20), - class_room_id int, - zhuanye_id int, - foreign key (class_room_id) references specialty (specialty_id), - foreign key (zhuanye_id) references specialty (specialty_id) -); - - - -create table student_info( - studentId int primary key auto_increment , - student_name char(20) -); - -# -------------------------------------学生表和课程表的中间表--------------------- -create table StudentToCourse( - id int primary key auto_increment , - student_id int, - foreign key(student_id) references student_info(studentId), - course_id int, - foreign key(course_id) references course(courseId) -); - -# ----------------------------------------课程表---------------------------- -create table course( - courseId int primary key auto_increment , - course_name char (20), - foreign key (courseId) references teacher (id) -); - - -# ----------------------------------------课程表表---------------------------- -create table class_schedule( - id int primary key, - week_day char (20), - which_lesson char (20) -) - - -# ----------------------------------------教师表---------------------------- -create table teacher( - id int primary key auto_increment , - teacher_name char(10) -) - -# select * from faculty f right join specialty s on f.id = s.specialty_id order by specialty_id; - -select * from -(SELECT f.faculty_name,f.id,s.specialty_name,s.specialty_id,s.zhuanye_id FROM faculty f RIGHT JOIN specialty s ON f.id = s.zhuanye_id) -as a right join class_room cr on a.zhuanye_id = cr.zhuanye_id -``` - diff --git "a/43 \351\237\251\346\226\207\346\235\260/NB.sql" "b/43 \351\237\251\346\226\207\346\235\260/NB.sql" deleted file mode 100644 index 760f8f8faff755f263325ce3da1a119739430030..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/NB.sql" +++ /dev/null @@ -1,215 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 14:40:40 */ -/*==============================================================*/ - -drop table if exists Employee; - -drop table if exists Library; - -drop table if exists "appointment records"; - -drop table if exists author; - -drop table if exists "book copy"; - -drop table if exists books; - -drop table if exists "books category"; - -drop table if exists "borrow records"; - -drop table if exists borrower; - -drop table if exists "fine records"; - -drop table if exists publisher; - -drop table if exists valuation; - -/*==============================================================*/ -/* Table: Employee */ -/*==============================================================*/ -create table Employee -( - em_id int not null auto_increment, - li_id int not null, - em_name char(5) not null, - em_posts char(5) not null, - primary key (em_id) -); - -/*==============================================================*/ -/* Table: Library */ -/*==============================================================*/ -create table Library -( - li_id int not null auto_increment, - li_name char(10) not null, - li_address varchar(50) not null, - primary key (li_id) -); - -/*==============================================================*/ -/* Table: "appointment records" */ -/*==============================================================*/ -create table "appointment records" -( - re_id int not null auto_increment, - borr_id int not null, - re_time date not null, - re_state char(2) not null, - primary key (re_id) -); - -/*==============================================================*/ -/* Table: author */ -/*==============================================================*/ -create table author -( - au_id int not null auto_increment, - au_name char(5) not null, - au_nationality char(5) not null, - au_sex char(1) not null, - au_tel numeric(11,0) not null, - primary key (au_id) -); - -/*==============================================================*/ -/* Table: "book copy" */ -/*==============================================================*/ -create table "book copy" -( - copy_id int not null auto_increment, - li_id int not null, - copy_state char(2) not null, - primary key (copy_id) -); - -/*==============================================================*/ -/* Table: books */ -/*==============================================================*/ -create table books -( - book_id int not null auto_increment, - li_id int not null, - copy_id int not null, - cate_id int not null, - au_id int not null, - pu_id int not null, - borr_id int not null, - book_address varchar(50) not null, - book_name char(10) not null, - book_date date not null, - primary key (book_id) -); - -/*==============================================================*/ -/* Table: "books category" */ -/*==============================================================*/ -create table "books category" -( - cate_id int not null auto_increment, - cate_name char(10) not null, - primary key (cate_id) -); - -/*==============================================================*/ -/* Table: "borrow records" */ -/*==============================================================*/ -create table "borrow records" -( - bo_id int not null auto_increment, - bo_date date not null, - bo_return date not null, - primary key (bo_id) -); - -/*==============================================================*/ -/* Table: borrower */ -/*==============================================================*/ -create table borrower -( - borr_id int not null auto_increment, - bo_id int not null, - borr_name varchar(20) not null, - borr_sex char(1) not null, - borr_tel numeric(11,0) not null, - primary key (borr_id) -); - -/*==============================================================*/ -/* Table: "fine records" */ -/*==============================================================*/ -create table "fine records" -( - fine_id int not null auto_increment, - borr_id int not null, - fine_number numeric(10,0) not null, - fine_date date not null, - primary key (fine_id) -); - -/*==============================================================*/ -/* Table: publisher */ -/*==============================================================*/ -create table publisher -( - pu_id int not null auto_increment, - pu_name char(10) not null, - pu_address varchar(50) not null, - primary key (pu_id) -); - -/*==============================================================*/ -/* Table: valuation */ -/*==============================================================*/ -create table valuation -( - va_id int not null auto_increment, - book_id int not null, - borr_id int not null, - va_score decimal(2,1) not null, - va_content varchar(50) not null, - primary key (va_id) -); - -alter table Employee add constraint FK_yuangong foreign key (li_id) - references Library (li_id) on delete restrict on update restrict; - -alter table "appointment records" add constraint FK_lul foreign key (borr_id) - references borrower (borr_id) on delete restrict on update restrict; - -alter table "book copy" add constraint FK_shu foreign key (li_id) - references Library (li_id) on delete restrict on update restrict; - -alter table books add constraint FK_cangshu foreign key (li_id) - references Library (li_id) on delete restrict on update restrict; - -alter table books add constraint FK_chu foreign key (au_id) - references author (au_id) on delete restrict on update restrict; - -alter table books add constraint FK_fuben foreign key (copy_id) - references "book copy" (copy_id) on delete restrict on update restrict; - -alter table books add constraint FK_guanci foreign key (cate_id) - references "books category" (cate_id) on delete restrict on update restrict; - -alter table books add constraint FK_jie foreign key (borr_id) - references borrower (borr_id) on delete restrict on update restrict; - -alter table books add constraint FK_zuo foreign key (pu_id) - references publisher (pu_id) on delete restrict on update restrict; - -alter table borrower add constraint FK_jilu foreign key (bo_id) - references "borrow records" (bo_id) on delete restrict on update restrict; - -alter table "fine records" add constraint FK_fa foreign key (borr_id) - references borrower (borr_id) on delete restrict on update restrict; - -alter table valuation add constraint FK_ping foreign key (book_id) - references books (book_id) on delete restrict on update restrict; - -alter table valuation add constraint FK_ren foreign key (borr_id) - references borrower (borr_id) on delete restrict on update restrict; - diff --git "a/43 \351\237\251\346\226\207\346\235\260/RBAC(\347\254\224\350\256\260).md" "b/43 \351\237\251\346\226\207\346\235\260/RBAC(\347\254\224\350\256\260).md" deleted file mode 100644 index 11d1d55fd1c8905217572b2c2458506e729ac59b..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/RBAC(\347\254\224\350\256\260).md" +++ /dev/null @@ -1,93 +0,0 @@ -# RBAC: 基于角色的权限访问控制模型 - -# 权限使用情景 - -~~~mysql -菜单权限,按钮权限,数据权限,操作权限 -~~~ - -# RBAC的核心是 : 角色 - -# 用户 角色 权限 (三者之间的关系是多对多) - -# 练习 - - - -~~~mysql -/*==============================================================*/ /* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:28:54 */ -/*==============================================================*/ -CREATE DATABASE shujuku charset utf8; -USE shujuku; -DROP TABLE -IF - EXISTS power; -DROP TABLE -IF - EXISTS role; -DROP TABLE -IF - EXISTS role_power; -DROP TABLE -IF - EXISTS USER; -DROP TABLE -IF - EXISTS user_role; -/*==============================================================*/ -/* Table: power */ -/*==============================================================*/ -CREATE TABLE power ( - power_id INT NOT NULL auto_increment, - power_name VARCHAR ( 10 ) NOT NULL, - power_url VARCHAR ( 200 ) NOT NULL, - PRIMARY KEY ( power_id ) -); -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -CREATE TABLE role ( role_id INT NOT NULL auto_increment, role_name VARCHAR ( 10 ) NOT NULL, PRIMARY KEY ( role_id ) ); -/*==============================================================*/ -/* Table: role_power */ -/*==============================================================*/ -CREATE TABLE role_power ( power_id INT NOT NULL, role_id INT NOT NULL, PRIMARY KEY ( power_id, role_id ) ); -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -CREATE TABLE USER ( - user_id INT NOT NULL auto_increment, - user_name VARCHAR ( 6 ) NOT NULL, - user_sex CHAR ( 1 ) NOT NULL, - PRIMARY KEY ( user_id ) -); -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -CREATE TABLE user_role ( role_id INT NOT NULL, user_id INT NOT NULL, PRIMARY KEY ( role_id, user_id ) ); -ALTER TABLE role_power ADD CONSTRAINT FK_role_power FOREIGN KEY ( power_id ) REFERENCES power ( power_id ) ON DELETE RESTRICT ON UPDATE RESTRICT; -ALTER TABLE role_power ADD CONSTRAINT FK_role_power2 FOREIGN KEY ( role_id ) REFERENCES role ( role_id ) ON DELETE RESTRICT ON UPDATE RESTRICT; -ALTER TABLE user_role ADD CONSTRAINT FK_user_role FOREIGN KEY ( role_id ) REFERENCES role ( role_id ) ON DELETE RESTRICT ON UPDATE RESTRICT; -ALTER TABLE user_role ADD CONSTRAINT FK_user_role2 FOREIGN KEY ( user_id ) REFERENCES USER ( user_id ) ON DELETE RESTRICT ON UPDATE RESTRICT; - - - -SELECT - user_name 用户名, user_sex 性别, role_name 角色, power_name 权限 -FROM -`user` u,user_role ur,role r,role_power rp,power p -where - u.user_id=ur.user_id -and ur.role_id=r.role_id -and r.role_id=rp.role_id -and rp.power_id=p.power_id - -and u.user_name='奥特之王' and u.user_pwd='110' - - - - - - -~~~ - diff --git "a/43 \351\237\251\346\226\207\346\235\260/mysql\345\244\215\344\271\240\344\275\234\344\270\232.md" "b/43 \351\237\251\346\226\207\346\235\260/mysql\345\244\215\344\271\240\344\275\234\344\270\232.md" deleted file mode 100644 index cf48f796fcb84538299e95eec1a209bc094a74f0..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/mysql\345\244\215\344\271\240\344\275\234\344\270\232.md" +++ /dev/null @@ -1,835 +0,0 @@ -~~~mysql -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ -CREATE database shujukuone charset utf8; -use shujukuone; - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 -SELECT sum(salary12) ,(sum(salary)+sum(commission_pctsalary))*12 奖金 from employees; - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 -SELECT distinct job_id from employees; - - - -# 3.查询工资大于12000的员工姓名和工资 - -SELECT last_name,salary from employees WHERE salary>12000; -# 4.查询员工号为176的员工的姓名和部门号 - -SELECT last_name,department_id from employees WHERE employee_id=176; - - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; SELECT * from departments; - - - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -SELECT last_name,salary from employees WHERE salary not BETWEEN 5000 and 12000; - - - - -# 2.选择在20或50号部门工作的员工姓名和部门号 -SELECT last_name,department_id from employees WHERE department_id in (20,50); - - - -# 3.选择公司中没有管理者的员工姓名及job_id - - -SELECT last_name,job_id from employees WHERE manager_id is null; - - - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - - -SELECT last_name,salary,b.grade_level 奖金等级,commission_pctsalary from employees a LEFT JOIN job_grades b on a.commission_pctsalary BETWEEN b.lowest_sal and b.highest_sal WHERE a.commission_pct is not null ; - - - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - - -SELECT * from employees WHERE last_name like "__尔"; - - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -SELECT * from employees WHERE last_name like "%尔%" and last_name like "%特%"; - - - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -SELECT * from employees WHERE last_name like "%尔"; - - - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -SELECT last_name,job_id from employees WHERE department_id BETWEEN 80 and 100; - - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -SELECT last_name,salary,manager_id from employees where manager_id in (100,101,110); - - - - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -SELECT last_name,department_id, salary*12 年薪 FROM employees ORDER BY 年薪 desc; - - -# - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -SELECT last_name,salary from employees WHERE salary not BETWEEN 8000 and 17000 order by salary desc LIMIT 20,20; - - - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - - -SELECT * from employees WHERE email like "%e%" order by length(email) desc,department_id asc; - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -SELECT a.last_name,a.department_id,b.department_name from employees a LEFT JOIN departments b on a.department_id=b.department_id; - - - -# 2.查询90号部门员工的job_id和90号部门的location_id -SELECT job_id,location_id from employees a LEFT JOIN departments b on a.department_id=b.department_id WHERE a.department_id=90 ; - - - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -SELECT a.last_name,b.department_name,c.location_id,c.city from employees a LEFT JOIN departments b on a.department_id = b.department_id LEFT JOIN locations c on b.location_id = c.location_id WHERE a.commission_pct is not null; - - - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -SELECT a.last_name,a.job_id,b.department_id,b.department_name,city from employees a LEFT JOIN departments b on a.department_id = b.department_id LEFT JOIN locations c on b.location_id = c.location_id WHERE city = "多伦多"; - - - - -#sql92语法(自然连接): - - -SELECT * from employees a , departments b WHERE a.department_id=b.department_id; - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - - -SELECT a.last_name 姓名,b.department_name 部门名称,city 部门地址,salary 工资,d.job_title 工作 from employees a LEFT JOIN departments b on a.department_id = b.department_id LEFT JOIN locations c on b.location_id = c.location_id LEFT JOIN jobs d on a.job_id = d.job_id WHERE b.department_name="行政部" ; - - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - - - - - -# 7.查询哪些部门没有员工 -SELECT * FROM departments d left join employees l on l.department_id=d.department_id WHERE l.last_name is null; - - - -# 8. 查询哪个城市没有部门 - -SELECT * FROM locations l left join departments d on d.location_id = l.location_id WHERE department_name is null; - - - - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -SELECT * from employees a LEFT JOIN departments b on a.department_id = b.department_id where department_name= "销售部" or department_name="信息技术部"; - - - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - -SELECT max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees; - - - #3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - - -SELECT job_id, max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees GROUP BY job_id; - - - -#4.选择各个job_id的员工人数 -SELECT job_id,count(employee_id) 员工人数 from employees GROUP BY job_id; -# 5.查询员工最高工资和最低工资的差距 - -SELECT max(salary)-min(salary) 最高工资和最低工资的差距 from employees; - - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 -SELECT manager_id,min(salary) 最低工资 from employees GROUP BY manager_id HAVING 最低工资>=6000 and manager_id is not null; - - - - - - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 -SELECT b.department_name 部门名称,location_id,count(a.employee_id) 员工数量,avg(a.salary) 平均工资 from departments b LEFT JOIN employees a on a.department_id = b.department_id GROUP BY b.department_name desc,location_id; - - - - - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -SELECT job_title 工种, department_name 部门名,min(salary) from employees a LEFT JOIN departments b on a.department_id = b.department_id LEFT JOIN jobs c on a.job_id=c.job_id GROUP BY job_title,department_name; - - - - - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - - - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - - - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - - - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -SELECT employee_id,last_name -FROM employees - - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - - - - -#6.查询管理者是 金 的员工姓名和工资 - - - - - -#7.查询工资最低的员工信息: last_name, salary - - - - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - - - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - - - - -#11.查询平均工资高于公司平均工资的部门有哪些? - - - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - - - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - - - -#方式: - - - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - - - - - -#16. 选择所有没有管理者的员工的last_name - - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - - -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - - - - - - - - - - - - - - -~~~ - diff --git "a/43 \351\237\251\346\226\207\346\235\260/sku\344\275\234\344\270\232.md" "b/43 \351\237\251\346\226\207\346\235\260/sku\344\275\234\344\270\232.md" deleted file mode 100644 index 0c8b06e82ab96f8f45135f27c05e0266ff834a83..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/sku\344\275\234\344\270\232.md" +++ /dev/null @@ -1,125 +0,0 @@ -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:34:09 */ -/*==============================================================*/ - -create database d charset utf8; -use d; - -drop table if exists attributes; - -drop table if exists attributes_table; - -drop table if exists commodity; - -drop table if exists moddle; - -drop table if exists sku; - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_id int not null auto_increment, - attributes_name varchar(10) not null, - primary key (attributes_id) -); - -/*==============================================================*/ -/* Table: attributes_table */ -/*==============================================================*/ -create table attributes_table -( - value_id int not null auto_increment, - value_text varchar(50) not null, - primary key (value_id) -); - -/*==============================================================*/ -/* Table: commodity */ -/*==============================================================*/ -create table commodity -( - co_id int not null auto_increment, - co_name varchar(20) not null, - co_details text not null, - primary key (co_id) -); - -/*==============================================================*/ -/* Table: moddle */ -/*==============================================================*/ -create table moddle -( - middle int not null auto_increment, - attributes_id int, - sku_id int, - value_id int, - primary key (middle) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - co_id int, - sku_title varchar(50) not null, - primary key (sku_id) -); - -alter table moddle add constraint FK_Relationship_2 foreign key (attributes_id) - references attributes (attributes_id) on delete restrict on update restrict; - -alter table moddle add constraint FK_Relationship_3 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table moddle add constraint FK_Relationship_4 foreign key (value_id) - references attributes_table (value_id) on delete restrict on update restrict; - -alter table sku add constraint FK_Relationship_1 foreign key (co_id) - references commodity (co_id) on delete restrict on update restrict; - - - - -INSERT INTO `attributes` VALUES (1, '颜色'); -INSERT INTO `attributes` VALUES (2, '内存'); -INSERT INTO `attributes_table` VALUES (1, '爱国红色'); -INSERT INTO `attributes_table` VALUES (2, '屎黄色'); -INSERT INTO `attributes_table` VALUES (3, '吊炸天色'); -INSERT INTO `attributes_table` VALUES (4, '1200G+100TB'); -INSERT INTO `attributes_table` VALUES (5, '1288G+100TB'); -INSERT INTO `commodity` VALUES (1, '中国华为牛逼mate600', '夭夭领先全银河'); - - - - -INSERT INTO `sku` VALUES (1, 1, '华为(huawei)旗舰手机牛逼mate600 1200G+100TB 屎黄色'); -INSERT INTO `sku` VALUES (2, 1, '华为(huawei)旗舰手机牛逼mate600 1288G+100TB 屎黄色'); -INSERT INTO `sku` VALUES (3, 1, '华为(huawei)旗舰手机牛逼mate600 1200G+100TB 爱国红色'); -INSERT INTO `sku` VALUES (4, 1, '华为(huawei)旗舰手机牛逼mate600 1288G+100TB 爱国红色'); -INSERT INTO `sku` VALUES (5, 1, '华为(huawei)旗舰手机牛逼mate600 1200G+100TB 吊炸天色'); -INSERT INTO `sku` VALUES (6, 1, '华为(huawei)旗舰手机牛逼mate600 1288G+100TB 吊炸天色'); - -INSERT INTO `moddle` VALUES (1, 1, 1, 2); -INSERT INTO `moddle` VALUES (2, 2, 1, 4); -INSERT INTO `moddle` VALUES (3, 1, 2, 2); -INSERT INTO `moddle` VALUES (4, 2, 2, 5); -INSERT INTO `moddle` VALUES (5, 1, 3, 1); -INSERT INTO `moddle` VALUES (6, 2, 3, 4); -INSERT INTO `moddle` VALUES (7, 1, 4, 1); -INSERT INTO `moddle` VALUES (8, 2, 4, 5); -INSERT INTO `moddle` VALUES (9, 1, 5, 3); -INSERT INTO `moddle` VALUES (10, 2, 5, 4); -INSERT INTO `moddle` VALUES (11, 1, 6, 3); -INSERT INTO `moddle` VALUES (12, 2, 6, 5); - -select -* -from attributese,attributes_table,commodity,moddle,sku -~~~ - diff --git "a/43 \351\237\251\346\226\207\346\235\260/sku\357\274\210\350\207\252\350\277\236\346\216\245\357\274\211.md" "b/43 \351\237\251\346\226\207\346\235\260/sku\357\274\210\350\207\252\350\277\236\346\216\245\357\274\211.md" deleted file mode 100644 index 67599ff13d292fbaf17f4de3e5c5ecda27055a93..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/sku\357\274\210\350\207\252\350\277\236\346\216\245\357\274\211.md" +++ /dev/null @@ -1,82 +0,0 @@ -# 鸿星尔克鞋子 - -~~~mysql - -/*==============================================================*/ /* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-22 08:51:33 */ -/*==============================================================*/ -CREATE DATABASE shujuku charset utf8; -USE shujuku; -DROP TABLE -IF - EXISTS attributes; -DROP TABLE -IF - EXISTS attributes_values; -DROP TABLE -IF - EXISTS commodity; -DROP TABLE -IF - EXISTS middle; -DROP TABLE -IF - EXISTS sku; -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -CREATE TABLE attributes ( attributes_id INT NOT NULL auto_increment, attributes_name VARCHAR ( 20 ) NOT NULL, PRIMARY KEY ( attributes_id ) ); -/*==============================================================*/ -/* Table: attributes_values */ -/*==============================================================*/ -CREATE TABLE attributes_values ( values_id INT NOT NULL auto_increment, values_name VARCHAR ( 20 ) NOT NULL, PRIMARY KEY ( values_id ) ); -/*==============================================================*/ -/* Table: commodity */ -/*==============================================================*/ -CREATE TABLE commodity ( commodity_id INT NOT NULL auto_increment, commodity_name VARCHAR ( 20 ) NOT NULL, commodity_text text NOT NULL, PRIMARY KEY ( commodity_id ) ); -/*==============================================================*/ -/* Table: middle */ -/*==============================================================*/ -CREATE TABLE middle ( middle_id INT NOT NULL auto_increment, attributes_id INT, sku_id INT, values_id INT, PRIMARY KEY ( middle_id ) ); -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -CREATE TABLE sku ( sku_id INT NOT NULL auto_increment, commodity_id INT, sku_title VARCHAR ( 50 ) NOT NULL, PRIMARY KEY ( sku_id ) ); -ALTER TABLE middle ADD CONSTRAINT FK_Relationship_2 FOREIGN KEY ( attributes_id ) REFERENCES attributes ( attributes_id ) ON DELETE RESTRICT ON UPDATE RESTRICT; -ALTER TABLE middle ADD CONSTRAINT FK_Relationship_3 FOREIGN KEY ( sku_id ) REFERENCES sku ( sku_id ) ON DELETE RESTRICT ON UPDATE RESTRICT; -ALTER TABLE middle ADD CONSTRAINT FK_Relationship_4 FOREIGN KEY ( values_id ) REFERENCES attributes_values ( values_id ) ON DELETE RESTRICT ON UPDATE RESTRICT; -ALTER TABLE sku ADD CONSTRAINT FK_Relationship_1 FOREIGN KEY ( commodity_id ) REFERENCES commodity ( commodity_id ) ON DELETE RESTRICT ON UPDATE RESTRICT; -~~~ - -# 鸿星尔克(自连接) - -~~~mysql - - - - -SELECT - * -FROM - commodity c, - sku s, - middle m, - attributes a, - attributes_values av -WHERE - c.commodity_id = s.commodity_id - AND s.sku_id = m.sku_id - AND a.attributes_id = m.attributes_id - AND av.values_id = m.values_id - AND s.sku_id =( - SELECT - a.sku_id - FROM - ( SELECT sku_id FROM middle a, attributes_values b WHERE a.values_id = b.values_id AND values_name = "休闲鞋" ) a, - ( SELECT sku_id FROM middle a, attributes_values b WHERE a.values_id = b.values_id AND values_name = "450码" ) b, - ( SELECT sku_id FROM middle a, attributes_values b WHERE a.values_id = b.values_id AND values_name = "狗屎绿色" ) c - WHERE - a.sku_id = b.sku_id - AND b.sku_id = c.sku_id); -~~~ - diff --git "a/43 \351\237\251\346\226\207\346\235\260/\345\214\273\351\231\242\347\263\273\347\273\237.md" "b/43 \351\237\251\346\226\207\346\235\260/\345\214\273\351\231\242\347\263\273\347\273\237.md" deleted file mode 100644 index 0e037cec7c43aa576007886a5708fd64b7b66bc8..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/\345\214\273\351\231\242\347\263\273\347\273\237.md" +++ /dev/null @@ -1,98 +0,0 @@ -~~~MYSQL - -# 笔记 -需求分析:如果一个主体有多个属性,那就把这个主体单独作表。 - - -# 作业 -医院系统分析 -医生:编号,姓名,性别,年龄,职称,所属部门。。。 - -病人:编号,姓名,性别,年龄,身份证号,手机号。。。 - -药品:编号,名称,类别,单价,库存。。。 - -门诊:编号,名称。。。 - - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-13 17:27:17 */ -/*==============================================================*/ -CREATE DATABASE yiyuan charset utf8; -use yiyuan; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists `outpatient service`; - -drop table if exists patient; - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - doctor_name varchar(5) not null, - doctor_sex char(1) not null, - doctor_age int not null, - doctor_job varchar(10) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - Ò©Æ·Ãû³Æ varchar(20) not null, - Àà±ð varchar(20) not null, - µ¥¼Û decimal(4,1) not null, - ¿â´æ int not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: `outpatient service` */ -/*==============================================================*/ -create table `outpatient service` -( - `Outpatient number` int not null auto_increment, - doctor_id int not null, - drug_id int not null, - patient_id int not null, - `Clinic name` varchar(20) not null, - primary key (`Outpatient number`) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(10) not null, - patient_sex char(1) not null, - patient_age int not null, - patient_number numeric(18,0) not null, - patient_tel numeric(11,0) not null, - primary key (patient_id) -); - -alter table `outpatient service` add constraint `FK_doctor_outpatient service` foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table `outpatient service` add constraint `FK_drug_outpatient service` foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -alter table `outpatient service` add constraint `FK_patient_outpatient service` foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - - -~~~ - diff --git "a/43 \351\237\251\346\226\207\346\235\260/\345\244\247\344\272\214\347\254\254\344\270\200\350\212\202\344\270\223\344\270\232\350\257\276\345\277\203\345\276\227.md" "b/43 \351\237\251\346\226\207\346\235\260/\345\244\247\344\272\214\347\254\254\344\270\200\350\212\202\344\270\223\344\270\232\350\257\276\345\277\203\345\276\227.md" deleted file mode 100644 index 483991c72e493b14904722cea4cf1c3e2de82525..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/\345\244\247\344\272\214\347\254\254\344\270\200\350\212\202\344\270\223\344\270\232\350\257\276\345\277\203\345\276\227.md" +++ /dev/null @@ -1,24 +0,0 @@ -# 第一节课心得 - -# 1 课前多预习,课中多学习,课后多复习 - -# 2 多勤快,少懒惰。培养专注力,凝聚力以及探索精神。提高自己的好奇心!多进行书本查阅和网络查询。 - -# 3 培养永不言弃的精神,是问题就解决,不存在退缩。 - -# 4 多记精华笔记(适合自己的就是精华) - -# 5 想尽一切办法提升自己的简历。 - - - - - - - - - - - - - diff --git "a/43 \351\237\251\346\226\207\346\235\260/\345\245\245\347\211\271\346\233\274\346\211\223\346\200\252\345\205\275.md" "b/43 \351\237\251\346\226\207\346\235\260/\345\245\245\347\211\271\346\233\274\346\211\223\346\200\252\345\205\275.md" deleted file mode 100644 index c32a586e09263a6700873bc823012e762fbbef79..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/\345\245\245\347\211\271\346\233\274\346\211\223\346\200\252\345\205\275.md" +++ /dev/null @@ -1,135 +0,0 @@ - - -# 奥特曼打怪兽 - -**需求分析:** - -**顶层主体:奥特曼 小怪兽** - -**次主体:技能 武器** - -决斗:编号,时间,内容,回合,结果 - -奥特曼:编号,名称,颜色,身高,体重,血量,等级 - -小怪兽:编号,名称,颜色,身高,体重,血量,等级 - -技能:编号,名称,攻击力,防御力 - -武器:编号,名称,长度,重量, - -~~~mysql -CREATE database shujuku charset utf8; -use shujuku; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-14 17:06:48 */ -/*==============================================================*/ - - -drop table if exists aoteman; - -drop table if exists duel; - -drop table if exists skill; - -drop table if exists weapon; - -drop table if exists xiaoguaishou; - -/*==============================================================*/ -/* Table: aoteman */ -/*==============================================================*/ -create table aoteman -( - ao_id int not null auto_increment, - ao_name varchar(20) not null, - ao_color varchar(5) not null, - ao_height numeric(5,1) not null, - ao_weight decimal(6,1) not null, - ao_blood int not null, - ao_grade varchar(5) not null, - primary key (ao_id) -); - -/*==============================================================*/ -/* Table: duel */ -/*==============================================================*/ -create table duel -( - duel_id int not null auto_increment, - ao_id int not null, - shou_id int not null, - duel_time time not null, - duel_bout int not null, - duel_course varchar(500) not null, - duel_result varchar(50) not null, - primary key (duel_id) -); - -/*==============================================================*/ -/* Table: skill */ -/*==============================================================*/ -create table skill -( - skill_id int not null auto_increment, - ao_id int not null, - shou_id int not null, - skill_name varchar(10) not null, - skill_gong int not null, - skill_fang int not null, - primary key (skill_id) -); - -/*==============================================================*/ -/* Table: weapon */ -/*==============================================================*/ -create table weapon -( - weapon_id int not null auto_increment, - ao_id int not null, - shou_id int not null, - weapon_name varchar(10) not null, - weapon_height numeric(4,1) not null, - weapon_weight numeric(5,1) not null, - primary key (weapon_id) -); - -/*==============================================================*/ -/* Table: xiaoguaishou */ -/*==============================================================*/ -create table xiaoguaishou -( - shou_id int not null auto_increment, - shou_name varchar(10) not null, - shou_color varchar(5) not null, - shou_height numeric(5,1) not null, - shou_weight decimal(6,1) not null, - shou_blood int not null, - shou_grade varchar(5) not null, - primary key (shou_id) -); - -alter table duel add constraint `FK_accept a challenge` foreign key (ao_id) - references aoteman (ao_id) on delete restrict on update restrict; - -alter table duel add constraint FK_challenge foreign key (shou_id) - references xiaoguaishou (shou_id) on delete restrict on update restrict; - -alter table skill add constraint FK_aoteman_skill foreign key (ao_id) - references aoteman (ao_id) on delete restrict on update restrict; - -alter table skill add constraint FK_xiaoguaishou_skill foreign key (shou_id) - references xiaoguaishou (shou_id) on delete restrict on update restrict; - -alter table weapon add constraint FK_aoteman_weapon foreign key (ao_id) - references aoteman (ao_id) on delete restrict on update restrict; - -alter table weapon add constraint FK_xiaoguaishou_weapon foreign key (shou_id) - references xiaoguaishou (shou_id) on delete restrict on update restrict; - - -insert into aoteman values (1,"迪迦","红色",123,321,15,"SSR"); - -~~~ - diff --git "a/43 \351\237\251\346\226\207\346\235\260/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\346\255\245\351\252\244\347\254\224\350\256\260.md" "b/43 \351\237\251\346\226\207\346\235\260/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\346\255\245\351\252\244\347\254\224\350\256\260.md" deleted file mode 100644 index 52cb613a17c70142659a9ed345970c8c5e255f7f..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241\346\255\245\351\252\244\347\254\224\350\256\260.md" +++ /dev/null @@ -1,22 +0,0 @@ -# 数据库设计步骤 - -~~~java -第一步 - 创建概念模型 (类似E-R图) CDM (以用户的角度) -~~~ - -~~~java -第二步 - 转换成逻辑模型 LDM (以计算机角度) -~~~ - -~~~jav -第三步 - 转换成物理模型 PDM (以数据库角度) -~~~ - -~~~java、 -第四步 - 生成DDL -~~~ - diff --git "a/43 \351\237\251\346\226\207\346\235\260/\346\265\213\350\257\225\357\274\210\346\261\275\350\275\246\357\274\211.md" "b/43 \351\237\251\346\226\207\346\235\260/\346\265\213\350\257\225\357\274\210\346\261\275\350\275\246\357\274\211.md" deleted file mode 100644 index 9f99130812832bc90228f2a9d8110b35c21a771f..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/\346\265\213\350\257\225\357\274\210\346\261\275\350\275\246\357\274\211.md" +++ /dev/null @@ -1,141 +0,0 @@ -~~~mysql -# 任务: - -- 给一个汽车商店设计销售系统的数据库 - -- 顶层实体:汽车、顾客、销售员 - -# 目标: - -- 完成概念模型、逻辑模型、物理模型 - -- 生成DDL SQL语句,建立对应数据库和表结构 - -- 模拟真实数据给每个表插入一些数据。并根据应用场景需求完成 DQL语句 - -# 需求: - -- 1.能记录在售车型的信息、销售员的基本信息、客户的基本信息 - -- 2.进行车辆售卖时,记录销售员、客户、销售日期、实际售卖价格等信息 - -- 3.满足实际应用场景下的数据查询功能 - - -# 应用场景: - -- 1.查询特定销售员的销售记录 - -- 2.查找销售记录中销售价格最高的汽车 - -- 3.统计某个销售员的销售总额 - -- 4.根据客户信息查询其购买过的汽车 - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - -- 8.统计每个销售员的销售数量 -CREATE DATABASE automobile charset utf8; -use automobile; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:58:41 */ -/*==============================================================*/ - - -drop table if exists car; - -drop table if exists client; - -drop table if exists contract; - -drop table if exists salesman; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - car_type varchar(20) not null, - car_introduce varchar(255) not null, - car_price numeric(8,0) not null, - primary key (car_id) -); -INSERT INTO car VALUES -(null,"奔驰","好",200000), -(null,"奥迪","很好",250000), -(null,"兰博基尼","超级好",500000), -(null,"法拉利","非常好",300000); -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - client_id int not null auto_increment, - client_name varchar(5) not null, - client_sex char(1) not null, - client_age int not null, - primary key (client_id) -); -INSERT INTO client VALUES -(null,"小红","男",20), -(null,"小绿","女",20), -(null,"小蓝","男",20), -(null,"小紫","女",20); -/*==============================================================*/ -/* Table: contract */ -/*==============================================================*/ -create table contract -( - contract_id int not null auto_increment, - car_id int, - salesman_id int, - client_id int, - contract_date date not null, - contract_money numeric(8,0) not null, - primary key (contract_id) -); -INSERT INTO contract VALUES -(NULL,2,4,1,"2022-9-8",300000), -(NULL,1,3,3,"2022-12-9",250000), -(NULL,3,1,4,"2022-11-8",1000000), -(NULL,4,4,3,"2022-10-9",8888888), -(NULL,2,2,2,"2022-8-6",300000); - - - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id int not null auto_increment, - salesman_name varchar(5) not null, - salesman_sex char(1) not null, - salesman_age int not null, - primary key (salesman_id) -); -INSERT INTO salesman VALUES -(null,"张三","男",35), -(null,"李四","女",30), -(null,"王五","男",40), -(null,"赵六","女",20); -alter table contract add constraint FK_Relationship_1 foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table contract add constraint FK_Relationship_2 foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - -alter table contract add constraint FK_Relationship_3 foreign key (client_id) - references client (client_id) on delete restrict on update restrict; - --- 1.查询特定销售员的销售记录 -SELECT * from contract a LEFT JOIN salesman b on a.salesman_id=b.salesman_id WHERE salesman_name="张三"; - -- 2.查找销售记录中销售价格最高的汽车 - SELECT car_type , contract_money FROM contract a LEFT JOIN car b on a.car_id = b.car_id WHERE contract_money in( SELECT max(contract_money) FROM contract ) ; - - -- 3.统计某个销售员的销售总额 -SELECT salesman_name 销售员,sum(contract_money) 销售总额 from contract a LEFT JOIN salesman b on a.salesman_id=b.salesman_id WHERE salesman_name in (SELECT salesman_name FROM salesman WHERE salesman_name = "赵六"); - - -- 4.根据客户信息查询其购买过的汽车 - SELECT client_name,car_type FROM client a LEFT JOIN contract b on a.client_id = b.client_id LEFT JOIN car c on b.car_id = c.car_id; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - SELECT car_type 品牌,sum(contract_money) 销售总额,count(c.car_id) 销售数量 FROM contract b LEFT JOIN car c on b.car_id = c.car_id GROUP BY car_type; - -- 6.检索特定日期范围内的销售了哪些汽车 - SELECT * FROM contract a LEFT JOIN car c on a.car_id = c.car_id WHERE contract_date between "2022-10-1" and "2022-12-30"; - -- 7.查找某车型的销售历史。 - SELECT car_type,contract_date FROM contract a LEFT JOIN car c on a.car_id = c.car_id WHERE car_type = "奥迪" ; - -- 8.统计每个销售员的销售数量 - SELECT salesman_name 销售员, count(b.salesman_id) 销售数量 from contract a LEFT JOIN salesman b on a.salesman_id = b.salesman_id GROUP BY salesman_name; - -~~~ - diff --git "a/43 \351\237\251\346\226\207\346\235\260/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" "b/43 \351\237\251\346\226\207\346\235\260/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" deleted file mode 100644 index 79562fcfb25a7f03e9ac114b3b931b99c84a070c..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" +++ /dev/null @@ -1,224 +0,0 @@ -# 作业 - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 14:40:40 */ -/*==============================================================*/ -drop database if exists shujuku; -CREATE database if not exists shujuku charset utf8; -use shujuku; - -drop table if exists Employee; - -drop table if exists Library; - -drop table if exists `appointment records`; - -drop table if exists author; - -drop table if exists `book copy`; - -drop table if exists books; - -drop table if exists `books category`; - -drop table if exists `borrow records`; - -drop table if exists borrower; - -drop table if exists `fine records`; - -drop table if exists publisher; - -drop table if exists valuation; - -/*==============================================================*/ -/* Table: Employee */ -/*==============================================================*/ -create table Employee -( - em_id int not null auto_increment, - li_id int not null, - em_name char(5) not null, - em_posts char(5) not null, - primary key (em_id) -); - -/*==============================================================*/ -/* Table: Library */ -/*==============================================================*/ -create table Library -( - li_id int not null auto_increment, - li_name char(10) not null, - li_address varchar(50) not null, - primary key (li_id) -); - -/*==============================================================*/ -/* Table: `appointment records` */ -/*==============================================================*/ -create table `appointment records` -( - re_id int not null auto_increment, - borr_id int not null, - re_time date not null, - re_state char(2) not null, - primary key (re_id) -); - -/*==============================================================*/ -/* Table: author */ -/*==============================================================*/ -create table author -( - au_id int not null auto_increment, - au_name char(5) not null, - au_nationality char(5) not null, - au_sex char(1) not null, - au_tel numeric(11,0) not null, - primary key (au_id) -); - -/*==============================================================*/ -/* Table: `book copy` */ -/*==============================================================*/ -create table `book copy` -( - copy_id int not null auto_increment, - li_id int not null, - copy_state char(2) not null, - primary key (copy_id) -); - -/*==============================================================*/ -/* Table: books */ -/*==============================================================*/ -create table books -( - book_id int not null auto_increment, - li_id int not null, - copy_id int not null, - cate_id int not null, - au_id int not null, - pu_id int not null, - borr_id int not null, - book_address varchar(50) not null, - book_name char(10) not null, - book_date date not null, - primary key (book_id) -); - -/*==============================================================*/ -/* Table: `books category` */ -/*==============================================================*/ -create table `books category` -( - cate_id int not null auto_increment, - cate_name char(10) not null, - primary key (cate_id) -); - -/*==============================================================*/ -/* Table: `borrow records` */ -/*==============================================================*/ -create table `borrow records` -( - bo_id int not null auto_increment, - bo_date date not null, - bo_return date not null, - primary key (bo_id) -); - -/*==============================================================*/ -/* Table: borrower */ -/*==============================================================*/ -create table borrower -( - borr_id int not null auto_increment, - bo_id int not null, - borr_name varchar(20) not null, - borr_sex char(1) not null, - borr_tel numeric(11,0) not null, - primary key (borr_id) -); - -/*==============================================================*/ -/* Table: `fine records` */ -/*==============================================================*/ -create table `fine records` -( - fine_id int not null auto_increment, - borr_id int not null, - fine_number numeric(10,0) not null, - fine_date date not null, - primary key (fine_id) -); - -/*==============================================================*/ -/* Table: publisher */ -/*==============================================================*/ -create table publisher -( - pu_id int not null auto_increment, - pu_name char(10) not null, - pu_address varchar(50) not null, - primary key (pu_id) -); - -/*==============================================================*/ -/* Table: valuation */ -/*==============================================================*/ -create table valuation -( - va_id int not null auto_increment, - book_id int not null, - borr_id int not null, - va_score decimal(2,1) not null, - va_content varchar(50) not null, - primary key (va_id) -); - -alter table Employee add constraint FK_yuangong foreign key (li_id) - references Library (li_id) on delete restrict on update restrict; - -alter table `appointment records` add constraint FK_lul foreign key (borr_id) - references borrower (borr_id) on delete restrict on update restrict; - -alter table `book copy` add constraint FK_shu foreign key (li_id) - references Library (li_id) on delete restrict on update restrict; - -alter table books add constraint FK_cangshu foreign key (li_id) - references Library (li_id) on delete restrict on update restrict; - -alter table books add constraint FK_chu foreign key (au_id) - references author (au_id) on delete restrict on update restrict; - -alter table books add constraint FK_fuben foreign key (copy_id) - references `book copy` (copy_id) on delete restrict on update restrict; - -alter table books add constraint FK_guanci foreign key (cate_id) - references `books category` (cate_id) on delete restrict on update restrict; - -alter table books add constraint FK_jie foreign key (borr_id) - references borrower (borr_id) on delete restrict on update restrict; - -alter table books add constraint FK_zuo foreign key (pu_id) - references publisher (pu_id) on delete restrict on update restrict; - -alter table borrower add constraint FK_jilu foreign key (bo_id) - references `borrow records` (bo_id) on delete restrict on update restrict; - -alter table `fine records` add constraint FK_fa foreign key (borr_id) - references borrower (borr_id) on delete restrict on update restrict; - -alter table valuation add constraint FK_ping foreign key (book_id) - references books (book_id) on delete restrict on update restrict; - -alter table valuation add constraint FK_ren foreign key (borr_id) - references borrower (borr_id) on delete restrict on update restrict; - - -~~~ - diff --git "a/43 \351\237\251\346\226\207\346\235\260/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232\357\274\210\347\224\265\345\275\261\347\263\273\347\273\237\357\274\211.md" "b/43 \351\237\251\346\226\207\346\235\260/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232\357\274\210\347\224\265\345\275\261\347\263\273\347\273\237\357\274\211.md" deleted file mode 100644 index a8889d1eb6ea01224301f461b0c6e12e9ee1741a..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/\347\254\254\344\272\214\346\254\241\344\275\234\344\270\232\357\274\210\347\224\265\345\275\261\347\263\273\347\273\237\357\274\211.md" +++ /dev/null @@ -1,118 +0,0 @@ - - -# 作业 - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 11:27:29 */ -/*==============================================================*/ -CREATE database shujuku charset utf8; -use shujuku; - -drop table if exists `Movie information`; - -drop table if exists director; - -drop table if exists participant; - -drop table if exists sheet; - -drop table if exists `short commentary`; - -/*==============================================================*/ -/* Table: `Movie information` */ -/*==============================================================*/ -create table `Movie information` -( - mo_id int not null auto_increment, - dir_id int not null, - sheet_id int not null, - short_id int not null, - mo_name varchar(10) not null, - mo_type char(2) not null, - mo_language varchar(5) not null, - mo_coutry varchar(10) not null, - mo_describe varchar(50) not null, - mo_time int not null, - `mo_date created` time not null, - primary key (mo_id) -); - -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - dir_id int not null auto_increment, - dir_name varchar(5) not null, - dir_sex char(1) not null, - dir_constellation varchar(3) not null, - `dir_date of birth` varchar(20) not null, - dir_occupation varchar(20) not null, - `dir_member of family` varchar(50) not null, - primary key (dir_id) -); - -/*==============================================================*/ -/* Table: participant */ -/*==============================================================*/ -create table participant -( - par_id int not null auto_increment, - mo_id int not null, - Mov_mo_id int not null, - Mov_mo_id2 int not null, - short_id int not null, - `Name of director` varchar(10) not null, - `Screenwriter's name` varchar(10) not null, - `Name of lead actor` varchar(10) not null, - primary key (par_id) -); - -/*==============================================================*/ -/* Table: sheet */ -/*==============================================================*/ -create table sheet -( - sheet_id int not null auto_increment, - sheet_collect int not null, - sheet_recommend varchar(50) not null, - primary key (sheet_id) -); - -/*==============================================================*/ -/* Table: `short commentary` */ -/*==============================================================*/ -create table `short commentary` -( - short_id int not null auto_increment, - short_label varchar(10) not null, - short_comment varchar(50) not null, - primary key (short_id) -); - -alter table `Movie information` add constraint FK_duan_movie foreign key (short_id) - references `short commentary` (short_id) on delete restrict on update restrict; - -alter table `Movie information` add constraint FK_pai_movie foreign key (dir_id) - references director (dir_id) on delete restrict on update restrict; - -alter table `Movie information` add constraint FK_shoucang_movie foreign key (sheet_id) - references sheet (sheet_id) on delete restrict on update restrict; - -alter table participant add constraint FK_bian_movie foreign key (mo_id) - references `Movie information` (mo_id) on delete restrict on update restrict; - -alter table participant add constraint FK_can_duan foreign key (short_id) - references `short commentary` (short_id) on delete restrict on update restrict; - -alter table participant add constraint FK_dao_movie foreign key (Mov_mo_id) - references `Movie information` (mo_id) on delete restrict on update restrict; - -alter table participant add constraint FK_yan_movie foreign key (Mov_mo_id2) - references `Movie information` (mo_id) on delete restrict on update restrict; - - -~~~ - diff --git "a/43 \351\237\251\346\226\207\346\235\260/\350\247\206\345\233\276\350\257\255\346\263\225\357\274\210\345\242\236\345\210\240\346\224\271\346\237\245\357\274\211.md" "b/43 \351\237\251\346\226\207\346\235\260/\350\247\206\345\233\276\350\257\255\346\263\225\357\274\210\345\242\236\345\210\240\346\224\271\346\237\245\357\274\211.md" deleted file mode 100644 index b318d5005659aeb45ded794c1af6038086a6bf1d..0000000000000000000000000000000000000000 --- "a/43 \351\237\251\346\226\207\346\235\260/\350\247\206\345\233\276\350\257\255\346\263\225\357\274\210\345\242\236\345\210\240\346\224\271\346\237\245\357\274\211.md" +++ /dev/null @@ -1,351 +0,0 @@ -# 视图笔记 - -check 检查约束 - -check作用:检查某个字段的值是否符合xx要求,一般指值的范围 - -语法:gender char(1) check (gender in (‘男’,‘女’)); - -或者 gender char(1), - -check (gender in ('男','女')); - -在utf8中,一个汉字是一个字符,等于3个字节——————length(name) - -concat (last_name,' ',first_name)姓名; - -视图语法: - -creat view v_1 as (select语句); - -select * from v_1; - -查看视图:desc 视图名称 - -查看视图创建过程: show creat view 视图名称; - -修改视图 - -方式一:alter view 视图名称 as ..... - -方式二:creat or replace view 视图名称 as...... - -删除视图:drop view if exists 视图名称; - - - -~~~mysql - - -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -#第14章_视图的课后练习 - -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE VIEW employee_vu (姓名, 员工号,部门号)as -SELECT LAST_NAME ,EMPLOYEE_ID ,DEPARTMENT_ID from employees; - -SELECT * from employee_vu; - -#2. 显示视图的结构 - -desc employee_vu; -#3. 查询视图中的全部内容 -CREATE view v_2 as -SELECT * from departments; - -SELECT * from v_2; -#4. 将视图中的数据限定在部门号是80的范围内 -CREATE view v_1 as -SELECT * from employees WHERE department_id=80; - -SELECT * from v_1; -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -CREATE view emp_v1 as -SELECT concat (last_name,'',first_name) 员工姓名 ,salary 工资, email 邮箱 -from employees -WHERE -phone_number like "011%"; - -SELECT * from emp_v1; - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -alter view emp_v1 as -SELECT CONCAT(last_name,'',first_name)员工姓名, email 邮箱, phone_number 电话号码, salary 工资 from employees -WHERE phone_number like "011%" and email like "%e%"; - -SELECT * from emp_v1; -#3. 向 emp_v1 插入一条记录,是否可以? -# 可以 - -CREATE or replace view emp_v1 AS -SELECT * from employees; - -SELECT * from emp_v1; - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -alter view emp_v1 as -SELECT * from employees where (salary+1000); - -SELECT * from emp_v1; - -#5. 删除emp_v1中姓名为Olsen的员工 -delete from emp_v1 WHERE last_name="Olsen"; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -CREATE view emp_v2 as -SELECT department_id 部门id,max(salary) 最高工资 from employees GROUP BY department_id having max(salary)>12000; - - -SELECT * from emp_v2; - - -#7. 向 emp_v2 中插入一条记录,是否可以? - -# 可以 - -CREATE or replace view emp_v2 AS -SELECT * from employees; - -SELECT * from emp_v2; - - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view if EXISTS emp_v1,emp_v2; -~~~ - diff --git "a/44\344\273\243\347\221\236/20230906\345\274\200\345\255\246\347\254\254\344\270\200\350\257\276\347\254\224\350\256\260.md" "b/44\344\273\243\347\221\236/20230906\345\274\200\345\255\246\347\254\254\344\270\200\350\257\276\347\254\224\350\256\260.md" deleted file mode 100644 index 3eacd98e6b96bb6aa3be7201d44ee20b0919d74b..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230906\345\274\200\345\255\246\347\254\254\344\270\200\350\257\276\347\254\224\350\256\260.md" +++ /dev/null @@ -1,261 +0,0 @@ -## 笔记 - -![1](C:\Users\小新\Desktop\1.jpg) - -学习自己的技能树超过技术栈 - -开发框架:JavaScript 、SpringBoot 、SSM(Spring、SpringMVC、MyBatis) 、SSH(Struts,Spring,Hibernate) - -技术:js 、node.js 、Ajax 、Vue.js - -一、SSH - -1、基本概念 - -SSH框架是JAVA EE中三种框架所集成,分别是Struts,Spring,Hibernate框架所组成,是当前比较流行的java web开源框架。 - -集成SSH框架的系统从职责上分为(Struts2--控制;spring--解耦;hibernate--操作数据库),以帮助开发人员在短期内搭建结构清晰、可服用好、维护方便的web应用程序。使用Struts作为系统的整体基础框架,负责MVC的分离,在Struts框架的模型部分,控制业务跳转,利用hibernate框架对持久层提供支持,spring做管理,管理Struts和hibernate。 - -2、Struts2 - -(1)基本概念 - -Struts2是一个基于MVC设计模式的web应用框架,相当于一个servlet,在MVC设计模式中,Struts2作为控制器(controller)来建立模型与视图的数据交互。Struts2在Struts1融合webwork。struts2以webwork为核心,采用拦截器的机制来处理用户的请求,这样的设计使得业务逻辑控制器能够与servletAPI完全脱离。 - -(2)Struts2框架的运行结构 - - - -![img](https://pic3.zhimg.com/80/v2-7cb4bae871a7160e4e9ce36230c8039e_1440w.webp) - -解析:客户端发送请求(HttpServletRequest)到服务器,服务器接收到请求就先进入web.xml配置文件看看有没有配置过滤器,发现有有Struts2的过滤器,然后找到struts.xml配置文件,struts.xml配置文件里定义一个action,然后就去找到action类,此类继承ActionSupport接口,并且实现了execute()方法,返回一个字符串“success”给struts.xml配置文件,struts.xml配置文件的action会默认调用action类的execute()方法,result接收到返回的字符串,result就会调用你指定的jsp页面将结果呈现,最后响应给客户端。 - -(3)Struts2的优势 - -实现了MVC模式,层次结构清晰,使程序员只需要关注业务逻辑的实现。 - -丰富的标签库,大大提高了开发的效率。 - -Struts2提供丰富的拦截器实现。 - -通过配置文件,就可以掌握整个系统各个部分之间的关系。 - -异常处理机制,只需在配置文件中配置异常的映射,即可对异常做响应的处理。 - -Struts2的可扩展性高。 - -面向切面编程的思想在Struts2中也有了很好的体现。 - -体现了拦截器的使用,拦截器是一个一个的小功能模块,用户可以将这些拦截器合并成一个大的拦截器,这个合成的拦截器就像单独的拦截器一样,只要将它配置到一个Action中就可以。 - -(4)Struts2的缺点: - -校验较繁琐,多字段出错返回不同。 - -安全性太低 - -获取传参时较麻烦 - -2、Spring - -spring是一个开源开发框架,是一个轻量级控制反转(IoC)和面向切面(AOP)的容器框架。 - -spring主要用来开发java应用,构建J2EE平台的web应用。其核心就是提供一种新的机制管理业务对象及其依赖关系。 - -(2)spring的流程图 - - - -![img](https://pic1.zhimg.com/80/v2-df9fbed78c75877c3d94e8e9d164a93c_1440w.webp) - - - -解析:上面是在Struts结构图的基础上加入了spring流程图,在web.xml配置文件中加入了spring的监听器,在struts.xml配置文件中添加 - -“” - -是告知Struts2运行时使用spring来管理对象,spring在其中主要做的就是注入实例,所有需要类的实例都由spring管理。 - -(3)spring的优点 - -容器:spring是一个容器,包含并管理对象的生命周期和配置。可以配置每个bean如何被创建,基于一个可配置原型prototype,你的bean可以创建一个单独的实例或者每次需要时都生成一个新的实例。 - -支持AOP:spring提供对AOP的支持,它允许将一些通用任务,如安全、事物、日志等进行集中式处理,从而提高了程序的复用性。 - -轻量级框架:spring是轻量级框架,其基本的版本大约2M。 - -控制反转:spring通过控制反转实现松耦合。对象们给他们依赖,而不是对象本身,方便解耦,简化开发。 - -方便程序测试:spring提供了Junit4的支持,可以通过注解方便的测试spring程序。 - -降低java EE API的使用难度:spring对java EE开发中非常难用的一些API(比如JDBC),都提供了封装,使这些API应用难度大大降低。 - -方便集成各种优秀框架:spring内部提供了对各种优秀框架(如Struts、mybatis)的直接支持。 - -支持声明式事务处理:只需要通过配置就可以完成对事务的管理,而无须手动编程。 - -(4)spring的缺点 - -依赖反射,反射影响进程。 - -太过于依赖设计模式。 - -控制器过于灵活。 - -不支持分布式应用。 - -Spring常用注解(绝对经典) - -3、hibernate - -Hibernate是一个开放源代码的对象关系映射框架,它对JDBC进行了非常轻量级的对象封装,它将POJO与数据库表建立映射关系,是一个全自动的orm框架,hibernate可以自动生成SQL语句,自动执行,使得Java程序员可以随心所欲的使用对象编程思维来操纵数据库。 Hibernate可以应用在任何使用JDBC的场合,既可以在Java的客户端程序使用,也可以在Servlet/JSP的Web应用中使用,最具革命意义的是,Hibernate可以在应用EJB的J2EE架构中取代CMP,完成数据持久化的重任。 - -(2)hibernate的核心构成和执行流程图 - - - -![img](https://pic1.zhimg.com/80/v2-80f3b79fb547ca111895b9407be85778_1440w.webp) - - - - - -![img](https://pic4.zhimg.com/80/v2-9e5acf3f4a5c9b792ba0eaeabcf8df63_1440w.webp) - - - -(3)hibernate的优点 - -对JDBC访问数据库的代码做了封装,大大简化了数据访问层繁琐的重复性代码。 - -Hibernate是一个优秀的ORM实现。他很大程度的简化DAO层的编码工作,将软件开发人员从大量相同的数据持久层相关编程工作中解放出来,使开发更对象化了。 - -透明持久化(persistent)带有持久化状态的、具有业务功能的单线程对象,此对象生存期很短。这些对象可能是普通的javabeans/POJO,(POJO概念,plain ordinary java object,简单的java对象,可以简单理解为简单的实体类entity。)这个对象没有实现第三方框架或接口,唯一特殊的是他们正与session关联。一旦这个session被关闭,这些对象就会脱离持久化状态,这样就可被应用程序的任何层自由使用。 - -事务transaction应用程序用来指定原子操作单元范围的对象,它是单线程的,生命周期很短。它通过抽象将应用从底层具体的JDBC、JTA(java transaction API,JTA允许应用程序执行分布式事务处理,在两个或多个网络计算机资源访问并且更新数据,JDBC驱动程序的JTA支持极大地增强了数据访问能力)以及CORBA(公用对象请求代理程序体系结构,common object request broker architecture,简而言之,CORB允许应用程序和其它的应用程序通讯)事务隔离开。某些情况下,一个session之内可能包含多个transaction对象,事务边界的开启与关闭时必不可少的。 - -它没有侵入性,是轻量级框架。 - -移植性好,支持各种数据库,如果换个数据库只要在配置文件中变换配置就可以了,不用改变hibernate代码。 - -缓存机制,提供一级缓存和二级缓存。 - -一级缓存:是session级别的缓存,一个session做了一个查询操作,它会把这个操作的结果放到一级缓存中,如果短时间内这个session又做了同一个操作,那么hibernate直接从一级缓存中拿出,而不会去连数据库取数据。 - -二级缓存:是sessionFactory级别的缓存,就是查询的时候会把结果缓存到二级缓存中,如果同一个sessionFactory创建的某个session执行了相同的操作,hibernate就会从二级缓存中拿出结果,而不会再去连接数据库。 - -(4)hibernate的缺点 - -持久层封装过于完整,导致开发人员无法对SQL进行优化,无法灵活应用原生SQL。 - -批量数据处理的时候较为弱势。 - -框架中使用ORM原则,导致配置过于复杂,遇到大项目,维护问题不断。 - -Hibernate实现CRUD(附项目源码) - -二、SSM - -SSM架构,是三层结合所成的框架,分别是Spring、SpringMVC、MyBatis所组成。Spring依赖注入来管理各层,面向切面编程管理事务,日志和权限。SpringMVC代表了model、view、controller接收外部请求,进行开发和处理。mybatis是基于jdbc的框架,主要用来操作数据库,并且将业务实体和数据表联系起来。 - -1、spring - -详细介绍见SSH中spring。 - -2、SpringMVC - -属于spring框架的一部分,用来简化MVC架构的web应用程序开发。 - -(2)SpringMVC的优点 - -拥有强大的灵活性,非侵入性和可配置性 - -提供了一个前端控制器dispatcherServlet,开发者无需额外开发控制器对象 - -分工明确,包括控制器、验证器、命令对象、模型对象、处理程序映射视图解析器,每一个功能实现由一个专门的对象负责完成 - -可以自动绑定用户输入,并正确的转换数据类型 - -可重用的业务代码:可以使用现有的业务对象作为命令或表单对象,而不需要去扩展某个特定框架的基类。 - -(3)SpringMVC的缺点 - -servlet API耦合难以脱离容器独立运行 - -太过于细分,开发效率低 - -SpringMVC中put和post如何选择 - -GET和POST的区别 - -@RequestParam、@ModelAttribute、@RequestBody的区别 - -HttpServletResponse response实现文件上传、下载 - -3、mybatis - -mybatis是一个简化和实现了java数据持久层的开源框架,它抽象了大量的JDBC冗余代码,并提供了一个简单易用的API和数据库交互。 - -(2)mybatis的优点 - -与JDBC相比,减少了50%以上的代码量。 - -mybatis是最简单的持久化框架,小巧并且简单易学。 - -mybatis灵活,不会对应用程序或者数据库的限售设计强加任何影响,SQL写在XML里,从程序代码中彻底分离,降低耦合度,便于统一管理和优化,可重用。 - -提供XML标签,支持编写动态SQL语句(XML中使用if,else)。 - -提供映射标签,支持对象与数据库的ORM字段关系映射(在XML中配置映射关系,也可以使用注解) - -(3)mybatis的缺点 - -SQL语句的编写工作量较大,对开发人员的SQL语句编写有一定的水平要求。 - -SQL语句过于依赖数据库,不能随意更换数据库。 - -拼接复杂SQL语句时不灵活。 - -三、Springboot - -1、springboot基本概念 - -springboot是一个全新的框架,简化Spring的初始搭建和开发过程,使用了特定的方式来进行配置,让开发人员不再需要定义样板化的配置。此框架不需要配置xml,依赖于maven这样的构建系统。 - -2、Springboot的优点 - -(1)减少了大量的开发时间并提高了生产力 - -(2)避免了编写大量的样板代码,注释和XML配置 - -(3)解决了spring的弊端 - -(4)代码少了、配置文件少了、不需要对第三方框架烦恼了、项目精简了,对整个团队的开发和维护来说,更大的节约了成本。 - -3、springboot的缺点 - -(1)修复bug较慢,报错时难以定位。 - -(2)集成度较高,不易于了解底层。 - -4、springboot总结 - -简单、快速、方便的搭建项目;对主流开发框架的无配置集成;极大提高了开发、部署效率。 - -5、springboot和spring的区别 - -(1)springboot可以建立独立的spring应用程序。 - -(2)内嵌了如tomcat,Jetty和Undertow这样的容器,也就是说可以直接跑起来,用不着再做部署工作。 - -(3)无需再像spring那样写一堆繁琐的XML配置文件 - -(4)可以自动配置spring - -(5)提供的POM可以简化maven的配置 - -6、springboot和springMVC的区别 - -(1)SpringMVC是基于spring的一个MVC框架。 - -(2)springboot的基于spring的条件注册的一套快速开发整合包。 \ No newline at end of file diff --git "a/44\344\273\243\347\221\236/20230907\344\275\234\344\270\232.md" "b/44\344\273\243\347\221\236/20230907\344\275\234\344\270\232.md" deleted file mode 100644 index c47ae129ccbbae6de43ea5b3ebf114116477e954..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230907\344\275\234\344\270\232.md" +++ /dev/null @@ -1,52 +0,0 @@ -## 作业 - -``` mysql -create database if not exists top charset utf8; -use top; -CREATE TABLE `院系信息表` ( - `院系名称` varchar(255) NOT NULL, - PRIMARY KEY (`院系名称`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `专业表` ( - `专业名称` varchar(255) DEFAULT NULL, - `专业编号` varchar(255) NOT NULL, - PRIMARY KEY (`专业编号`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `学生信息表` ( - `学号` varchar(255) NOT NULL, - `姓名` varchar(255) NOT NULL, - `院系` varchar(255) NOT NULL, - PRIMARY KEY (`学号`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `课程信息表` ( - `课程编号` varchar(255) NOT NULL, - `课程名称` varchar(255) NOT NULL, - `课程类型` varchar(255) NOT NULL, - `学分` int(11) DEFAULT NULL, - PRIMARY KEY (`课程编号`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `教室信息表` ( - `教室编号` varchar(255) NOT NULL, - `教室名称` varchar(255) NOT NULL, - `教室容纳数` int(11) NOT NULL, - PRIMARY KEY (`教室编号`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `教室借用表` ( - `工号` varchar(255) NOT NULL, - `教室编号` varchar(255) NOT NULL, - `星期` varchar(255) DEFAULT NULL, - PRIMARY KEY (`工号`,`教室编号`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `教师开课表` ( - `教室编号` varchar(255) NOT NULL, - `学号` varchar(255) NOT NULL, - `星期` varchar(255) DEFAULT NULL, - PRIMARY KEY (`教室编号`,`学号`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -CREATE TABLE `教师信息表` ( - `工号` varchar(255) NOT NULL, - `教师姓名` varchar(255) DEFAULT NULL, - PRIMARY KEY (`工号`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; -``` - diff --git "a/44\344\273\243\347\221\236/20230907\346\227\245\344\275\234\344\270\232.md" "b/44\344\273\243\347\221\236/20230907\346\227\245\344\275\234\344\270\232.md" deleted file mode 100644 index f49854889064786d07070f7abf878fb4d8c4b0e0..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230907\346\227\245\344\275\234\344\270\232.md" +++ /dev/null @@ -1,41 +0,0 @@ -# 笔记 - -## 表与表之间的关系 - -1、一对一的关系 - -一、两张表的主键,建立外键约束。 - -```mysql --- 建立一对一关系:一夫一妻 -mysql> create table husband( - -> hid int primary key auto_increment comment '丈夫编号', - -> hname varchar(20) not null comment '丈夫姓名' - -> ); -Query OK, 0 rows affected (0.03 sec) - -mysql> create table wife( - -> wid int primary key auto_increment comment '妻子编号', - -> wname varchar(20) not null comment '妻子姓名' - -> ,foreign key(wid) references husband(hid) - -> ); -Query OK, 0 rows affected (0.02 sec) -``` - - - -2、一对多的关系 - -一、将一所在的表放在多那个表中当外键 - -3、多对多的关系 - -一、需要创建第三个表,将前面两个表中的主键放到第三个表中当外键 - -## 数据库范式 - -1、第一范式:要求字段的内容不可再分,为保证数据的原子性。 - -2、第二范式:要求满足第一范式的基础上,要求非主键字段要完全依赖主键,而不能只依赖部分, - -3、第三范式:要求满足第二范式前提上,要非主键属性要直接依赖主键。 \ No newline at end of file diff --git "a/44\344\273\243\347\221\236/20230910\344\275\234\344\270\232.md" "b/44\344\273\243\347\221\236/20230910\344\275\234\344\270\232.md" deleted file mode 100644 index 855a55367f921fe895a4799afa0d7c3daf4892d6..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230910\344\275\234\344\270\232.md" +++ /dev/null @@ -1,92 +0,0 @@ -## 笔记 - -- Conceptual Data Model----------概念模型 -- Physical Data Model--------------物理模型 -- Object-Oriented Model-----------逻辑模型 - -P是PrimaryIdentifier是否为**主键**表述的缩写,勾选了P就代表当前被勾选字段是该表的主键。M是Mandatory的缩写,属性值是否允许为空的意思。D是displayed的缩写,表示是否在实体图形符号中显示该属性。 - -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/10 21:52:14 */ -/*==============================================================*/ - - -drop table if exists Relationship_1; - -drop table if exists Relationship_3; - -drop table if exists book; - -drop table if exists manager; - -drop table if exists reader; - -/*==============================================================*/ -/* Table: Relationship_1 */ -/*==============================================================*/ -create table Relationship_1 -( - "r-id" varchar(11) not null, - "b-id" varchar(11) not null, - primary key ("r-id", "b-id") -); - -/*==============================================================*/ -/* Table: Relationship_3 */ -/*==============================================================*/ -create table Relationship_3 -( - "m-id" varchar(11) not null, - "b-id" varchar(11) not null, - primary key ("m-id", "b-id") -); - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - "b-id" varchar(11) not null, - "b-name" char(4) not null, - borrower char(1) not null, - primary key ("b-id") -); - -/*==============================================================*/ -/* Table: manager */ -/*==============================================================*/ -create table manager -( - "m-id" varchar(11) not null, - "m-name" char(4) not null, - primary key ("m-id") -); - -/*==============================================================*/ -/* Table: reader */ -/*==============================================================*/ -create table reader -( - "r-id" varchar(11) not null, - "r-name" char(4) not null, - "r-sex" char(1) not null, - primary key ("r-id") -); - -alter table Relationship_1 add constraint FK_Relationship_1 foreign key ("r-id") - references reader ("r-id") on delete restrict on update restrict; - -alter table Relationship_1 add constraint FK_Relationship_2 foreign key ("b-id") - references book ("b-id") on delete restrict on update restrict; - -alter table Relationship_3 add constraint FK_Relationship_3 foreign key ("m-id") - references manager ("m-id") on delete restrict on update restrict; - -alter table Relationship_3 add constraint FK_Relationship_4 foreign key ("b-id") - references book ("b-id") on delete restrict on update restrict; - - -``` - diff --git "a/44\344\273\243\347\221\236/20230912\344\275\234\344\270\232.md" "b/44\344\273\243\347\221\236/20230912\344\275\234\344\270\232.md" deleted file mode 100644 index 2b4c76de8ce669d2d12bf5324351c766bf40b68c..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230912\344\275\234\344\270\232.md" +++ /dev/null @@ -1,188 +0,0 @@ -## 作业 - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 17:16:23 */ -/*==============================================================*/ - - -drop table if exists Relationship_2; - -drop table if exists Relationship_3; - -drop table if exists Relationship_4; - -drop table if exists Relationship_5; - -drop table if exists Relationship_6; - -drop table if exists actor; - -drop table if exists comment; - -drop table if exists employee; - -drop table if exists movie; - -drop table if exists people; - -drop table if exists "short review"; - -/*==============================================================*/ -/* Table: Relationship_2 */ -/*==============================================================*/ -create table Relationship_2 -( - "p-name" char(4) not null, - "m-name" varchar(5) not null, - score decimal(3,1) not null, - primary key ("p-name", "m-name") -); - -/*==============================================================*/ -/* Table: Relationship_3 */ -/*==============================================================*/ -create table Relationship_3 -( - director char(4) not null, - "m-name" varchar(5) not null, - actorname varchar(4) not null, - primary key (director, "m-name") -); - -/*==============================================================*/ -/* Table: Relationship_4 */ -/*==============================================================*/ -create table Relationship_4 -( - "a-name" char(4) not null, - director char(4) not null, - scriptwritername varchar(4) not null, - primary key ("a-name", director) -); - -/*==============================================================*/ -/* Table: Relationship_5 */ -/*==============================================================*/ -create table Relationship_5 -( - "c-id" varchar(11) not null, - "p-name" char(4) not null, - "c-start" varchar(11) not null, - primary key ("c-id", "p-name") -); - -/*==============================================================*/ -/* Table: Relationship_6 */ -/*==============================================================*/ -create table Relationship_6 -( - "s-id" varchar(11) not null, - "p-name" char(4) not null, - "s-startµÈ¼¶" varchar(12) not null, - primary key ("s-id", "p-name") -); - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - "a-name" char(4) not null, - "a-sex" char(1) not null, - datetime datetime not null, - Constellation char(3) not null, - birthplace varchar(5) not null, - job char(2) not null, - "Foreign name" varchar(8) not null, - Chinesename char(4) not null, - family varchar(25) not null, - imdbID varchar(15) not null, - primary key ("a-name") -); - -/*==============================================================*/ -/* Table: comment */ -/*==============================================================*/ -create table comment -( - "c-id" varchar(11) not null, - "s-content" varchar(500) not null, - primary key ("c-id") -); - -/*==============================================================*/ -/* Table: employee */ -/*==============================================================*/ -create table employee -( - director char(4) not null, - star varchar(4) not null, - scriptwriter char(4) not null, - primary key (director) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - "m-name" varchar(5) not null, - "m-type" varchar(5) not null, - "m-time" int not null, - "release-date" time not null, - "rename" varchar(20) not null, - primary key ("m-name") -); - -/*==============================================================*/ -/* Table: people */ -/*==============================================================*/ -create table people -( - "p-name" char(4) not null, - "p-sex" char(1) not null, - primary key ("p-name") -); - -/*==============================================================*/ -/* Table: "short review" */ -/*==============================================================*/ -create table "short review" -( - "s-id" varchar(11) not null, - "s-content" varchar(500) not null, - primary key ("s-id") -); - -alter table Relationship_2 add constraint FK_Relationship_2 foreign key ("p-name") - references people ("p-name") on delete restrict on update restrict; - -alter table Relationship_2 add constraint FK_Relationship_7 foreign key ("m-name") - references movie ("m-name") on delete restrict on update restrict; - -alter table Relationship_3 add constraint FK_Relationship_3 foreign key (director) - references employee (director) on delete restrict on update restrict; - -alter table Relationship_3 add constraint FK_Relationship_8 foreign key ("m-name") - references movie ("m-name") on delete restrict on update restrict; - -alter table Relationship_4 add constraint FK_Relationship_4 foreign key ("a-name") - references actor ("a-name") on delete restrict on update restrict; - -alter table Relationship_4 add constraint FK_Relationship_9 foreign key (director) - references employee (director) on delete restrict on update restrict; - -alter table Relationship_5 add constraint FK_Relationship_10 foreign key ("p-name") - references people ("p-name") on delete restrict on update restrict; - -alter table Relationship_5 add constraint FK_Relationship_5 foreign key ("c-id") - references comment ("c-id") on delete restrict on update restrict; - -alter table Relationship_6 add constraint FK_Relationship_11 foreign key ("p-name") - references people ("p-name") on delete restrict on update restrict; - -alter table Relationship_6 add constraint FK_Relationship_6 foreign key ("s-id") - references "short review" ("s-id") on delete restrict on update restrict; - - \ No newline at end of file diff --git "a/44\344\273\243\347\221\236/20230914\344\275\234\344\270\232.md" "b/44\344\273\243\347\221\236/20230914\344\275\234\344\270\232.md" deleted file mode 100644 index 80d5ddbcb53b87fe8543354ef4f59da4b2ddd791..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230914\344\275\234\344\270\232.md" +++ /dev/null @@ -1,106 +0,0 @@ - - - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 22:58:34 */ -/*==============================================================*/ - - -drop table if exists department; - -drop table if exists diagnose; - -drop table if exists doctor; - -drop table if exists hospital; - -drop table if exists pharmacy; - -drop table if exists sick; - -/*==============================================================*/ -/* Table: department */ -/*==============================================================*/ -create table department -( - d_id varchar(11) not null, - hospital_name varchar(10), - d_name varchar(11) not null, - d_tel varchar(15) not null, - d_address varchar(25) not null, - primary key (d_id) -); - -/*==============================================================*/ -/* Table: diagnose */ -/*==============================================================*/ -create table diagnose -( - "doctor-ID" varchar(15) not null, - "sick-IDcar" varchar(15) not null, - "drug-id" varchar(15), - "prescription-id" varchar(15) not null, - primary key ("doctor-ID", "sick-IDcar") -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - "doctor-ID" varchar(15) not null, - d_id varchar(11), - "doctor-name" char(4) not null, - "doctor-tel" varchar(15) not null, - primary key ("doctor-ID") -); - -/*==============================================================*/ -/* Table: hospital */ -/*==============================================================*/ -create table hospital -( - hospital_name varchar(10) not null, - primary key (hospital_name) -); - -/*==============================================================*/ -/* Table: pharmacy */ -/*==============================================================*/ -create table pharmacy -( - "drug-id" varchar(15) not null, - "drug-name" varchar(12) not null, - primary key ("drug-id") -); - -/*==============================================================*/ -/* Table: sick */ -/*==============================================================*/ -create table sick -( - "sick-name" char(4) not null, - "sick-age" int not null, - "sick-sex" char(1) not null, - "sick-tel" varchar(15) not null, - "sick-IDcar" varchar(15) not null, - primary key ("sick-IDcar") -); - -alter table department add constraint FK_Relationship_1 foreign key (hospital_name) - references hospital (hospital_name) on delete restrict on update restrict; - -alter table diagnose add constraint FK_Relationship_4 foreign key ("doctor-ID") - references doctor ("doctor-ID") on delete restrict on update restrict; - -alter table diagnose add constraint FK_Relationship_5 foreign key ("sick-IDcar") - references sick ("sick-IDcar") on delete restrict on update restrict; - -alter table diagnose add constraint FK_Relationship_6 foreign key ("drug-id") - references pharmacy ("drug-id") on delete restrict on update restrict; - -alter table doctor add constraint FK_Relationship_2 foreign key (d_id) - references department (d_id) on delete restrict on update restrict; - diff --git "a/44\344\273\243\347\221\236/20230916.md" "b/44\344\273\243\347\221\236/20230916.md" deleted file mode 100644 index a0bab21f6b19b783652fae6be2eb3ebf3af42cea..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230916.md" +++ /dev/null @@ -1,93 +0,0 @@ -# 笔记 - -``` mysql -SQL内连接、外连接、交叉连接 -内连接(inner join) -外连接(outer join) -左外连接 -右外连接 -全连接(full join) -交叉连接(cross join) -隐式交叉连接与显式交叉连接 -自连接 -自然连接(natural join) -内连接(inner join) -内连接:也称为等值连接,返回两张表都满足条件的部分。inner join 就等于 join - - -select * from A inner join B on A.id=B.id -1 -外连接(outer join) -外连接分为左外连接(left outer join)和右外连接(right outer join)。 -left outer join 与 left join 等价, 一般写成left join -right outer join 与 right join等价,一般写成right join - -左外连接 -取左边的表的全部,右边的表按条件,符合的显示,不符合则显示null - - -select * from A left join B on A.id=B.id -1 -右外连接 -取右边的表的全部,左边的表按条件,符合的显示,不符合则显示null - - -select * from A right join B on A.id=B.id -1 -SQLite 支持 左外连接(left outer join),但不支持 右外连接(right outer join) - -全连接(full join) -全连接(full join)结合的左,右外连接的结果。连接表将包含的所有记录来自两个表,并使用NULL值作为两侧缺失匹配结果 - -select * from A full join B on A.id=B.id -1 -MySQL不支持FULL JOIN - -交叉连接(cross join) -用于生成两张表的笛卡尔结果集,结果集为左表中的每一行与右表中的所有行组合。 - -select * from A , B - -select * from A cross join B -1 -2 -3 -select * from A , B语句就是返回笛卡尔结果集,等同于 select * from A cross join B - -隐式交叉连接与显式交叉连接 -交叉连接有两种,显式的和隐式的,不带ON子句,返回的是两表的乘积,也叫笛卡尔积。 -例如:下面的语句1和语句2的结果是相同的。 - -语句1:隐式的交叉连接,没有CROSS JOIN。 - -SELECT O.ID, O.ORDER_NUMBER, C.ID, C.NAME -FROM ORDERS O , CUSTOMERS C -WHERE O.ID=C.ID; -1 -2 -3 -语句2:显式的交叉连接,使用CROSS JOIN。 - -SELECT O.ID, O.ORDER_NUMBER, C.ID, C.NAME -FROM ORDERS O CROSS JOIN CUSTOMERS C -on O.ID=C.ID; -1 -2 -3 -自连接 -连接自身表,需配合别名使用, - -select * from A a1, A a2 where a1.id=a2.id -1 -自然连接(natural join) -自然连接(Natural join)是一种特殊的等值连接,它要求两个关系中进行比较的分量必须是相同的属性组,并且在结果中把重复的属性列去掉。而等值连接并不去掉重复的属性列。 - -如:A中a,b,c字段,B中有c,d字段,则select * from A natural join B 相当于select A.a,A.b,A.c,B.d from A.c = B.c。 - -select * from A natural join B -select A.a,A.b,A.c,B.d from A.c = B.c -———————————————— -版权声明:本文为CSDN博主「鳄鱼儿」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 -原文链接:https://blog.csdn.net/Ber_Bai/article/details/118029011 -``` - diff --git "a/44\344\273\243\347\221\236/20230917\344\275\234\344\270\232.md" "b/44\344\273\243\347\221\236/20230917\344\275\234\344\270\232.md" deleted file mode 100644 index 304fef2d1a5c48923e05c867d115c689b3801fcf..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230917\344\275\234\344\270\232.md" +++ /dev/null @@ -1,164 +0,0 @@ -# 记 - -多注意表与表之间的关系 - -# 作业 - -[![img](https://s2.loli.net/2023/09/17/rfogCDWbZzHksUi.png)](https://gitee.com/link?target=https%3A%2F%2Fsm.ms%2Fimage%2FrfogCDWbZzHksUi) - -``` -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/17 18:11:14 */ -/*==============================================================*/ -create database qiche charset utf8; -use qiche; - -drop table if exists automobile; - -drop table if exists client; - -drop table if exists record; - -drop table if exists salesman; - -/*==============================================================*/ -/* Table: automobile */ -/*==============================================================*/ -create table automobile #汽车 -( - a_id int(3) not null auto_increment, #汽车编号 - a_name varchar(10) not null, #汽车名称 - a_sellingprice decimal(7,1) not null, #汽车售价 - a_brand varchar(10) not null, #汽车品牌 - primary key (a_id) -); -insert into automobile values -(01,'五菱神光mini',20000.0,'五菱宏光'), -(02,'玛拉莎蒂2023',900000.0,'玛莎拉蒂'), -(03,'宝牛SUV',250000.0,'宝马'), -(04,'五菱宏光2077',10000.0,'五菱宏光'); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client #顾客 -( - c_id int(2) not null auto_increment, #顾客编号 - c_name varchar(10) not null, #顾客姓名 - c_sex varchar(2) not null, #顾客性别 - primary key (c_id) -); -insert into client values -(2001,'德莱厄斯','男'), -(2002,'塞恩','男'), -(2003,'蒙多','男'); -/*==============================================================*/ -/* Table: record */ -/*==============================================================*/ - - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman #销售员 -( - s_id int(2) not null auto_increment, #工号 - s_name varchar(5) not null, #姓名 - s_sex varchar(2) not null, #性别 - primary key (s_id) -); -insert into salesman values -(1001,'梦泪','男'), -(1002,'坤哥','男'), -(1003,'厄斐琉斯','男'); - -create table record #销售记录 -( - r_id int(2) not null auto_increment, #销售编号 - s_id int not null, #工号 - c_id int not null, #顾客编号 - a_id int not null, #汽车编号 - primary key (r_id) -); -insert into record values -(3001,1001,2002,02), -(3002,1002,2001,01), -(3003,1001,2002,03), -(3004,1003,2003,04); - -alter table record add constraint FK_Relationship_2 foreign key (s_id) - references salesman (s_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_3 foreign key (c_id) - references client (c_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_4 foreign key (a_id) - references automobile (a_id) on delete restrict on update restrict; - -- 1.查询特定销售员的销售记录 -SELECT - s.s_id 工号, - s_name 销售员, - r_id 销售编号, - a_name 汽车型号, - a_sellingprice 售价, - a_brand 汽车品牌 -FROM - salesman s - JOIN record r - JOIN automobile a ON s.s_id = r.s_id - AND a.a_id = r.a_id -WHERE - s.s_id =( - SELECT - s_id - FROM - salesman - WHERE - s_name = '梦泪' - ); - -- 2.查找销售记录中销售价格最高的汽车 - select a.* from record r join automobile a on r.a_id=a.a_id where r.a_id = (select a_id from automobile where a_brand=(select max(a_brand) from automobile)); - -- 3.统计某个销售员的销售总额 -SELECT - s_name 销售员, - sum(a_sellingprice) 销售总额 -FROM - salesman s - JOIN record r - JOIN automobile a ON s.s_id = r.s_id - AND a.a_id = r.a_id - group by s.s_name having s.s_name='梦泪'; - -- 4.根据客户信息查询其购买过的汽车 - select c_name 顾客,c_sex 性别,a_name 汽车型号, a_sellingprice 售价,a_brand 型号 from client c join record r join automobile a on c.c_id=r.c_id and r.a_id = a.a_id where c.c_name='塞恩'; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 -SELECT - a_brand 品牌, - count( r.a_id) 销售数量, - sum( a.a_sellingprice ) 销售总额 -FROM - record r - JOIN automobile a ON r.a_id = a.a_id -GROUP BY - a_brand; - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - SELECT - a_name 汽车型号, - a_brand 品牌, - r.a_id 销售数量, - a.a_sellingprice 销售总额 -FROM - record r - JOIN automobile a ON r.a_id = a.a_id where a.a_name='五菱神光mini'; - -- 8.统计每个销售员的销售数量 -SELECT - s_name 销售员, - count(r.a_id) 销售总额 -FROM - salesman s - JOIN record r - JOIN automobile a ON s.s_id = r.s_id - AND a.a_id = r.a_id - group by s.s_name; -``` \ No newline at end of file diff --git "a/44\344\273\243\347\221\236/20230920\344\275\234\344\270\232.md" "b/44\344\273\243\347\221\236/20230920\344\275\234\344\270\232.md" deleted file mode 100644 index accad4a556f9748cfb7e65ea63a4c4a2662dd7d5..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230920\344\275\234\344\270\232.md" +++ /dev/null @@ -1,803 +0,0 @@ -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- - --- Table structure for countries - --- ---------------------------- - -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of countries - --- ---------------------------- - -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- - --- Table structure for departments - --- ---------------------------- - -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of departments - --- ---------------------------- - -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- - --- Table structure for employees - --- ---------------------------- - -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of employees - --- ---------------------------- - -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- - --- Table structure for job_grades - --- ---------------------------- - -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of job_grades - --- ---------------------------- - -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- - --- Table structure for job_history - --- ---------------------------- - -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of job_history - --- ---------------------------- - -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- - --- Table structure for jobs - --- ---------------------------- - -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of jobs - --- ---------------------------- - -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- - --- Table structure for locations - --- ---------------------------- - -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of locations - --- ---------------------------- - -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- - --- Table structure for order - --- ---------------------------- - -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of order - --- ---------------------------- - -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- - --- Table structure for regions - --- ---------------------------- - -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of regions - --- ---------------------------- - -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- - --- View structure for emp_details_view - --- ---------------------------- - -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -select sum(salary*12*ifnull(commission_pct,0))+sum(salary*12) 工资总和 from employees; -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - -select distinct(job_id)from employees; - -# 3.查询工资大于12000的员工姓名和工资 -select last_name,salary from employees where salary>1200; - -# 4.查询员工号为176的员工的姓名和部门号 -select last_name,department_id from employees where employee_id=176; - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -select *from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -select last_name,salary from employees where salary not between 5000 and 1200; - - -# 2.选择在20或50号部门工作的员工姓名和部门号 -select last_name,department_id from employees where department_id in(20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id -select last_name,job_id from employees where manager_id is null; - - - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -select e.last_name,e.salary,j.grade_level from employees e join job_grades j on e.salary between j.lowest_sal and j.highest_sal where commission_pct is not null; - - - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select *from employees where last_name like '__尔%'; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -select *from employees where last_name like '%尔%' or last_name like '%特%'; - - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -select *from employees where first_name like '__尔%'; - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -select last_name,job_id from employees where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select last_name,salary,manager_id from employees where manager_id in(100,101,110); - - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select last_name,department_id,salary*ifnull(commission_pct,1)*12 工资总和 from employees order by 工资总和 desc; -# - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -select last_name,salary from employees where salary not between 8000 and 17000 order by salary desc limit 20,20; - - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select * from employees where email like '%e%' order by length(email) desc,department_id asc; - - - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -select * from employees e ,departments d where e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id -select j.job_id,d.location_id,e.department_id,d.location_id from departments d,jobs j,employees e where e.job_id=j.job_id and d.department_id=e.department_id and e.department_id=90 or d.location_id=90; - - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city -select e.last_name,d.location_id ,d.department_name ,l.city from - departments d,locations l,employees e where e.department_id=d.department_id and d.location_id=l.location_id and commission_pct is not null; - - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select e.last_name,e.job_id,d.department_name ,d.department_id from - departments d,locations l,employees e where e.department_id=d.department_id and d.location_id=l.location_id and l.city='多伦多'; - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 -select department_name,street_address,last_name,salary,e.job_id,j.job_title from departments d, locations l,employees e,jobs j where e.department_id=d.department_id and d.location_id=l.location_id and e.job_id=j.job_id; - - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 -select e.last_name 员工姓名, e.employee_id 员工号,em.last_name 姓名, em.employee_id 员工号 from employees e,employees em where e.department_id=em.department_id and em.manager_id; - - - -# 7.查询哪些部门没有员工 - select department_name 部门名称 from departments d left join employees e on d.department_id = e.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - select city 没有部门的城市 from locations where location_id not in - (select distinct(location_id) from departments); - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - select * from employees where department_id in - (select department_id from departments where department_name in('销售部','信息技术部')); - - - - -# 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees ; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - select j.job_id, max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 - from jobs j left join employees e on j.job_id = e.job_id group by j.job_id; - -#4.选择各个job_id的员工人数 - select j.job_id,count(j.job_id) from jobs j left join employees e on j.job_id = e.job_id group by j.job_id; - -# 5.查询员工最高工资和最低工资的差距 - select max(salary)-min(salary) 最高工资和最低工资的差距 from employees ; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - select e1.manager_id,min(e1.salary) 最低工资 - from employees e1 right join employees e2 on e1.manager_id = e2.employee_id - where e1.salary >6000 group by e1.manager_id - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - select d.department_name 部门名,d.location_id,count(e.department_id) 员工数量,avg(e.salary) 平均工资 - from employees e right join departments d on e.department_id = d.department_id - group by d.department_id order by 平均工资 desc - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - select d.department_name 部门名,j.job_title 工种名,min(e.salary) 最低工资 from jobs j right join employees e on j.job_id = e.job_id left join departments d on e.department_id = d.department_id group by j.job_id,d.department_id; - - - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - select last_name 员工姓名,salary 工资 from employees where department_id = - (select department_id from employees where last_name = '兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - #select l.location_id, avg(e.salary) 平均工资 from locations l right join departments d on l.location_id = d.location_id left join employees e on d.department_id = e.department_id group by l.location_id; - - select employee_id,first_name,salary from employees where salary>(select avg(salary) from employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - select last_name, job_id, salary from employees where salary > - (select max(e.salary) from jobs j left join employees e on j.job_id = e.job_id where j.job_id = 'SA_MAN'); - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - #select * from employees where last_name like '' -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - select employee_id 员工号 from employees where department_id in - (select department_id from departments where location_id = 1700); - -#6.查询管理者是 金 的员工姓名和工资 - select last_name 姓名,salary 工资 from employees where manager_id in - (select employee_id from employees where last_name = '金'); - -#7.查询工资最低的员工信息: last_name, salary - select last_name,salary from employees where salary = - (select min(salary) from employees); - - - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - # 连表查 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - # 子查询 - select d.*,a.平均工资 from departments d right join - (select department_id,avg(salary) 平均工资 from employees group by department_id having avg(salary) = - (select avg(salary) 平均工资 from employees group by department_id order by 平均工资 limit 0,1)) a - on d.department_id = a.department_id; - - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 - select j.*,avg(e.salary) 平均工资 - from jobs j right join employees e on j.job_id = e.job_id group by j.job_id order by 平均工资 desc limit 0,1; - -#11.查询平均工资高于公司平均工资的部门有哪些? - select d.department_name 部门名,avg(e.salary) 平均工资 - from departments d right join employees e on d.department_id = e.department_id - group by d.department_id having 平均工资 > (select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - select * from employees where employee_id in - (select distinct(a.employee_id) from - (select e2.* from employees e1 left join employees e2 on e1.manager_id = e2.employee_id) a); - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - select * from employees where employee_id in - (select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - select min(e.salary) 最低工资 from employees e right join - (select department_id,max(salary) 最高工资 from employees group by department_id order by 最高工资 limit 0,1) a - on e.department_id = a.department_id ; - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - select last_name, department_id, email, salary from employees where employee_id = - (select employee_id from employees e right join - (select department_id,avg(salary) 平均工资 from employees group by department_id order by 平均工资 desc limit 0,1) a - on e.department_id = a.department_id limit 0,1); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - select job_id from jobs where job_id != 'ST_CLERK'; - -#16. 选择所有没有管理者的员工的last_name - select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - select * from employees where last_name = 'De Haan' - -#方式2: - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - select e.employee_id 员工号,e.last_name 姓名,e.salary 工资,a.平均工资 from employees e left join - (select department_id,avg(salary) 平均工资 from employees group by department_id) a - on e.department_id = a.department_id and e.salary > a.平均工资; - -#方式2:在FROM中声明子查询 - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - select department_name from departments where department_id in - (select distinct department_id from employees where employee_id in - (select manager_id from employees group by manager_id having count(manager_id)>5)); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - select country_id from locations where location_id in - (select location_id from departments group by location_id having count(location_id) > 2); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ \ No newline at end of file diff --git "a/44\344\273\243\347\221\236/20230921\344\275\234\344\270\232 (2).md" "b/44\344\273\243\347\221\236/20230921\344\275\234\344\270\232 (2).md" deleted file mode 100644 index dded0823576b5488cd76c8e0b410218469b35a36..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230921\344\275\234\344\270\232 (2).md" +++ /dev/null @@ -1,148 +0,0 @@ -# 笔记 - -## SKU (Stock Keeping Unit) - -SKU的英文是 stock keeping unit(库存单位),**SKU即库存进出计量的单位**,可以是以件、盒、托盘等为单位;在服装、鞋类商品中使用最多最普遍。 - - - -## SPU (Standard Product Unit) - -SPU概念的出现,是为了满足在**叶子类目下对商品进行进一步抽象的需求**。 - -用手机举例子,一般来说,手机就是叶子类目,那么我能不能添加几个苹果手机/华为手机的类目呢? - -当然可以,但是这样类目树就会变得非常庞大,所以,SPU是在「对商品约束进一步细化的需求」中各方平衡的结果。 - -SPU(Standard Product Unit) 标准产品单元,是对某一类标准产品的共同特征属性的描述,是商品信息共有属性的一种抽取,在淘系商品中,SPU是由后台类目+一组关键类目属性唯一确定。 - -**SPU 是一个介于叶子类目和商品之间的概念**, 是对类目的细化,是商品标准化运营的基础。 - -# 作业 - -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 17:16:09 */ -/*==============================================================*/ - -create database if not exists computer charset utf8; - -use computer; - -drop table if exists attribute; - -drop table if exists `database`; - -drop table if exists goods; - -drop table if exists parameter; - -drop table if exists size; - -/*==============================================================*/ -/* Table: attribute 属性 */ -/*==============================================================*/ -create table attribute -( - attribute!!ID int not null auto_increment, - attribute!!name varchar(12) not null, - primary key (attribute!!ID) -); - -/*==============================================================*/ -/* Table: "database" 数据 */ -/*==============================================================*/ -create table `database` -( - ID char(10) not null, - size_id int, - attribute!!ID int, - parameter_id int, - primary key (ID) -); - -/*==============================================================*/ -/* Table: goods 商品 */ -/*==============================================================*/ -create table goods -( - goods_id int not null auto_increment, - goods_name varchar(50) not null, - goods_introduce varchar(50) not null, - primary key (goods_id) -); - -/*==============================================================*/ -/* Table: parameter 参数 */ -/*==============================================================*/ -create table parameter -( - parameter_id int not null auto_increment, - parameter_size varchar(15) not null, - primary key (parameter_id) -); - -/*==============================================================*/ -/* Table: size 规格 */ -/*==============================================================*/ -create table size -( - size_id int not null auto_increment, - goods_id int, - size_name varchar(50) not null, - number int not null, - price decimal(6,2) not null, - primary key (size_id) -); - -alter table `database` add constraint FK_attributer_database foreign key (attribute!!ID) - references attribute (attribute!!ID) on delete restrict on update restrict; - -alter table `database` add constraint FK_parameter_database foreign key (parameter_id) - references parameter (parameter_id) on delete restrict on update restrict; - -alter table `database` add constraint FK_size_database foreign key (size_id) - references size (size_id) on delete restrict on update restrict; - -alter table size add constraint FK_goods_size foreign key (goods_id) - references goods (goods_id) on delete restrict on update restrict; - - -insert into goods values -(1,'华为mateBook','遥遥领先'), -(2,'MacBook Air5','M2芯片强势驱动电池续航最长达18小时'), -(3,'华硕ROG','高校性能游戏本'); - -insert into `size` values -(1,1,'华为MateBook15',20,1049.00), -(2,2,'MacBook Air5',25,1049.00), -(3,2,'ROG幻16',25,1449.00); - -insert into attribute values -(1,'颜色'), -(2,'参数'); - -insert into parameter values -(1,'黑色'), -(2,'白色'), -(3,'256G'), -(4,'1TB'); - -insert into `database`values -(1,1,1,1), -(2,1,1,2), -(3,1,2,3), -(4,1,2,4), -(5,2,1,1), -(6,2,1,2), -(7,2,2,3), -(8,2,2,4), -(9,3,1,1), -(10,3,1,2), -(11,3,2,3), -(12,3,2,4); -``` - - - diff --git "a/44\344\273\243\347\221\236/20230921\344\275\234\344\270\232.md" "b/44\344\273\243\347\221\236/20230921\344\275\234\344\270\232.md" deleted file mode 100644 index bcfe6d5770f294391b1841d3a35d7f047139f0a7..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230921\344\275\234\344\270\232.md" +++ /dev/null @@ -1,39 +0,0 @@ -## 笔记 - -**RBAC的优缺点** - -RBAC模型没有提供操作顺序控制机制。这一缺陷使得RBAC模型很难应用关于那些要求有严格操作次序的实体系统。 - -例如,在购物控制系统中要求系统对购买步骤的控制,在客户未付款之前不应让他把商品拿走。RBAC模型要求把这种控制机制放到模型 - -2. 实用的RBAC模型的**[数据库](https://link.zhihu.com/?target=http%3A//lib.csdn.net/base/mysql)**建模 - -以下模型均来自于互联网 - -1、扩展RBAC用户角色权限设计方案 - -RBAC(Role-Based Access Control,基于角色的访问控制),就是用户通过角色与权限进行关联。简单地说,一个用户拥有若干角色,每一个角色拥有若干权限。这样,就构造成“用户-角色-权限”的授权模型。在这种模型中,用户与角色之间,角色与权限之间,一般者是多对多的关系。(如下图) - -![img](https://pic2.zhimg.com/80/v2-b8ba22fa7f4e29f99242f2cae4cf06a5_1440w.webp) - - -角色是什么?可以理解为一定数量的权限的集合,权限的载体。例如:一个论坛系统,“超级管理员”、“版主”都是角色。版主可管理版内的帖子、可管理版内的用户等,这些是权限。要给某个用户授予这些权限,不需要直接将权限授予用户,可将“版主”这个角色赋予该用户。 -当用户的数量非常大时,要给系统每个用户逐一授权(授角色),是件非常烦琐的事情。这时,就需要给用户分组,每个用户组内有多个用户。除了可给用户授权外,还可以给用户组授权。这样一来,用户拥有的所有权限,就是用户个人拥有的权限与该用户所在用户组拥有的权限之和。(下图为用户组、用户与角色三者的关联关系) - -![img](https://pic4.zhimg.com/80/v2-b37163ab56dd766dcd7c183eef6dab4f_1440w.webp) - - -在应用系统中,权限表现成什么?对功能模块的操作,对上传文件的删改,菜单的访问,甚至页面上某个按钮、某个图片的可见性控制,都可属于权限的范畴。有些权限设计,会把功能操作作为一类,而把文件、菜单、页面元素等作为另一类,这样构成“用户-角色-权限-资源”的授权模型。而在做数据表建模时,可把功能操作和资源统一管理,也就是都直接与权限表进行关联,这样可能更具便捷性和易扩展性。(见下图) - -![img](https://pic3.zhimg.com/80/v2-1195c2ed6cb1838081182be93b68f7f6_1440w.webp) - - -请留意权限表中有一列“权限类型”,我们根据它的取值来区分是哪一类权限,如“MENU”表示菜单的访问权限、“OPERATION”表示功能模块的操作权限、“FILE”表示文件的修改权限、“ELEMENT”表示页面元素的可见性控制等。 -这样设计的好处有二。其一,不需要区分哪些是权限操作,哪些是资源,(实际上,有时候也不好区分,如菜单,把它理解为资源呢还是功能模块权限呢?)。其二,方便扩展,当系统要对新的东西进行权限控制时,我只需要建立一个新的关联表“权限XX关联表”,并确定这类权限的权限类型字符串。 -这里要注意的是,权限表与权限菜单关联表、权限菜单关联表与菜单表都是一对一的关系。(文件、页面权限点、功能操作等同理)。也就是每添加一个菜单,就得同时往这三个表中各插入一条记录。这样,可以不需要权限菜单关联表,让权限表与菜单表直接关联,此时,须在权限表中新增一列用来保存菜单的ID,权限表通过“权限类型”和这个ID来区分是种类型下的哪条记录。 -到这里,RBAC权限模型的扩展模型的完整设计图如下: - -![img](https://pic2.zhimg.com/80/v2-4f84828a3f1f835f8d34bd82dcf8b255_1440w.webp) - - -随着系统的日益庞大,为了方便管理,可引入角色组对角色进行分类管理,跟用户组不同,角色组不参与授权。例如:某电网系统的权限管理模块中,角色就是挂在区局下,而区局在这里可当作角色组,它不参于权限分配。另外,为方便上面各主表自身的管理与查找,可采用树型结构,如菜单树、功能树等,当然这些可不需要参于权限分配 \ No newline at end of file diff --git "a/44\344\273\243\347\221\236/20230922\344\275\234\344\270\232.md" "b/44\344\273\243\347\221\236/20230922\344\275\234\344\270\232.md" deleted file mode 100644 index 5e8df35bf5c8abe4b6b8b0a459d1e2db27562b56..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230922\344\275\234\344\270\232.md" +++ /dev/null @@ -1,59 +0,0 @@ -# 笔记 - -商品管理系统是电商系统中核心系统。商品管理又可以分为商品品类管理模块、SPU与SKU管理、商品资质管理、商品属性管理、商品价格管理、商品库存的管理等等。 - -首先先区分一个商品的概念,spu和sku: - -- **SPU**:标准化产品单元(Standard Product Unit),是商品信息聚合的最小单位,是一组可复用标准化信息的集合,主要也是为了在交易端对一组同类型商品做页面的聚合展示,解决的是一品多型号多规格等等多属性的问题; -- **SKU**:最小的库存单位(StockKeeping Unit),sku是库存存贮的最小单位,商品的进货、销售、售价、库存等最终都是打在sku身上的,最终的交易都决定在一个sku个体上; -- **标准商品(cspu/mku)**:对于标准商品,行业内不同系统不同领域叫法可能会有差异,有的叫cspu,有的叫mku,这个概念一般是在大型的电商系统中才会用到,解决的是一品多商的问题,比如A商家、B商家、C商家……(以下省略N个商家)都售卖同一种商品abc,从同一个品牌商那里进货,那用户搜索abc的时候,会出来N个商品的搜索结果,以及N的相关商品的搜索结果,没有聚合展示,对用户选品带来困扰。标品就是将这N个商品的搜索结果做聚合,仅展示标准商品,便于用户选品。 - -spu和sku是一对多的关系,一个spu对应多个sku,spu与sku是有各自的编码规则: - -比如对于这个移动硬盘(spu),销售属性颜色款式有10种,容量有10种,对应这个spu一共有10*10=100个sku,sku是一般是根据spu的销售属性组合(笛卡尔乘积的关系) - -![img](https://pic3.zhimg.com/80/v2-09a428d4f831e2f5a8d1ae6f1a515476_1440w.webp) - -电商平台上商品销售属性 - -不同的商品有不同的销售属性,对于一个spu,有的只有一维销售属性,有的是多维销售属性(见上图),所以一个spu下sku的数量一般为多维销售属性数量的乘积。 - -![img](https://pic3.zhimg.com/80/v2-12aaeb624287a2ab7a3b82760d99d546_1440w.webp) - -只有一维销售属性的商品 - -在创建新商品的时候,如果发布的是spu,发布页面需要让用户设置填写销售属性,有的还需要用户填写销售属性的展示顺序,比如是颜色优先级高还是尺码优先级高; - -发布spu时,商品的公共信息只用填写一遍,比如品牌、商品名称、商品单位、商品详情图、商品展示图等等,对于商品的销售属性,是需要针对不同的类型分别设置,在用户的感知上,只是发布了一个商品(spu),但实际上,提交后是发布的多个sku,这些sku对于公共部分的商品信息是共用的,仅对于销售属性是有差异的。sku上面还会单独设置对应的价格、库存等信息。 - -![img](https://pic3.zhimg.com/80/v2-6596a21ee05f1d32b311b2098d0b0c16_1440w.webp) - -图片来自网络 - -由于sku是根据spu的销售属性不同而生成的,所以sku的很多信息都是继承于spu(除库存、价格等); - -有的电商系统中可以支持用户发布spu,也可以支持发布单个的sku,单个发布sku目的是增加商品的曝光率、排名等等,是商家为了增加销量采取的方式,让用户更直接的看到其商品,直接点击搜索结果的商品,就是针对这个商品的页面。 - -![img](https://pic4.zhimg.com/80/v2-5113e620e297a7a95c1274a33a8341f3_1440w.webp) - -没有销售属性的商品 - -但单个sku发布的缺点就是像服装这一类的商品,销售属性可能比较多,不同尺码不同颜色不同材质的全部铺开展示出来,用户在查看搜索结果感觉检索结果都是同样的类似的商品,对于选品来说是不好的体验; - -标准商品(cspu/mku)和sku的关系也是一对多的关系,但标准商品一般不是商家在发品的时候就决定的,标准商品一般是电商平台对数据做聚合,平台做自己的标准商品的标品库。 - -![img](https://pic4.zhimg.com/80/v2-cf0db7e421b636150c587215142c11df_1440w.webp) - -标品与交易无关,不存在和商家的关系,没有物权,数据是相对标准的。但对于spu和sku,是用来做交易的,有商家的关联关系,有所属的物权。 - -标品也有自己编码,将有关系的sku关联起来 - -标准商品的来源一般有几种: - -- 品牌商直接提供标品数据,这部分品牌商一般是行业内权威或行业内源头厂商,他们的商品数据相对而言比较标准及完善,可以直接对接使用; -- 国家有一些单位有建设某个行业或某种类型的商品的标品库,可以跟这部分标品库对接; -- 平台对自有的商品的数据做清晰,形成自己的标品库; - -标准商品主要解决的是一品多商的问题,多个商家卖同一个商品的时候,页面做一定维度的聚合展示,仅展示这一类商品的标品,用户只用查看标品信息就可以确定是否是自己要找的商品,然后再确定需要哪一个商家的sku,确定sku的规则和很多维度也有关系,比如地域、价格等等信息有关,平台一般有算法团队去根据不同维度的权重做决策。 - -在展示维度上,spu和mku是两个维度,要如何同时展示或者是展示哪一个维度,需要根据平台的定位及交易方式确定。 \ No newline at end of file diff --git "a/44\344\273\243\347\221\236/20230926\350\247\206\345\233\276.md" "b/44\344\273\243\347\221\236/20230926\350\247\206\345\233\276.md" deleted file mode 100644 index 6dce28cb1ba80d32fcb2a4ae958a988d8000cd62..0000000000000000000000000000000000000000 --- "a/44\344\273\243\347\221\236/20230926\350\247\206\345\233\276.md" +++ /dev/null @@ -1,447 +0,0 @@ -# 笔记 - -1.1 视图的概念 -视图是一个虚拟表,其内容由查询定义。同真实的表一样,视图包含一系列带有名称的列和行数据。但是,数据库中只存放了视图的定义,而并没有存放视图中的数据,这些数据存放在原来的表中。使用视图查询数据时,数据库系统会从原来的表中取出对应的数据。因此,视图中的数据是依赖于原来的表中的数据的。一旦表中的数据发生改变,显示在视图中的数据也会发生改变。同样对视图的更新,会影响到原来表的数据。 - -视图是存储在数据库中的查询的SQL语句,它主要出于两种原因:安全原因,视图可以隐藏一些数据,例如,员工信息表,可以用视图只显示姓名、工龄、地址,而不显示社会保险号和工资数等;另一个原因是可使复杂的查询易于理解和使用。这个视图就像一个“窗口”,从中只能看到你想看的数据列。这意味着你可以在这个视图上使用SELECT *,而你看到的将是你在视图定义里给出的那些数据列。 - -1.2 视图的作用 -视图是在原有表或者视图的基础上重新定义的虚拟表,这可以从原有的表上选取对用户有用的信息,忽略次要信息,其作用类似于筛选。视图的作用归纳为如下几点: - -使操作简单化 -视图需要达到的目的就是所见即所需。视图不仅可以简化用户对数据的理解,也可以简化他们的操作。那些被经常使用的查询可以被定义为视图,从而使得用户不必为以后的操作每次指定全部的条件。 - -2.增加数据的安全性 - -通过视图,用户只能查询和修改指定的数据。指定数据之外的信息,用户根本接触不到。这样可以防止敏感信息被未授权的用户查看,增强机密信息的安全性。 - -3.提高表的逻辑独立性 - -视图可以屏蔽原有表结构变化带来的影响。例如原有表增加列和删除未被引用的列,对视图不会造成影响。同样,如果修改表中的某些列,可以使用修改视图来解决这些列带来的影响。 - -2. 视图的基本操作 -2.1 创建视图 -创建视图是指在已经存在的数据库表上建立视图。视图可以建立在一张表中,也可以建立在多张表中。 - -查看创建视图的权限 - -创建视图需要具有CREATE VIEW的权限。同时应该具有查询涉及的列的SELECT权限。可以使用SELECT语句来查询这些权限信息。查询语法如下: - -SELECT Select_priv,Create_view_priv FROM mysql.user WHERE user='用户名'; -参数说明: - -(1)Select_priv:属性表示用户是否具有SELECT权限,Y表示拥有SELECT权限,N表示没有。 - -(2)Create_view_priv:属性表示用户是否具有CREATE VIEW权限; - -(3)mysql.user:表示MySQL数据库下面的user表。 - -(4)用户名:参数表示要查询是否拥有权限的用户,该参数需要用单引号引起来。 - -示例:查询MySQL中root用户是否具有创建视图的权限。 - -MySQL中,创建视图是通过CREATE VIEW语句实现的。其语法如下: - -CREATE [OR REPLACE] [ALGORITHM={UNDEFINED|MERGE|TEMPTABLE}] -VIEW 视图名[(属性清单)] -AS SELECT语句 -[WITH [CASCADED|LOCAL] CHECK OPTION]; -参数说明: - -(1)ALGORITHM:可选项,表示视图选择的算法。 - -(2)视图名:表示要创建的视图名称。 - -(3)属性清单:可选项,指定视图中各个属性的名词,默认情况下与SELECT语句中的查询的属性相同。 - -(4)SELECT语句:表示一个完整的查询语句,将查询记录导入视图中。 - -(5)WITH CHECK OPTION:可选项,表示更新视图时要保证在该视图的权限范围之内。 - -例:创建视图。 - -CREATE VIEW view_student AS SELECT id,name,class FROM student; -例:创建视图同时,指定属性清单。 -CREATE VIEW view_student1(stu_id,stu_name,stu_class) AS SELECT id,name,class FROM student; - -CREATE OR REPLACE VIEW view_student1(stu_id,stu_name,stu_class) AS SELECT id,name,class FROM student; -创建视图时需要注意以下几点: -(1)运行创建视图的语句需要用户具有创建视图(create view)的权限,若加了[or replace]时,还需要用户具有删除视图(drop view)的权限; - -(2)select语句不能包含from子句中的子查询; - -(3)select语句不能引用系统或用户变量; - -(4)select语句不能引用预处理语句参数; - -(5)在存储子程序内,定义不能引用子程序参数或局部变量; - -(6)在定义中引用的表或视图必须存在。但是,创建了视图后,能够舍弃定义引用的表或视图。要想检查视图定义是否存在这类问题,可使用check table语句; - -(7)在定义中不能引用temporary表,不能创建temporary视图; - -(8)在视图定义中命名的表必须已存在; - -(9)不能将触发程序与视图关联在一起; - -(10)在视图定义中允许使用order by,但是,如果从特定视图进行了选择,而该视图使用了具有自己order by的语句,它将被忽略。 - -2.2 修改视图 -修改视图是指修改数据库中已存在的表的定义。当基本表的某些字段发生改变时,可以通过修改视图来保持视图和基本表之间一致。MySQL中通过CREATE OR REPLACE VIEW语句和ALTER VIEW语句来修改视图。 - -示例:修改视图 - -mysql> CREATE OR REPLACE -VIEW view_student1(stu_id,stu_name,stu_class) AS SELECT id,name,class FROM student; -Query OK, 0 rows affected - - -mysql> select * from view_student1; -+--------+----------+-----------+ -| stu_id | stu_name | stu_class | -+--------+----------+-----------+ -| 1001 | Jason | 1 | -| 1002 | Helen | 3 | -| 1003 | Steve | 5 | -| 1004 | Hanna | 1 | -| 1005 | Bob | 3 | -| 1006 | John | 7 | -| 1007 | Walln | 8 | -+--------+----------+-----------+ -7 rows in set - - - -mysql> ALTER VIEW view_student1 AS SELECT id,name,class FROM student where id in (select id from student ); -Query OK, 0 rows affected - -mysql> select * from view_student1; -+------+-------+-------+ -| id | name | class | -+------+-------+-------+ -| 1001 | Jason | 1 | -| 1002 | Helen | 3 | -| 1003 | Steve | 5 | -| 1004 | Hanna | 1 | -| 1005 | Bob | 3 | -| 1006 | John | 7 | -| 1007 | Walln | 8 | -+------+-------+-------+ -7 rows in set -说明:ALTER VIEW语句改变了视图的定义,该语句与CREATE OR REPLACE VIEW语句有着同样的限制,如果删除并重新创建一个视图,就必须重新为它分配权限。 -2.3 删除视图 -删除视图是指删除数据库中已存在的视图。删除视图时,只能删除视图的定义,不会删除数据。MySQL中,使用DROP VIEW语句来删除视图。但是,用户必须拥有DROP权限。 - -例:删除视图。 - -DROP VIEW IF EXISTS view_student; -2.4 查看视图 -查看视图是指查看数据库中已存在的视图的定义。 - -例:查看视图。 - -mysql> describe view_student; -+-------+-------------+------+-----+---------+-------+ -| Field | Type | Null | Key | Default | Extra | -+-------+-------------+------+-----+---------+-------+ -| id | int(11) | NO | | NULL | | -| name | varchar(30) | YES | | NULL | | -| class | int(10) | YES | | NULL | | -+-------+-------------+------+-----+---------+-------+ -3 rows in set -———————————————— - -``` mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db - -********************************************************************* - -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -create view employees_vu as -select last_name 姓名, employee_id 员工号, department_id 部门号 from employees; - - - -#2. 显示视图的结构 - -desc employees_vu; -#3. 查询视图中的全部内容 -show create view employees_vu; -CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `employees_vu` AS select `employees`.`last_name` AS `姓名`,`employees`.`employee_id` AS `员工号`,`employees`.`department_id` AS `部门号` from `employees` utf8mb4 utf8mb4_0900_ai_ci -#4. 将视图中的数据限定在部门号是80的范围内 -alter view employees_vu as select last_name 姓名, employee_id 员工号, department_id 部门号 from employees -where department_id<=80; -select * from employees_vu; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -create or replace view emp_v1 as select last_name 员工姓名, salary 工资, email 邮箱 from employees where phone_number like '011%'; - -select * from emp_v1; -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -create or replace view emp_v1 as select last_name 员工姓名, salary 工资, email 邮箱, phone_number 电话号码 from employees where phone_number like '011%' and email like '%e%'; -select * from emp_v1; - -#3. 向 emp_v1 插入一条记录,是否可以? - -#不可以 - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 - -select * from emp_v1; -UPDATE emp_v1 set 工资 = 工资 + 1000; -#5. 删除emp_v1中姓名为Olsen的员工 -delete FROM emp_v1 where 员工姓名='Olsen'; -select * from emp_v1 where 员工姓名='Olsen'; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -create or replace view emp_v2 as select department_id,max(salary) from employees GROUP BY department_id having max(salary)>12000; - - -#7. 向 emp_v2 中插入一条记录,是否可以? -不可以 - - -#8. 删除刚才的emp_v2 和 emp_v1 -DROP view emp_v1; -DROP view emp_v2; -``` - diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230905 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\200\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" "b/47 \346\250\212\345\260\217\351\203\255/20230905 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\200\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" deleted file mode 100644 index b32608aaf04fe2800fe0078cb2a5b7bc5278e220..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230905 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\200\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" +++ /dev/null @@ -1,43 +0,0 @@ -# 数据库高级第一次课堂笔记 - -### 大二的学习任务 - -上半段: - -1.MySQL数据库高级; - -2.JavaScript原生js(Ajax)做了一些封装成一些框架; - -3.MVC框架(Maven,Spring,SpringMVC,MyBatis); - -下半段: - -4.Mode.js v8引擎; - -5.vue.js前端框架,易化开发,有UI框架配合,美团、饿了么: element-ui,UI框架; - -6.SpringBoot(Redis,WebApi)非关系型 No-SQL key-value键值对的形式存在 - - - -### 实训期间 - -1.Linux服务器:Nginx,MongoDB非关系型; - -2.项目中可能实现的技术:中间件,鉴权; - -3.小程序 uniapp移动端开发 - - - -### 查找文献及自主学习的网站推荐 - -1.qithub - -2.掘金 - -3.B站 - - - -### 总结:大二虽然看上去课程不多,但是需要自学的功课还有很多,不要虚度光阴。 \ No newline at end of file diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230906 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\272\214\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" "b/47 \346\250\212\345\260\217\351\203\255/20230906 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\272\214\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" deleted file mode 100644 index 515d481cf2c2f86050b1a61222ea3c0bb82a5412..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230906 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\272\214\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" +++ /dev/null @@ -1,40 +0,0 @@ -# 数据库高级第二次课堂笔记 - -### 数据库设计:根据用户需求和开发的系统的需求,设计出符合对应的DBMS的需求的数据库结构,使其能有效的存储和管理数据 - - - -例题:开发一个学生信息管理系统,用来管理学生,课程,教师三者,入其延伸出的数据 - - 提示:关系是相互的(一个学生,可以选多个课程,一个课程可以被多个学生选,必须引用第三张表) - - - -### 表之间的关系 - -1.一对一的关系:将其中任一表中主键,放到另一个表当外键; - -2.一对多的关系:将一所在的表的主键,放到多的表当外键; - -3.多对多的关系:必须第三张表,将前面两个表的主键放进来当外键 - - - -### 数据库设计的方法 - -1.直观设计法; - -2.规范设计法:E-R模型; - -3.计算机辅助设计法:PowerDesigner - - - -### E-R图 - -E-R图:实体关系图 - -要素:实体(表)、属性(字段)、关系(类似外键约束) - -绘图软件推荐:visio等 - diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230907 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\211\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" "b/47 \346\250\212\345\260\217\351\203\255/20230907 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\211\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" deleted file mode 100644 index c8ee732153b7618924cd3a881000647ad68fbef4..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230907 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\211\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" +++ /dev/null @@ -1,19 +0,0 @@ -# 数据库高级第三次笔记 - -### 数据库的范式 - -1.第一范式:要求字段的内容,不可再分割,为的是保证数据的原子性 - - 例子:省份,市,区或县,街道或乡镇(不可以直接笼统的写一个地址) - -2.第二范式:要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键,要依赖整个联合主键),而不能只依赖部分 - - 例子:小明的存在(不能单独存在),依赖于小明父亲的存在,还得依赖于小明母亲的存在 - -3.第三范式:满足于第二范式的前提上,要求,非关键属性要直接依赖于主键 - - 例1:儿子依赖于父亲,父亲依赖于爷爷(儿子直接依赖父亲,间接依赖爷爷) - - 例2:学生 班级 年级 院系(这几个不可以在同一张表上,因为学生间接依赖于年级(不可出现传递 依赖),应单独建年级表,院系表) - -补充:所谓几对几是表中数据相对,不是一整张表相对 \ No newline at end of file diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\345\233\233\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" "b/47 \346\250\212\345\260\217\351\203\255/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\345\233\233\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" deleted file mode 100644 index e1b0776b54ebc1c4e1c101c76cef9ec06fa4e20b..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230908 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\345\233\233\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" +++ /dev/null @@ -1,190 +0,0 @@ -# 数据库高级第四次课堂笔记 - -### 数据库设计步骤 - -1.先做需求分析,明确需要的数据; - -2.概念结构设计:E-R图或PowerDesigner - -3.逻辑结构设计 - -4.物理结构设计 - -5.数据库的实施 - -6.数据库的维护 - - - -### E-R图补充说明: - -1.visio制作ER图的一个软件 - -2.三要素:实体、属性、关系 - -3.图形表示: - - 实体:矩形,里面写实体名称; - - 属性:圆形和椭圆,里面写属性名称,用直接与实体相连,如果是属性,名称下加下划线; - - 关系:用菱形表示,里面写联系,再用直线与两个实体相连,并标明实体之间关系(一对多) - - - -### 概念模型 - -一个软件:PowerDesigner - -第一步,创建概念模型(类似ER图)CDM(以用户的角度) - -第二步,转换成逻辑模型 LDM(以计算机角度) - -第三步,转换成物理模型 PDM(以数据库角度) - -第四步,生成DDL - - - -### PowerDesigner中的单词 - -PowerDesigner Sybase的企业建模和设计解决方案 - -File 文件夹 - -New Model 新型号 - -Model 模型 - -Model types 模型类型 - -Conceptual Data Model 概念数据模型 - -Entity 实体 - -Attributes... 属性 - -Identifiers... 标识符 - -Format...总体安排;计划 - -Change Image...电荷图像 - -Disposition 排列;布置 - -Order 命令;指示 - -Edit 编辑 - -Renam 改名 - -Properties 性能;性质 - - - -# 作业 - -创建一个图书管理系统 - -~~~mysql - -create database books_01; -use books_01; - -drop table if exists Administrator; - -drop table if exists BookReturn; - -drop table if exists Borrow; - -drop table if exists books; - -drop table if exists bookshelf; - -drop table if exists borrower; - -drop table if exists floor; - -drop table if exists library; - - -create table Administrator -( - a_id int not null auto_increment, - l_id int not null, - a_job char(10) not null, - a_name char(5) not null, - a_age int not null, - a_sex char(1) not null, - a_tel char(11) not null, - primary key (a_id) -); - - -create table BookReturn -( - a_id int not null, - bor_id int not null, - bos_id int not null, - bo_id int not null, - f_id int not null, - ɕǚ date not null, - ʱݤ time not null -); - - -create table Borrow -( - bor_id int not null auto_increment, - bor_name char(5) not null, - bor_tel char(11) not null, - primary key (bor_id) -); - - -create table books -( - bos_id int not null auto_increment, - bo_id int not null, - bos_name char(20) not null, - bos_price decimal(5,2) not null, - bos_press char(10) not null, - primary key (bos_id) -); - -create table bookshelf -( - bo_id int not null auto_increment, - f_id int not null, - bo_name char(10) not null, - primary key (bo_id) -); - - -create table borrower -( - bos_id int not null, - bor_id int not null, - primary key (bos_id, bor_id) -); - - -create table floor -( - f_id int not null auto_increment, - l_id int not null, - f_floor int not null, - f_name char(10) not null, - primary key (f_id) -); - - -create table library -( - l_id int not null auto_increment, - l_name char(10) not null, - l_address varchar(50) not null, - l_p varchar(255) not null, - l_tel char(11) not null, - primary key (l_id) -); diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230912 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" "b/47 \346\250\212\345\260\217\351\203\255/20230912 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" deleted file mode 100644 index 5327fe19a509c7be9478386a4a52a5447d2e8089..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230912 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" +++ /dev/null @@ -1,173 +0,0 @@ -# 作业 - -用豆瓣评分里的电影页面制作一个数据库: - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 11:50:37 */ -/*==============================================================*/ - -create database - -drop table if exists actor; - -drop table if exists film_comment; - -drop table if exists movie; - -drop table if exists movie_comment; - -drop table if exists scriptwriter; - -drop table if exists sheet; - -drop table if exists short; - -drop table if exists user; - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - comment_id int not null, - movie_id int not null, - actor_name varchar(6) not null, - actor_gender char(1) not null, - actor_constellation varchar(3) not null, - actor_birthday date not null, - actor_birthplace varchar(10) not null, - actor_work varchar(10) not null, - actor_alias varchar(10) not null, - actor_family varchar(20) not null, - actor_intro varchar(100) not null, - primary key (comment_id, movie_id) -); - -/*==============================================================*/ -/* Table: film_comment */ -/*==============================================================*/ -create table film_comment -( - comment_id int not null auto_increment, - user_id int not null, - comment_name varchar(20) not null, - comment_title varchar(30) not null, - comment_time datetime not null, - comment_content varchar(500) not null, - comment_evaluate char(2) not null, - primary key (comment_id) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_id int not null auto_increment, - movie_name varchar(10) not null, - movie_country varchar(6) not null, - movie_language varchar(6) not null, - movie_date date not null, - movie_time varchar(5) not null, - movie_alias varchar(50) not null, - primary key (movie_id) -); - -/*==============================================================*/ -/* Table: movie_comment */ -/*==============================================================*/ -create table movie_comment -( - comment_id int not null, - movie_id int not null, - director_name char(10), - primary key (comment_id, movie_id) -); - -/*==============================================================*/ -/* Table: scriptwriter */ -/*==============================================================*/ -create table scriptwriter -( - comment_id int not null, - movie_id int not null, - scriptwriter_name varchar(10) not null, - primary key (comment_id, movie_id) -); - -/*==============================================================*/ -/* Table: sheet */ -/*==============================================================*/ -create table sheet -( - sheet_name varchar(10) not null, - sheet_recommend varchar(20), - sheet_id int not null auto_increment, - movie_id int not null, - primary key (sheet_id) -); - -/*==============================================================*/ -/* Table: short */ -/*==============================================================*/ -create table short -( - short_id int not null auto_increment, - movie_id int not null, - user_id int not null, - short_name varchar(20) not null, - short_score int not null, - short_tag varchar(50) not null, - short_content varchar(350) not null, - short_chose char(2) not null, - primary key (short_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - movie_id int not null, - user_name varchar(20) not null, - primary key (user_id) -); - -alter table actor add constraint FK_actor foreign key (comment_id) - references film_comment (comment_id) on delete restrict on update restrict; - -alter table actor add constraint FK_actor2 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table film_comment add constraint FK_Relationship_5 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table movie_comment add constraint FK_movie_comment foreign key (comment_id) - references film_comment (comment_id) on delete restrict on update restrict; - -alter table movie_comment add constraint FK_movie_comment2 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter foreign key (comment_id) - references film_comment (comment_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter2 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table sheet add constraint FK_Relationship_7 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table short add constraint FK_Relationship_4 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table short add constraint FK_Relationship_6 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table user add constraint FK_Relationship_11 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - - -``` \ No newline at end of file diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230913 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" "b/47 \346\250\212\345\260\217\351\203\255/20230913 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" deleted file mode 100644 index b4cd3a3484451a7e5c627a7e523d0f44043be40d..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230913 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" +++ /dev/null @@ -1,109 +0,0 @@ -# 作业 - -制作一个医院与病人之间的关系数据库 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 22:58:34 */ -/*==============================================================*/ - - -drop table if exists department; - -drop table if exists diagnose; - -drop table if exists doctor; - -drop table if exists hospital; - -drop table if exists pharmacy; - -drop table if exists sick; - -/*==============================================================*/ -/* Table: department */ -/*==============================================================*/ -create table department -( - d_id varchar(11) not null, - hospital_name varchar(10), - d_name varchar(11) not null, - d_tel varchar(15) not null, - d_address varchar(25) not null, - primary key (d_id) -); - -/*==============================================================*/ -/* Table: diagnose */ -/*==============================================================*/ -create table diagnose -( - "doctor-ID" varchar(15) not null, - "sick-IDcar" varchar(15) not null, - "drug-id" varchar(15), - "prescription-id" varchar(15) not null, - primary key ("doctor-ID", "sick-IDcar") -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - "doctor-ID" varchar(15) not null, - d_id varchar(11), - "doctor-name" char(4) not null, - "doctor-tel" varchar(15) not null, - primary key ("doctor-ID") -); - -/*==============================================================*/ -/* Table: hospital */ -/*==============================================================*/ -create table hospital -( - hospital_name varchar(10) not null, - primary key (hospital_name) -); - -/*==============================================================*/ -/* Table: pharmacy */ -/*==============================================================*/ -create table pharmacy -( - "drug-id" varchar(15) not null, - "drug-name" varchar(12) not null, - primary key ("drug-id") -); - -/*==============================================================*/ -/* Table: sick */ -/*==============================================================*/ -create table sick -( - "sick-name" char(4) not null, - "sick-age" int not null, - "sick-sex" char(1) not null, - "sick-tel" varchar(15) not null, - "sick-IDcar" varchar(15) not null, - primary key ("sick-IDcar") -); - -alter table department add constraint FK_Relationship_1 foreign key (hospital_name) - references hospital (hospital_name) on delete restrict on update restrict; - -alter table diagnose add constraint FK_Relationship_4 foreign key ("doctor-ID") - references doctor ("doctor-ID") on delete restrict on update restrict; - -alter table diagnose add constraint FK_Relationship_5 foreign key ("sick-IDcar") - references sick ("sick-IDcar") on delete restrict on update restrict; - -alter table diagnose add constraint FK_Relationship_6 foreign key ("drug-id") - references pharmacy ("drug-id") on delete restrict on update restrict; - -alter table doctor add constraint FK_Relationship_2 foreign key (d_id) - references department (d_id) on delete restrict on update restrict; - -``` - diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230914 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\272\224\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" "b/47 \346\250\212\345\260\217\351\203\255/20230914 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\272\224\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" deleted file mode 100644 index bad3a7b63184656364eaa740e96e4d00451cfb79..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230914 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\272\224\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" +++ /dev/null @@ -1,19 +0,0 @@ -# 数据库高级第五次课堂笔记 - -### 如何使用Power Designer - -打开PowerDesigner后,左上角点击File后选择New Model打开后选第二个Model types后选择Conceptual Data Model后选择ok随后开始建模 - - - -表中所谓几对几是表中数据相对,不是一整张表相对(表与表的关系) - - - -记住一句话:如果一个主体的属性有多个值,那这个属性就可以拆成一个新主体 - - - -# MySQL - -如果值是null,那么所有null参与的运算,返回值的结果也都是null。所以遇上null,却又必须让它参与运算,就使用ifnull(原值,新值)===》这个函数的作用,如果原值是null,就用新值代替,如果原值不null,就保持原值。 \ No newline at end of file diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230915 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" "b/47 \346\250\212\345\260\217\351\203\255/20230915 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" deleted file mode 100644 index 764cfdabf3fe9a60215edf15f1c5b8eba3811bff..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230915 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232.md" +++ /dev/null @@ -1,129 +0,0 @@ -# 作业 - -### 任务: - -- 给一个汽车商店设计销售系统的数据库 - -- 顶层实体:汽车、顾客、销售员 - -### 目标: - -- 完成概念模型、逻辑模型、物理模型 - -- 生成DDL SQL语句,建立对应数据库和表结构 - -- 模拟真实数据给每个表插入一些数据。并根据应用场景需求完成 DQL语句 - -### 需求: - -- 1.能记录在售车型的信息、销售员的基本信息、客户的基本信息 - -- 2.进行车辆售卖时,记录销售员、客户、销售日期、实际售卖价格等信息 - -- 3.满足实际应用场景下的数据查询功能 - - -### 应用场景: - -- 1.查询特定销售员的销售记录 - -- 2.查找销售记录中销售价格最高的汽车 - -- 3.统计某个销售员的销售总额 - -- 4.根据客户信息查询其购买过的汽车 - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - -- 8.统计每个销售员的销售数量 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 09:29:28 */ -/*==============================================================*/ -drop database if exists car; -create database if not exists car charset utf8; -use car; - - -drop table if exists car_brand; - -drop table if exists car_type; - -drop table if exists customer; - -drop table if exists sale_record; - -drop table if exists salesman; - -/*==============================================================*/ -/* Table: car_brand */ -/*==============================================================*/ -create table car_brand -( - car_brand_No int not null auto_increment, - car_brand_name char(10) not null, - primary key (car_brand_No) -); - -/*==============================================================*/ -/* Table: car_type */ -/*==============================================================*/ -create table car_type -( - car_No int not null auto_increment, - car_brand_No int, - car_name varchar(30) not null, - car_color char(2), - primary key (car_No) -); - -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - customer_No int not null auto_increment, - salesman_name char(10) not null, - salesman_gender char(1), - salesman_age int, - salesman_tel numeric(11,0) not null, - primary key (customer_No) -); - -/*==============================================================*/ -/* Table: sale_record */ -/*==============================================================*/ -create table sale_record -( - sale_record_No int not null auto_increment, - customer_No int, - salesman_No2 int, - car_No int, - sale_fee decimal(9,2) not null, - sale_date date not null, - primary key (sale_record_No) -); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_No2 int not null auto_increment, - salesman_name char(10) not null, - salesman_gender char(1), - salesman_age int, - salesman_tel numeric(11,0) not null, - primary key (salesman_No2) -); - -alter table car_type add constraint FK_belong foreign key (car_brand_No) - references car_brand (car_brand_No) on delete restrict on update restrict; - -alter table sale_record add constraint FK_buy foreign key (customer_No) - references customer (customer_No) on delete restrict on update restrict; - -alter table sale_record add constraint FK_sale foreign key (salesman_No2) - references salesman (salesman_No2) on delete restrict on update restrict; - -alter table sale_record add constraint FK_work_off foreign key (car_No) - references car_type (car_No) on delete restrict on update restrict; - -- 1.查询特定销售员的销售记录 - -- 2.查找销售记录中销售价格最高的汽车 - -- 3.统计某个销售员的销售总额 - -- 4.根据客户信息查询其购买过的汽车 - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - -- 8.统计每个销售员的销售数量 -``` \ No newline at end of file diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230919 MySQL\345\244\215\344\271\240\351\242\230.md" "b/47 \346\250\212\345\260\217\351\203\255/20230919 MySQL\345\244\215\344\271\240\351\242\230.md" deleted file mode 100644 index 10ce4285542233a5b8287116819e0e17b2e827c4..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230919 MySQL\345\244\215\344\271\240\351\242\230.md" +++ /dev/null @@ -1,781 +0,0 @@ -# MySQL复习题 - -``` -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -create database zz charset utf8; -use zz; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; -``` - -# 题目 - -```mysql -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 -select sum(salary*12) from employees; -#理解2:计算12月的基本工资和奖金 -select sum((salary*12)+(salary * 12 * ifnull (commission_pct,0))) from employees; -# 2.查询employees表中去除重复的job_id以后的数据 -select distinct job_id from employees; - -# 3.查询工资大于12000的员工姓名和工资 -select first_name,salary from employees where salary > 12000; - -# 4.查询员工号为176的员工的姓名和部门号 -select first_name,department_id from employees where employee_id = "176"; - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -select first_name,salary from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 -select first_name,department_id from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id -select first_name,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select first_name,salary,commission_pct from employees where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select first_name from employees where first_name like "__尔"; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -select * from employees where last_name like "%特%" and last_name like "%尔%"; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select * from employees where first_name like "%尔"; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select first_name,job_id from employees where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select first_name,salary,manager_id from employees where manager_id in (100,101,110); - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select first_name,department_id,salary*12 nx from employees order by nx desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select first_name,salary from employees where salary not between 8000 and 17000 order by salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -select * from employees where email like "%e%" order by length(email) desc , department_id; - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 - -select first_name,a.department_id,b.department_name from employees a join departments b on a.department_id = b.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -select a.job_id,b.location_id from employees a -join departments b on a.department_id = b.department_id -where a.department_id = "90"; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select a.last_name,b.department_id,b.location_id,c.city from employees a -join departments b on a.department_id = b.department_id -join locations c on b.location_id = c.location_id -where commission_pct is not null; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select a.last_name,a.job_id,a.department_id,b.department_name from employees a -join departments b on a.department_id = b.department_id -join locations c on b.location_id = c.location_id -where c.city = "多伦多"; - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - - -select department_name 部门名称, city 部门地址, e.last_name 姓名, j.job_title 工作, e.salary 工资 -from employees e,departments d,locations l,jobs j -where e.department_id=d.department_id -and d.location_id=l.location_id -and j.job_id=e.job_id; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select a.first_name,a.department_id,b.manager_id,b.first_name from employees a join employees b on a.department_id = b.department_id; - -# 7.查询哪些部门没有员工 - -select * from employees where department_id is NULL; - -# 8. 查询哪个城市没有部门 - -select * from locations where state_province is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select * from employees e -join departments d on e.department_id = d.department_id -where d.department_name like '销售部' or d.department_name like '信息技术部'; - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary),min(salary),avg(salary),sum(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - - -select job_id,max(salary),min(salary),avg(salary),sum(salary) from employees group by job_id; -#4.选择各个job_id的员工人数 - -# 5.查询员工最高工资和最低工资的差距 - -select max(salary)-min(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - -select manager_id,min(salary) from employees -where salary > 6000 -group by manager_id -having manager_id is not null; - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select count(a.department_id) 员工数量,avg(a.salary) 平均工资 from employees a -join departments b on a.department_id = b.department_id -group by location_id -order by 平均工资 desc - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - -select min(a.salary) 最低工资,a.job_id 工种,c.job_title 工种名 from employees a -join departments b on a.department_id = b.department_id -join jobs c on a.job_id = c.job_id -group by a.job_id - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - - -select last_name,salary from employees where department_id = (select department_id from employees where last_name = "兹洛特基"); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - -select employee_id,last_name,salary from employees where salary > (select avg(salary) from employees) - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name,job_id,salary from employees where salary > (select min(salary) from employees where job_id = "sa_man") - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -## 姓名中文 X -select employee_id,last_name from where department_id = (select department_id from employees where last_name like "%u%") - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -select a.employee_id 员工号 from employees a -join departments b on a.department_id = b.department_id -join locations c on b.location_id = c.location_id -where b.location_id = (select location_id from locations where location_id = 1700) - - - -#6.查询管理者是 金 的员工姓名和工资 -select last_name,salary from employees where manager_id = (select employee_id from employees where last_name = "金" and manager_id is null); - - -#7.查询工资最低的员工信息: last_name, salary - - -select last_name,salary from employees where salary = (select min(salary) from employees); - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - - -select b.* from employees a -join departments b on a.department_id = b. department_id -where b.department_id = (select department_id from employees group by department_id order by avg(salary) limit 0,1); - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - --- 平均工资最低的部门 -select b.* from employees a -join departments b on a.department_id = b. department_id -where b.department_id = (select department_id from employees group by department_id order by avg(salary) limit 0,1); --- 该部门平均工资 -select department_id,avg(salary) from employees group by department_id order by avg(salary) limit 0,1 - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - -select b.* from employees a -join jobs b on a.job_id = b.job_id -where a.salary > (select avg(salary) from employees) -limit 0,1; - - - -#11.查询平均工资高于公司平均工资的部门有哪些? - - -select b.department_name,avg(salary) 平均工资 from employees a -join departments b on a.department_id = b.department_id -group by b.department_name -having 平均工资>(select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - - - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - - - -#方式: - - - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - -select avg(salary) from employees -group by department_id -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - - - - - -#16. 选择所有没有管理者的员工的last_name - - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - - -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - -select department_name from departments a join -(select count(department_id) 人数 from employees group by department_id having 人数>5) b - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` \ No newline at end of file diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230920 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\345\205\255\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" "b/47 \346\250\212\345\260\217\351\203\255/20230920 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\345\205\255\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" deleted file mode 100644 index ead87e612e7525e6bebeb400a511c964f59fd429..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230920 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\345\205\255\346\254\241\350\257\276\345\240\202\347\254\224\350\256\260.md" +++ /dev/null @@ -1,51 +0,0 @@ -# 数据库高级第六次课堂笔记 - -### RBAC - -基于角色访问控制(Role-Based Access Control) - - - -数据库能存什么: - -1.业务数据表:用户、商品; - -2.功能资源表:菜单信息表、页面代码表 - - - -权限的使用场景: - - 网页不一样;网页一样,但可用的菜单不一样;菜单一样,但同一个菜单下的网页元素也可能不一样(按钮,数据不一样,权限一样); - -菜单权限:不同的用户登录系统后,展开的菜单不一样; - -按钮权限:不同的用户查看同一个对象时,展示的按钮不一样; - -数据权限:不同用户查看同一个对象时,可见的数据不一样; - -操作权限:能看到,却操作不了; - -文件资源的权限 - - - -学习RBAC需要掌握的要素: - -RBAC的核心是角色; - -RBAC是目前开发系统中主流的设计模式 - - - -### SKU - -最小存货单位(Stock Keeping Unit),即库存进出计量的基本单元,可以是以件,盒,托盘等为单位 - - - -针对电商而言,SKU有另外的注解: - -1、SKU是指一款商品,每款都有出现一个SKU,便于电商品牌识别商品; - -2、一款商品多色,则是有多个SKU,例:一件衣服,有红色、白色、蓝色,则SKU编码也不相同,如相同则会出现混淆,发错货 \ No newline at end of file diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230921 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232\344\270\216\347\254\224\350\256\260.md" "b/47 \346\250\212\345\260\217\351\203\255/20230921 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232\344\270\216\347\254\224\350\256\260.md" deleted file mode 100644 index b9f2396a90425f5bb8fd1ac3697d5e562c44b74f..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230921 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\344\275\234\344\270\232\344\270\216\347\254\224\350\256\260.md" +++ /dev/null @@ -1,138 +0,0 @@ -# 笔记 - - SPU:商品总称(无含义) - -SKU:规格 - -一个SPU可以有多个SKU,一个SKU有多个属性 - - - -# 作业 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 18:31:44 */ -/*==============================================================*/ -create database goods charset utf8; - -use goods; - -drop table if exists type; - -drop table if exists sku; - -drop table if exists sku_type_value; - -drop table if exists spu; - -drop table if exists `value`; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name varchar(10) not null, - primary key (type_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int not null, - sku_caption varchar(40) not null, - sku_price numeric(4,0) not null, - sku_num int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: sku_attribute_value */ -/*==============================================================*/ -create table sku_type_value -( - relevance_id int not null auto_increment, - sku_id int not null, - value_id int not null, - type_id int not null, - primary key (relevance_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_comment varchar(50) not null, - primary key (spu_id) -); - -/*==============================================================*/ -/* Table: value */ -/*==============================================================*/ -create table `value` -( - value_id int not null auto_increment, - value_name varchar(10) not null, - primary key (value_id) -); - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -alter table sku_type_value add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table sku_type_value add constraint FK_Relationship_3 foreign key (value_id) - references value (value_id) on delete restrict on update restrict; - -alter table sku_type_value add constraint FK_Relationship_4 foreign key (type_id) - references attribute (type_id) on delete restrict on update restrict; - - - -INSERT INTO `spu` VALUES (1, '华为 Mate 60 Pro', '同心聚力 美学新生'); - -INSERT INTO `type` VALUES (1, '颜色'); -INSERT INTO `type` VALUES (2, '容量'); - -INSERT INTO `value` VALUES (1, '雅川青'); -INSERT INTO `value` VALUES (2, '雅丹黑'); -INSERT INTO `value` VALUES (3, '南糯紫'); -INSERT INTO `value` VALUES (4, '白沙银'); -INSERT INTO `value` VALUES (5, '12GB+512GB'); -INSERT INTO `value` VALUES (6, '12GB+1TB'); - -INSERT INTO `sku` VALUES (1, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+1TB 雅丹黑', 7999, 10); -INSERT INTO `sku` VALUES (2, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+1TB 雅川青', 7999, 10); -INSERT INTO `sku` VALUES (3, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+1TB 南糯紫', 7999, 10); -INSERT INTO `sku` VALUES (4, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+1TB 白沙银', 7999, 10); -INSERT INTO `sku` VALUES (5, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+512TB 雅丹黑', 6999, 10); -INSERT INTO `sku` VALUES (6, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+512TB 雅川青', 6999, 10); -INSERT INTO `sku` VALUES (7, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+512TB 南糯紫', 6999, 10); -INSERT INTO `sku` VALUES (8, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+512TB 白沙银', 6999, 10); - -INSERT INTO `sku_type_value` VALUES (1, 2, 1, 2); -INSERT INTO `sku_type_value` VALUES (2, 2, 2, 6); -INSERT INTO `sku_type_value` VALUES (3, 1, 1, 1); -INSERT INTO `sku_type_value` VALUES (4, 1, 2, 6); -INSERT INTO `sku_type_value` VALUES (5, 3, 1, 3); -INSERT INTO `sku_type_value` VALUES (6, 3, 2, 6); -INSERT INTO `sku_type_value` VALUES (7, 4, 1, 4); -INSERT INTO `sku_type_value` VALUES (8, 4, 2, 6); -INSERT INTO `sku_type_value` VALUES (9, 5, 1, 2); -INSERT INTO `sku_type_value` VALUES (10, 5, 2, 5); -INSERT INTO `sku_type_value` VALUES (11, 6, 1, 1); -INSERT INTO `sku_type_value` VALUES (12, 6, 2, 5); -INSERT INTO `sku_type_value` VALUES (13, 7, 1, 3); -INSERT INTO `sku_type_value` VALUES (14, 7, 2, 5); -INSERT INTO `sku_type_value` VALUES (15, 8, 1, 4); -INSERT INTO `sku_type_value` VALUES (16, 8, 2, 5); \ No newline at end of file diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230922 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" "b/47 \346\250\212\345\260\217\351\203\255/20230922 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" deleted file mode 100644 index 89f83fd456df0f0ff1c2ca6cb1b59bc78029072d..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230922 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" +++ /dev/null @@ -1,79 +0,0 @@ -# 预习 - - - -## 数据库高级 - -### 事务 - -1.事务:事务就是用户定义的一系列执行SQL语句的操作,这些操作要么完全地执行,要么完全地都不执行,它是一个不可分割的工作执行单元; - -2.事务使用场景:在日常生活中,有时我们需要进行银行转账,这个银行转账操作背后就是执行多个SQL语句,假如这些SQL执行到一半突然停电了,那么就会导致这个功能只完成了一半,这种情况是不允许出现的,要想解决这个问题就需要通过事务来完成; - -3.事务的四大特性:原子性(Atomicity)、一致性(Consistency)、隔离性(Isolation)、持久性(Durability); - -原子性:一个事务必须被视为一个不可分割的最小工作单元,整个事务中的所有操作要么全部提交成功,要么全部失败回滚,对于一个事务来说,不可能只执行其中一部分操作,这就是事务的原子性; - -一致性:数据库总是从一个一致性的状态转换到另一个一致性的状态。例如前面银行例子,一致性确保了即使在转账过程中系统崩溃,支票账户也不会损失转账的金额,因为事务最终没有提交,所以事务中所做的修改也不会到数据库中,这就是事务的一致性; - -隔离性:通常来说,一个事务所做的修改操作在提交事务之前,对于其他事务来说是不可见的。例如前面的银行例子,当执行完第三条,第四条语句还未开始时,此时有另外的一个账户汇总程序开始运行,则其看到支票账户的余额并没有被减去转账的金额; - -持久性:一旦事务提交,则其所做的修改会永久保存到数据库; - -4.总结:事务能够保证数据的完整性和一致性,让用户的操作更加安全。 - - - -### 视图 - -1.视图:MySQL 视图是一个虚拟表,其内容由查询定义。同真实的表一样,视图包含一系列带有名称的列和行数据。但是,视图并不在数据库中以存储的数据值集形式存在。行和列数据来自由定义视图的查询所引用的表,并且在引用视图时动态生成; - -2.视图语法: - -完整的创建视图的语法结构: - -```mysql -CREATE [OR REPLACE] [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}] -VIEW 视图名称 [(字段列表)] -AS 查询语句 [WITH [CASCADED|LOCAL] CHECK OPTION] -``` - -简化版本: - -```mysql -CREATE VIEW 视图名称 -AS 查询语句 -``` - - - -### 索引 - -索引:索引就好比字典的目录一样,我们通常都会先去目录查找关键偏旁或者字母再去查找 -,要比直接翻查字典查询要快很多。 - - - -### 存储过程 - -1.存储过程:存储过程其实就是已预编译为可执行过程的一个或多个SQL语句。 通过调用和传递参数即可完成该存储过程的功能; - -2.存储过程优点:提高性能、降低网络开销、便于进行代码移植、更强的安全性; - -3.存储过程缺点:逻辑处理吃力、修改参数复杂、开发调试复杂、无法应用缓存、不支持群集(数据库服务器无法水平扩展,或者数据库的切割(水平或垂直切割),数据库切割之后,存储过程并不清楚数据存储在哪个数据库中)。 - - - -### 触发器 - -1.触发器:触发器是和表关联的特殊的存储过程,可以在插入,删除或修改表中的数据时触发执行,比数据库本身标准的功能有更精细和更复杂的数据控制能力; - -2.触发器优点:安全性、审计、实现复杂的数据完整性规则、提供了运行计划任务的另一种方法; - -3.触发器的四要素:监控地点:table - -​ 监控事件:insert/update/delete - -​ 触发时间:after/before - -​ 触发事件:insert/update/delete \ No newline at end of file diff --git "a/47 \346\250\212\345\260\217\351\203\255/20230926 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\350\247\206\345\233\276.md" "b/47 \346\250\212\345\260\217\351\203\255/20230926 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\350\247\206\345\233\276.md" deleted file mode 100644 index fa4c67bee08cab1206ced9223c80d506bea80392..0000000000000000000000000000000000000000 --- "a/47 \346\250\212\345\260\217\351\203\255/20230926 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\350\247\206\345\233\276.md" +++ /dev/null @@ -1,390 +0,0 @@ -# 笔记 - -### CHECK检查约束 - -1.对版本的要求:MYSQL5.7可使用但对数据无效;MYSQL8.0中可正常使用 - -2.作用:检查某个字段的值是否符合xx要求,一般指的是值的范围 age int age>0 - -3.语法: - -create table employee( - -eid int primary key, - -ename varchar(5) - ---语法 check(表达式) - ---age >0,gender='男' or gender='女' - -gender char(1)check (gender in ('男','女')) - - - -utf8中,一个汉字是一个字符,等于3个字节 - -使用lenth()函数时需要注意,1个中文输出的字节长度是3 - - - -### 视图view - -1.视图是一种虚拟表,本身是不具有数据的,占用很少的内存空间 - -2.视图建立在已有的基础上,视图耐以建立的这些表叫做基表 - -3.将过滤后的数据,保存成一个视图,有利于数据的安全性 - -4.语法: - -create view 视图名称 - -as 查询语句 - -5.视图只有视图和基表有一对一的情况可以更新,一对多或者多对多不可更新(一般情况下不会去更新视图) - -6.当我们创建好一张视图后,还可以在它基础上再创建视图 - -7.更新视图: - -方法1:使用create or replace view子句修改视图,有这个视图就更新,没有就创建 - -方法2:alter view 视图名称 as select 语句,前提是被修改的视图要先存在 - -8.删除视图:drop view 视图名称 - -9.总结: - -(1)创建视图: - -第一种:create view 视图名称 as select 语句 - -第二种:create view 视图的名称(视图的字段)as select 语句 字段数要与select语句结果的字段数一致 - -(2)查询视图: - -第一种:select * from 视图名称 - -第二种:select 指定的字段名 from 视图名称 - -(3)修改视图: - -第一种:使用create or replace view子句修改视图,有这个视图就更新,没有就创建 - -第二种:alter view 视图名称 as select 语句,前提是被修改的视图要先存在 - -(4)删除视图:drop view 视图名称 - - - -# 作业 - -```mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -#第14章_视图的课后练习 -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -CREATE VIEW employee_vu AS -- 视图要建立在已有表的基础上 -SELECT last_name 姓名,employee_id 员工号,department_id 部门号 FROM employees; - -SELECT * FROM employee_vu; - -#2. 显示视图的结构 - -DESC employee_vu; - -#3. 查询视图中的全部内容 - -SHOW CREATE VIEW employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 - -CREATE OR REPLACE VIEW employee_vu AS -SELECT last_name 姓名,employee_id 员工号,department_id 部门号 FROM employees -WHERE department_id = 80; - -SELECT * FROM employee_vu; - -#练习2: -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -CREATE VIEW emp_v1 AS -SELECT last_name 员工姓名,salary 工资,email 邮箱,FROM employees -WHERE phone_number LIKE '011%'; -SELECT * FROM emp_v1; - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - -CREATE OR REPLACE VIEW emp_v1 AS -SELECT last_name 员工姓名,salary 工资,email 邮箱,phone_number 电话号码 FROM employees -WHERE phone_number LIKE '011%' -AND email LIKE '%e%' ; -SELECT * FROM emp_v1; - -#3. 向 emp_v1 插入一条记录,是否可以? - -INSERT INTO emp_v1 VALUES -('jaypark',8000,'GYYYHHH','011.22.1090'); -- 不能向 emp_v1 插入一条记录 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 - -SELECT * FROM emp_v1 ; -UPDATE emp_v1 SET salary=salary+1000; - -#5. 删除emp_v1中姓名为Olsen的员工 - -SELECT * FROM emp_v1 ; -DELETE FROM emp_v1 WHERE last_name = 'Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -CREATE VIEW emp_v2 AS -SELECT department_id 部门id,max(salary) 工资 FROM employees -GROUP BY department_id -HAVING max(salary)>12000; -SELECT * FROM emp_v2 - -#7. 向 emp_v2 中插入一条记录,是否可以? - -INSERT INTO emp_v2 VALUES -(30,'12000'); --- 不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 - -DROP VIEW emp_v1,emp_v2; -SHOW TABLES; -``` \ No newline at end of file diff --git "a/48 \351\251\254\345\256\217\350\276\276/20230913 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/48 \351\251\254\345\256\217\350\276\276/20230913 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index 13f1e40ffdb580313e7d777e0d23e9fe04efcecf..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/20230913 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,114 +0,0 @@ -# 作业 - - - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-13 17:26:56 */ -/*==============================================================*/ - -create database hospital charset utf8; -use hospital; - -drop table if exists cure; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists grab; - -drop table if exists patient; - -/*==============================================================*/ -/* Table: cure */ -/*==============================================================*/ - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor #医生 -( - d_id int(2) not null auto_increment, # 医生编号 - d_name varchar(5) not null, # 医生姓名 - d_type varchar(10) not null, # 医生类型 - d_sex varchar(2) not null, # 医生性别 - d_age varchar(2) not null, # 医生年龄 - primary key (d_id) -); -insert into doctor (d_id,d_name,d_type,d_sex,d_age) values -('1','陈佳炜','胃科','男','18'), -('2','林俊伟','妇产科','女','18'), -('3','代瑞','脑科','男','18'); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug #药品 -( - dr_id int(2) not null auto_increment, # 药品编号 - dr_name varchar(5) not null, # 药品名称 - primary key (dr_id) -); -insert into drug (dr_id,dr_name) values -('1','止泻药'), -('2','阿司匹林'), -('3','胃炎药'); - -/*==============================================================*/ -/* Table: grab */ -/*==============================================================*/ - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient #病人 -( - p_id int(2) not null auto_increment, #病人病号 - p_name varchar(5) not null, #病人姓名 - p_symptom varchar(10) not null, #病人症状 - p_sex varchar(2) not null, #病人性别 - p_age varchar(2) not null, #病人年龄 - primary key (p_id) -); -insert into patient (p_id,p_name,p_symptom,p_sex,p_age) values -('1','张三','头疼','男','18'), -('2','李四','肚子疼','男','18'), -('3','王五','胃炎','男','18'); -create table cure #开药单 -( - p_id int not null, #病人病号 - d_id int not null, #医生编号 - primary key (p_id, d_id) -); - -insert into cure (p_id,d_id)values -('1','2'), -('2','1'), -('3','1'); -create table grab #抓 -( - p_id int not null, #病人病号 - dr_id int not null, #药品编号 - primary key (p_id, dr_id) -); -insert into grab (p_id,dr_id) values -('1','2'), -('2','1'), -('3','3'); -alter table cure add constraint FK_cure foreign key (p_id) - references patient (p_id) on delete restrict on update restrict; - -alter table cure add constraint FK_cure2 foreign key (d_id) - references doctor (d_id) on delete restrict on update restrict; - -alter table grab add constraint FK_grab foreign key (p_id) - references patient (p_id) on delete restrict on update restrict; - -alter table grab add constraint FK_grab2 foreign key (dr_id) - references drug (dr_id) on delete restrict on update restrict; - - -``` - diff --git "a/48 \351\251\254\345\256\217\350\276\276/9\346\234\21011\346\227\245.md" "b/48 \351\251\254\345\256\217\350\276\276/9\346\234\21011\346\227\245.md" deleted file mode 100644 index 320d25b113773681623388cdb26020d48d9e9fe4..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/9\346\234\21011\346\227\245.md" +++ /dev/null @@ -1,113 +0,0 @@ -drop table if exists administrators; - -drop table if exists book; - -drop table if exists "books category"; - -drop table if exists employee; - -drop table if exists faculties; - -drop table if exists student; - -drop table if exists 借书; - -/*==============================================================*/ -/* Table: administrators */ -/*==============================================================*/ -create table administrators -( - ad_id int not null, - em_id int not null, - ad_name char(20) not null, - ad_number char(20) not null, - primary key (ad_id) -); - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - bo_id int not null, - ca_id int not null, - bo_name varchar(20) not null, - primary key (bo_id) -); - -/*==============================================================*/ -/* Table: "books category" */ -/*==============================================================*/ -create table "books category" -( - ca_id int not null, - ad_id int not null, - ca_name char(20) not null, - primary key (ca_id) -); - -/*==============================================================*/ -/* Table: employee */ -/*==============================================================*/ -create table employee -( - em_id int not null, - ad_id int not null, - em_name char(20) not null, - primary key (em_id) -); - -/*==============================================================*/ -/* Table: faculties */ -/*==============================================================*/ -create table faculties -( - fa_id int not null, - fa_name varchar(20) not null, - fa_number char(20) not null, - primary key (fa_id) -); - -/*==============================================================*/ -/* Table: student */ -/*==============================================================*/ -create table student -( - stu_id int not null, - fa_id int not null, - stu_name varchar(20), - primary key (stu_id) -); - -/*==============================================================*/ -/* Table: 借书 */ -/*==============================================================*/ -create table 借书 -( - bo_id int not null, - stu_id int not null, - number int not null, - is_no int not null, - primary key (bo_id, stu_id) -); - -alter table administrators add constraint FK_ying foreign key (em_id) - references employee (em_id) on delete restrict on update restrict; - -alter table book add constraint FK_bao foreign key (ca_id) - references "books category" (ca_id) on delete restrict on update restrict; - -alter table "books category" add constraint FK_guan foreign key (ad_id) - references administrators (ad_id) on delete restrict on update restrict; - -alter table employee add constraint FK_dui foreign key (ad_id) - references administrators (ad_id) on delete restrict on update restrict; - -alter table student add constraint FK_shu foreign key (fa_id) - references faculties (fa_id) on delete restrict on update restrict; - -alter table 借书 add constraint FK_jie foreign key (stu_id) - references student (stu_id) on delete restrict on update restrict; - -alter table 借书 add constraint FK_jie1 foreign key (bo_id) - references book (bo_id) on delete restrict on update restrict; diff --git "a/48 \351\251\254\345\256\217\350\276\276/9\346\234\2106\346\227\245\344\275\234\344\270\232.md" "b/48 \351\251\254\345\256\217\350\276\276/9\346\234\2106\346\227\245\344\275\234\344\270\232.md" deleted file mode 100644 index 0b1e7fec21411008c59f5a090b32b8732775c0b4..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/9\346\234\2106\346\227\245\344\275\234\344\270\232.md" +++ /dev/null @@ -1,69 +0,0 @@ -大一 - -1. mysql数据库 - -2. JavaScript 原生js (Ajax)做了一些封装成一些框架jQuery,Common,js Html ,css,js - -3. MVC框架。SSM(Maven,Spring,SpringMvc,MyBatis) - -大二 - -1. Node.js v8引擎 - -2. Vue.js 前端框架,简易开发,有UI框架配合,美团,饿了么(element-ui),UI框架 - -3. SprinngBoot(Redis.WebAp) 非关系型,NO--SQL,key--value键值对的形式存在 age:18 - -实训 - -Linux服务器:Nginx,MongoDB 非关系型 - -项目中可能实现的技术:中间体,签权 - -小程序,uniapp移动端开发 - -数据库关系 - -数据库设计 - -根据用户需求和开发的系统的需求,设计出符合对应的DBMS的需求的数据库结构,使其能有效的存储和管理数据。 - -表与表的关系 - -一对一(1,1) - -例如:身份证与学生(将其中任意一表中的主键,放到另一个表当外键) - -一对多(1,N) - -例如:教师与课程(将一所在的表的主键,放到多的表当外键) - -多对多(M,N) - -例如:课程与学生(必须第三张表,将前两张表的主键放进来当外键) --------------------------------------------------------------------------------------------------------------------------------------------------------------------- - -1.概念 --------------------------------------------------------------------------------------------------------------------------------------------------------------------- - -关系实体图,简记E-R图。E实体(表)、R关系(字段)、实体关系图,是指以实体、关系、属性三个基本概念概括数据的基本结构,从而描述静态数据结构的概念模式 - -2.要素 - -实体、属性和关系 - -大一 - -1.mysql 数据库高级 - -2.Java Script .原生js - -3.MVC 框架。SSM - -大二 - -1.Node.js v8引擎 - -2.Vue.js 前端框架,简易开发,有UI框架配合,美团,饿了么(element-ui),UI框架 - -3.SpringBoot(Redis,WebAPI) 非关系式 ,NO-SQL,key-value键值对的形式的存在 age;18 diff --git "a/48 \351\251\254\345\256\217\350\276\276/9\346\234\2107\346\227\245\344\275\234\344\270\232.md" "b/48 \351\251\254\345\256\217\350\276\276/9\346\234\2107\346\227\245\344\275\234\344\270\232.md" deleted file mode 100644 index e2a50255772bb949d8a1703d4366c6dee2d9ef85..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/9\346\234\2107\346\227\245\344\275\234\344\270\232.md" +++ /dev/null @@ -1,31 +0,0 @@ -笔记 -== - -表与表之间的关系 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - -1、一对一的关系 - -一、两张表的主键,建立外键约束。 - --- 建立一对一关系:一夫一妻 - - - - -2、一对多的关系 - -一、将一所在的表放在多那个表中当外键 - -3、多对多的关系 - -一、需要创建第三个表,将前面两个表中的主键放到第三个表中当外键 -数据库范式 - ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ - -1、第一范式:要求字段的内容不可再分,为保证数据的原子性。 - -2、第二范式:要求满足第一范式的基础上,要求非主键字段要完全依赖主键,而不能只依赖部分, - -3、第三范式:要求满足第二范式前提上,要非主键属性要直接依赖主键。 diff --git "a/48 \351\251\254\345\256\217\350\276\276/\344\271\235\346\234\21012\346\227\245.md" "b/48 \351\251\254\345\256\217\350\276\276/\344\271\235\346\234\21012\346\227\245.md" deleted file mode 100644 index 654b6ee1a8fa8301ded4570345e0995ce7427d2b..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/\344\271\235\346\234\21012\346\227\245.md" +++ /dev/null @@ -1,139 +0,0 @@ -```sql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 18:03:05 */ -/*==============================================================*/ - -create database film charset utf8; -use film; - -drop table if exists Relationship_3; - -drop table if exists Relationship_4; - -drop table if exists audience; - -drop table if exists brief; - -drop table if exists comments; - -drop table if exists language; - -drop table if exists moviinformation; - -drop table if exists type; - -/*==============================================================*/ -/* Table: Relationship_3 */ -/*==============================================================*/ -create table Relationship_3 -( - type_id int not null, - mo_id int not null, - primary key (type_id, mo_id) -); - -/*==============================================================*/ -/* Table: Relationship_4 */ -/*==============================================================*/ -create table Relationship_4 -( - au_id int not null, - mo_id int not null, - primary key (au_id, mo_id) -); - -/*==============================================================*/ -/* Table: audience */ -/*==============================================================*/ -create table audience -( - au_id int not null, - au_name varchar(20) not null, - au_number char(10) not null, - primary key (au_id) -); - -/*==============================================================*/ -/* Table: brief */ -/*==============================================================*/ -create table brief -( - br_director varchar(20) not null, - mo_id int not null, - br_scriptwriter varchar(10) not null, - be_score int not null, - primary key (br_director) -); - -/*==============================================================*/ -/* Table: comments */ -/*==============================================================*/ -create table comments -( - co_name varchar(10) not null, - mo_id int not null, - co_content varchar(20) not null, - primary key (co_name) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - lan_id int not null, - mo_id int not null, - lan_type varchar(20) not null, - primary key (lan_id) -); - -/*==============================================================*/ -/* Table: moviinformation */ -/*==============================================================*/ -create table moviinformation -( - mo_id int(10) not null auto_increment, - mo_name varchar(20) not null, - mo_time time not null, - mo_date date not null, - primary key (mo_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_plot varchar(20) not null, - type_love varchar(20) not null, - type_terror varchar(20) not null, - type_panic varchar(20) not null, - primary key (type_id) -); - -alter table Relationship_3 add constraint FK_Relationship_3 foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table Relationship_3 add constraint FK_Relationship_6 foreign key (mo_id) - references moviinformation (mo_id) on delete restrict on update restrict; - -alter table Relationship_4 add constraint FK_Relationship_4 foreign key (au_id) - references audience (au_id) on delete restrict on update restrict; - -alter table Relationship_4 add constraint FK_Relationship_7 foreign key (mo_id) - references moviinformation (mo_id) on delete restrict on update restrict; - -alter table brief add constraint FK_Relationship_2 foreign key (mo_id) - references moviinformation (mo_id) on delete restrict on update restrict; - -alter table comments add constraint FK_Relationship_5 foreign key (mo_id) - references moviinformation (mo_id) on delete restrict on update restrict; - -alter table language add constraint FK_Relationship_1 foreign key (mo_id) - references moviinformation (mo_id) on delete restrict on update restrict; - -``` - - diff --git "a/48 \351\251\254\345\256\217\350\276\276/\344\271\235\346\234\210\344\272\214\345\215\201\344\270\200.md" "b/48 \351\251\254\345\256\217\350\276\276/\344\271\235\346\234\210\344\272\214\345\215\201\344\270\200.md" deleted file mode 100644 index f9f81a571eda433ea5c77306870de0b8ced88bb2..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/\344\271\235\346\234\210\344\272\214\345\215\201\344\270\200.md" +++ /dev/null @@ -1,85 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 17:33:06 */ -/*==============================================================*/ - - -drop table if exists attributevalue; - -drop table if exists commodity; - -drop table if exists merchandisenews; - -drop table if exists middle; - -drop table if exists property; - -/*==============================================================*/ -/* Table: attributevalue */ -/*==============================================================*/ -create table attributevalue -( - av_id int not null auto_increment, - av_name varchar(20) not null, - primary key (av_id) -); - -/*==============================================================*/ -/* Table: commodity */ -/*==============================================================*/ -create table commodity -( - com_id int not null auto_increment, - com_name varchar(20) not null, - primary key (com_id) -); - -/*==============================================================*/ -/* Table: merchandisenews */ -/*==============================================================*/ -create table merchandisenews -( - md_id int not null auto_increment, - com_id int, - md_name varchar(20) not null, - md_internalstorage varchar(10) not null, - md_color varchar(10) not null, - md_inventory int not null, - md_price varchar(10) not null, - primary key (md_id) -); - -/*==============================================================*/ -/* Table: middle */ -/*==============================================================*/ -create table middle -( - middle_id int not null auto_increment, - md_id int, - av_id int, - py_id int, - primary key (middle_id) -); - -/*==============================================================*/ -/* Table: property */ -/*==============================================================*/ -create table property -( - py_id int not null auto_increment, - py_name varchar(20) not null, - primary key (py_id) -); - -alter table merchandisenews add constraint FK_Relationship_4 foreign key (com_id) - references commodity (com_id) on delete restrict on update restrict; - -alter table middle add constraint FK_Relationship_2 foreign key (md_id) - references merchandisenews (md_id) on delete restrict on update restrict; - -alter table middle add constraint FK_Relationship_3 foreign key (av_id) - references attributevalue (av_id) on delete restrict on update restrict; - -alter table middle add constraint FK_Relationship_5 foreign key (py_id) - references property (py_id) on delete restrict on update restrict; - diff --git "a/48 \351\251\254\345\256\217\350\276\276/\344\271\235\346\234\210\344\272\214\345\215\201\345\205\255\344\275\234\344\270\232.md" "b/48 \351\251\254\345\256\217\350\276\276/\344\271\235\346\234\210\344\272\214\345\215\201\345\205\255\344\275\234\344\270\232.md" deleted file mode 100644 index 4702273efd2927c5ca7162b0d50f62b3a786c2db..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/\344\271\235\346\234\210\344\272\214\345\215\201\345\205\255\344\275\234\344\270\232.md" +++ /dev/null @@ -1,252 +0,0 @@ -```mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - - -#第14章_视图的课后练习 - -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE VIEW employees_vu AS SELECT LAST_NAME 姓名,EMPLOYEE_ID 员工号,DEPARTMENT_ID 部门号 from employees; - - - -#2. 显示视图的结构 -desc employees_vu; - -#3. 查询视图中的全部内容 -SELECT * FROM employees_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -CREATE OR REPLACE view employees_vu -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -CREATE VIEW emp_v1 As -SELECT last_name,email,salary from employees where phone_number REGEXP '011' - -desc emp_v1; -SELECT * from emp_v1; -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -CREATE or replace view emp_v1 As -SELECT last_name,phone_number,salary from employees where phone_number REGEXP '011' and email like '%e%'; - -desc emp_v1; -SELECT * from emp_v1; -#3. 向 emp_v1 插入一条记录,是否可以? -#不可以 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE emp_v1 set salary =salary+1000; -SELECT * from emp_v1; -#5. 删除emp_v1中姓名为Olsen的员工 -DELETE from emp_v1 where last_name='%Olsen%'; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create or replace view emp_v2 as -SELECT department_id ,max(salary) from employees where salary>12000 GROUP BY department_id ; -SELECT * from emp_v2; - -#7. 向 emp_v2 中插入一条记录,是否可以? -#不可以 -#8. 删除刚才的emp_v2 和 emp_v1 -DROP view emp_v2,emp_v1; - -``` - -笔记 - diff --git "a/48 \351\251\254\345\256\217\350\276\276/\344\275\234\344\270\232.md" "b/48 \351\251\254\345\256\217\350\276\276/\344\275\234\344\270\232.md" deleted file mode 100644 index 40d59065bddb6872d952fefddcdbd4d8e46b20e2..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/\344\275\234\344\270\232.md" +++ /dev/null @@ -1,250 +0,0 @@ -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 -#SELECT sum(salary*12) as 工资总和 FROM employees; -#理解2:计算12月的基本工资和奖金 - -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - -select * from employees; -SELECT sum((ifnull(commission_pct,0)*salary+salary)*12) as 工资总和 FROM employees; - -# 2.查询employees表中去除重复的job_id以后的数据 - -#去除重复 distinct -select * from employees; -select DISTINCT job_id from employees; - -# 3.查询工资大于12000的员工姓名和工资 - -select * from employees; -select first_name,salary from employees where salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 - -select * from employees; -select first_name,department_id from employees WHERE employee_id=176; -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - -desc employees; -select * from employees; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -select * from employees; -select first_name,salary from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select * from employees; -select first_name,department_id from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -select * from employees; -select first_name,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select * from employees; -select first_name,salary,g.grade_level from employees e join job_grades g on e.salary between g.lowest_sal and g.highest_sal where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select * from employees; -select * from employees where last_name like '__尔%'; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -select * from employees; -select * from employees where last_name like '%尔%' and last_name like '%特%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select * from employees; -select * from employees where first_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select * from employees; -select first_name,j.job_title from employees e join jobs j on e.job_id=j.job_id where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select * from employees; -select first_name,salary,manager_id from employees where manager_id in(100,101,110); -#第05章_排序与分页的课后练习 -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select * from employees ; -SELECT (ifnull(commission_pct,0)*salary+salary)*12 aaa FROM employees ORDER BY aaa desc; -# -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -select * from employees ; -select first_name,salary from employees where salary not between 8000 and 17000 ORDER BY salary desc limit 20,20; -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select * from employees ; -select * from employees where email like '%e%' ORDER BY length(email) desc,department_id; - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - -select first_name,d.department_id,department_name from employees e join departments d on e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -select job_id,location_id from employees e join departments d on e.department_id=d.department_id where e.employee_id=90 or d.department_id=90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -SELECT last_name,department_name,l.location_id,city FROM employees e join departments d join locations l on e.department_id=d.department_id and d.location_id=l.location_id; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -SELECT last_name , job_id , d.department_id , department_name FROM employees e join departments d join locations l on e.department_id=d.department_id and d.location_id=l.location_id where city='多伦多'; -#sql92语法(自然连接): -SELECT last_name , job_id , d.department_id , department_name FROM employees e,departments d,locations l where city='多伦多' and e.department_id=d.department_id and d.location_id=l.location_id ; - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -select * from employees e join departments d join locations l on e.department_id=d.department_id and d.location_id=l.location_id where d.department_name='行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 - --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 -select a.last_name,a.employee_id,b.last_name,b.employee_id from employees a inner join employees b on a.employee_id=b.manager_id; - -# 7.查询哪些部门没有员工 - -select d.department_name from employees e right join departments d on e.department_id=d.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - -select city from departments dep right join locations loc on dep.location_id=loc.location_id where department_id is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select * from employees e join departments d on e.department_id=d.department_id where department_name in ('销售部','信息技术部'); - -# 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees; -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -select job_id,max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees GROUP BY job_id; -#4.选择各个job_id的员工人数 -select job_id,count(job_id) from employees GROUP BY job_id; - -# 5.查询员工最高工资和最低工资的差距 - -select max(salary)-min(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - -select * from employees where manager_id is not null group by manager_id having min(salary)>=6000; - - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name 部门名称,d.location_id 地点编号,count(employee_id) 员工数量,avg(salary) 平均工资 from employees e left join departments d on e.department_id=d.department_id GROUP by d.department_id ORDER BY 平均工资 desc; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select job_title,department_name,min(salary) from employees emp -left join departments dep on emp.department_id=dep.department_id -left join jobs on emp.job_id=jobs.job_id group by job_title,department_name; - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -; -select department_id from employees where last_name='兹洛特基'; -select last_name,salary from employees where department_id=(select department_id from employees where last_name='兹洛特基'); -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -select avg(salary) from employees; -select employee_id,last_name,salary from employees where salary>(select avg(salary) from employees); -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary -select max(salary) from employees left join jobs on employees.job_id=jobs.job_id where jobs.job_id='SA_MAN'; -select employees.last_name, jobs.job_id, employees.salary from employees left join jobs on employees.job_id=jobs.job_id where salary>(select max(salary) from employees left join jobs on employees.job_id=jobs.job_id where jobs.job_id='SA_MAN'); -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 -SELECT employee_id,last_name -FROM employees -SELECT department_id FROM employees where last_name like '%u%' or first_name like '%u%'; -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -select d.department_id from employees e right join departments d on e.department_id=d.department_id where location_id=1700 GROUP BY d.department_id; -select employee_id from employees e left join departments d on e.department_id=d.department_id where e.department_id in (select d.department_id from employees e right join departments d on e.department_id=d.department_id where location_id=1700 GROUP BY d.department_id); -#6.查询管理者是 金 的员工姓名和工资 -select employee_id from employees where last_name='金'; -select last_name,salary from employees where manager_id in (select employee_id from employees where last_name='金'); -#7.查询工资最低的员工信息: last_name, salary -select min(salary) from employees; -select last_name, salary from employees where salary=(select min(salary) from employees); -#8.查询平均工资最低的部门信息 -select * from employees a left join departments b on a.department_id=b.department_id where salary=(select min(salary)from employees); -#方式1: - -# 部门最低工资=全司最低 - -#方式2: - -# 部门平均<= 公司所有平均 - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -select b.*,avg(salary) from employees a left join departments b on a.department_id=b.department_id where salary=(select min(salary) from employees) group by department_id; -#10.查询平均工资最高的 job 信息 -#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 -select jobs.job_id,avg(salary) from employees left join jobs on employees.job_id=jobs.job_id GROUP BY job_id; -select * from employees a left join jobs b on a.job_id=b.job_id group by b.job_id having salary=(select max(salary) from employees) ; - -#11.查询平均工资高于公司平均工资的部门有哪些? -select department_id,avg(salary) from employees group by department_id having avg(salary)>(select avg(salary) from employees) ; -#12.查询出公司中所有 manager 的详细信息 -#方式1:自连接 自己连自己 -select * from employees a left join employees b on a.employee_id=b.manager_id; -#方式2:子查询 -#员工编号=(管理员编号有哪些) - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? -#方式: -select department_id,min(最高工资) from (select max(salary) 最高工资,department_id from employees group by department_id) as a group by department_id; -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -select avg(salary) 平均工资 from employees group by department_id ; -select last_name,department_id,email,salary from employees group by department_id having avg(salary)=(select max(平均工资)from (select avg(salary) 平均工资 from employees group by department_id) as a); -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: -select department_id from employees where job_id !='ST_CLERK'; -#16. 选择所有没有管理者的员工的last_name -select last_name from employees where manager_id is null; -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: -#方式2: -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) -#方式1:使用相关子查询 -select avg(salary) 平均工资,department_id from employees group by department_id; -select * from employees a left join (select avg(salary) 平均工资,department_id from employees group by department_id) -b on a.department_id=b.department_id where a.salary>b.平均工资; -#方式2:在FROM中声明子查询 -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -select department_id from employees group by department_id having count(department_id)>5; -select * from departments where department_id in(select department_id from employees group by department_id having count(department_id)>5); -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) -select country_id,count(department_id) from departments a left join locations b on a.location_id=b.location_id group by country_id -having count(department_id)>2; -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 -*/ diff --git "a/48 \351\251\254\345\256\217\350\276\276/\346\261\275\350\275\246\345\224\256\345\215\226.md" "b/48 \351\251\254\345\256\217\350\276\276/\346\261\275\350\275\246\345\224\256\345\215\226.md" deleted file mode 100644 index cf2f4dd04bd6a24edd081230ca5b242a663edafd..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/\346\261\275\350\275\246\345\224\256\345\215\226.md" +++ /dev/null @@ -1,98 +0,0 @@ - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/17 21:08:07 */ -/*==============================================================*/ -create DATABASE cars CHARSET utf8; -use cars; - -```sql - - -drop table if exists car; - -drop table if exists client; - -drop table if exists market; - -drop table if exists salesrecord; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -/* 车型表*/ -create table car -( - car_id int not null, - car_type varchar(20) not null, - primary key (car_id) -); -insert into car(car_id,car_type) values -(1,'房车'), -(2,'越野'), -(3,'跑车'); -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -/* 顾客表*/ -create table client -( - cli_id int not null, - cli_name varchar(10) not null, - cli_sex char(1) not null, - primary key (cli_id) -); -insert into client (cli_id,cli_name,cli_sex) VALUES -(1,'张三','男'), -(2,'李四','男'), -(3,'王五','男'); -/*==============================================================*/ -/* Table: market */ -/*==============================================================*/ -/* 销售员表*/ -create table market -( - mar_id int not null, - mar_name varchar(10) not null, - mar_sex char(1) not null, - primary key (mar_id) -); -insert into market (mar_id,mar_name,mar_sex) VALUES -(1,'李明','男'), -(2,'张伟','男'), -(3,'王芳','女'); -/*==============================================================*/ -/* Table: salesrecord */ -/*==============================================================*/ -/* 销售记录表*/ -create table salesrecord -( - sr_id int not null, - car_id int not null, - mar_id int, - cli_id int, - sr_time date not null, - sr_price char(20) not null, - primary key (sr_id) -); -insert into salesrecord (sr_id,car_id,mar_id,cli_id,sr_time,sr_price) values -(1,2,1,1,'2022-3-15',20000), -(2,1,1,2,'2022-5-1',19800), -(3,3,3,3,'2023-10-1',39800); -alter table salesrecord add constraint FK_Relationship_3 foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table salesrecord add constraint FK_Relationship_4 foreign key (mar_id) - references market (mar_id) on delete restrict on update restrict; - -alter table salesrecord add constraint FK_Relationship_5 foreign key (cli_id) - references client (cli_id) on delete restrict on update restrict; -#1查询李明的销售记录 - select * from salesrecord where `mar_id`=1; -#2,查找销售纪录中销售价格最高的汽车 -select MAX(sr_price) from salesrecord; -#7,统计李明的销售数量 -select * from salesrecord where `mar_id`=1; -``` - - diff --git "a/48 \351\251\254\345\256\217\350\276\276/\347\254\224\350\256\260.md" "b/48 \351\251\254\345\256\217\350\276\276/\347\254\224\350\256\260.md" deleted file mode 100644 index 026f707b634c4a1521149adf6b9e62fbc5d3358e..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/\347\254\224\350\256\260.md" +++ /dev/null @@ -1,7 +0,0 @@ -数据库的表示: - -第一示范:要求字段的内容,不可在分割,为的是保证数据的原字性。 - -第二示范:要求在满足第一示范的基础上,要求非主键要完全依赖主键而不能只依赖部分。 - -第三示范:满足第二示范的基础上,要求非主键属性直接依赖主键。 diff --git "a/48 \351\251\254\345\256\217\350\276\276/\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" "b/48 \351\251\254\345\256\217\350\276\276/\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" deleted file mode 100644 index 4229b2ceec0c382bb87cb801b2b0c3837a827e0e..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/\347\254\254\344\270\200\346\254\241\347\254\224\350\256\260.md" +++ /dev/null @@ -1,14 +0,0 @@ -笔记 -== - -​ 新学期,意味着新的目标,充满着新的期待。我们应该以更加积极向上的态度投入到自主学习中,持续发扬软工学子的守正务实、但当实干的精神。 - -​ 新学期、新奋斗、新开始、新起点。 - -​ 我们应当多关注招聘网站,多以我们所学的专业招聘职位的岗位要求,为我们的学习目标;这样可以使我们更好的适应今后的工作。 -例如: -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - -**前端部分:1)HTML:网页的核心语言,构成网页的基础   2)CSS:使网页更加丰富多彩灿烂的利器   3)JavaScript:使网页动起来的根本,加强了网页和用户之间的交互   4)HTML DOM:换一种更加形象化的角度来看待网页,让我们更加方便的控制 网页   5)HTML BOM:与浏览器交互不可或缺的工具   6)JavaScript库,主要是:jQuery及其插件、YUI及其插件,使编写网页更加的方便快捷和健壮的强大工具   7)AJAX:异步提交,增强了用户使用网页的良好交互体验   8)JSON: 比 XML 更小、更快,更易解析的数据传输工具   9)FLEX:提供丰富多彩的动画效果   10)普元工作流:更加清晰明了的帮助用户处理业务流程上面的工作   11)JSP:Servlet的展示层,使网页逻辑与网页设计的显示分离   12)JSTL:加强和简化了JSP页面的开发   13)EL:使JSP页面写起来更加简单 **后台部分:**   1)JAVA语言编程基础部分:内容丰富是Java知识体系结构的核心和基础   2)JDBC:提供了一种基准,据此可以构建更高级的工具和接口,使Java开发人员能够编写数据库应用程序   3)JavaMail:用于电子邮件的相关的编程工作   4)JUnit:单元测试,整个变成工作测试的地位始终非常重要   5)Log4j:使我们能够更加细致地控制日志的生成过程   6)Servlet:JavaWeb的核心   7)Struts2:JavaWeb编程中明星级的框架,优点多功能强使编程工作更简单,主要用于控制跳转   8)Spring:JavaWeb编程中明星级的框架,同样优点多功能强使编程工作更简单,主要用于管理对象   9)iBatis:JavaWeb编程中明星级的框架,同样也是优点多功能强使编程工作更简单,主要用于程序和数据库之间的交互   10)SQL:与数据库交互式编程的必备工具  **版本控制:**   1)SVN:版本控制,方便团队协同工作 - - **WEB服务器:**   1)Tomcat:优秀免费的中小型WEB服务器   2)Weblogic:功能很强大的WEB服务器  **开发工具:**   1)Eclipse:开源强大的Java编程工具   2)MyEclipse:在eclipse 基础上加上自己的插件开发而成的功能强大的企业级集成开发环境 **数据库:**   1)Oracle:数据库业界老大,这个常用一点当然,也仅仅是常用一些常用的功能而已,需要加强   2)MySQL:最好的关系型数据库之一   3)SqlServer:最好的关系型数据库之一 **数据库客户端:**   1)Toad:非常棒的数据库客户端软件 diff --git "a/48 \351\251\254\345\256\217\350\276\276/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232.md" "b/48 \351\251\254\345\256\217\350\276\276/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232.md" deleted file mode 100644 index bcd9701bc3cc862b8afb52359051a5a18c988ce7..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/\347\254\254\344\271\235\346\254\241\344\275\234\344\270\232.md" +++ /dev/null @@ -1,109 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:38:28 */ -/*==============================================================*/ -create DATABASE school_test charset utf8; -use school_test; - -drop table if exists jurisdiction; - -drop table if exists role; - -drop table if exists role_jur; - -drop table if exists user; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: jurisdiction */ -/*==============================================================*/ -#权限表 -create table jurisdiction -( - jur_id int not null auto_increment, - jur_name varchar(10) not null, - primary key (jur_id) -); -insert into jurisdiction (jur_id,jur_name) VALUES -(1,'首页'), -(2,'操作栏'), -(3,'薪资'), -(4,'信息'); -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -#角色表 -create table role -( - role_id int not null auto_increment, - role_name varchar(20) not null, - primary key (role_id) -); -insert into role (role_id,role_name) values -(1,'校长'), -(2,'主任'), -(3,'教师'), -(4,'学生'); - -/*==============================================================*/ -/* Table: role_jur */ -/*==============================================================*/ -create table role_jur -( - jur_id int not null, - role_id int not null, - primary key (jur_id, role_id) -); -insert INTO role_jur(jur_id,role_id) VALUES -(1,1), -(2,1), -(3,1), -(4,1), -(1,2), -(2,2), -(3,2), -(1,3), -(2,3), -(1,4); -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_name varchar(10) not null, - user_pwd varchar(10) not null, - primary key (user_id) -); -INSERT into user(user_id,user_name,user_pwd) values -(1,'张三','1111111'), -(2,'李四','2222222'), -(3,'王五','3333333'), -(4,'赵六','4444444'); -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - role_id int not null, - user_id int not null, - primary key (role_id, user_id) -); -insert into user_role (role_id,user_id) VALUES -(1,1), -(2,2), -(3,3), -(4,4); -alter table role_jur add constraint FK_role_jur foreign key (jur_id) - references jurisdiction (jur_id) on delete restrict on update restrict; - -alter table role_jur add constraint FK_role_jur2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; -SELECT * from role r,jurisdiction j,user u ,user_role ur ,role_jur rj WHERE u.user_id=ur.user_id and ur.role_id =r.role_id and r.role_id =rj.role_id and rj.jur_id =j.jur_id; \ No newline at end of file diff --git "a/48 \351\251\254\345\256\217\350\276\276/\351\242\204\344\271\240\344\275\234\344\270\232.md" "b/48 \351\251\254\345\256\217\350\276\276/\351\242\204\344\271\240\344\275\234\344\270\232.md" deleted file mode 100644 index 593335d5fba7272c9755d45bab61239f0bd7efa0..0000000000000000000000000000000000000000 --- "a/48 \351\251\254\345\256\217\350\276\276/\351\242\204\344\271\240\344\275\234\344\270\232.md" +++ /dev/null @@ -1,38 +0,0 @@ -笔记 -===== - -商品管理系统是电商系统中核心系统。商品管理又可以分为商品品类管理模块、SPU与SKU管理、商品资质管理、商品属性管理、商品价格管理、商品库存的管理等等。首先先区分一个商品的概念,spu和sku: - -SPU:标准化产品单元(Standard Product Unit),是商品信息聚合的最小单位,是一组可复用标准化信息的集合,主要也是为了在交易端对一组同类型商品做页面的聚合展示,解决的是一品多型号多规格等等多属性的问题; - -SKU:最小的库存单位(StockKeeping Unit),sku是库存存贮的最小单位,商品的进货、销售、售价、库存等最终都是打在sku身上的,最终的交易都决定在一个sku个体上; - -1.事务 - -为了完成某个业务而对数据库进行一系列操作,这些操作要么成功,要么失败。 - -四个特性: - -原子性:事务包含的这一系列操作,要么全部成功,要么全部失败。 一致性:事务完成之后,不会将非法的数据写入数据库。 隔离性:多个事务可以在一定程度上并发执行。 持久性:事务完成之后,数据要永久保存。 - -2.视图 - -在已有的表或者视图上创建的虚拟表。 - -创建视图 - -create view 视图名 as select - -可以对(单表)视图进行一些增删改查操作,这些操作会影响到原始的表。 - -(3)删除视图 - -drop view 视图名 - -3.索引 - -为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - -如何创建索引: - -create index 索引名 on 表名(字段列表) diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.12 \350\261\206\347\223\243\347\224\265\345\275\261.jpg" "b/49 \346\235\216\350\210\222\346\261\266/9.12 \350\261\206\347\223\243\347\224\265\345\275\261.jpg" deleted file mode 100644 index 2e8e540d7b6145888c74421a4fdcae69456ba584..0000000000000000000000000000000000000000 Binary files "a/49 \346\235\216\350\210\222\346\261\266/9.12 \350\261\206\347\223\243\347\224\265\345\275\261.jpg" and /dev/null differ diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.12\350\261\206\347\223\243\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" "b/49 \346\235\216\350\210\222\346\261\266/9.12\350\261\206\347\223\243\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index 97b726cd48d333a4072f0e84033abdfe8e14109c..0000000000000000000000000000000000000000 --- "a/49 \346\235\216\350\210\222\346\261\266/9.12\350\261\206\347\223\243\347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,209 +0,0 @@ -```java -create DATABASE actors charset utf8; -use actors; -create table actor -( - actor_name varchar(22) not null, - director_name varchar(20) not null, - plot varchar(6) not null, - language varchar(20) not null, - primary key (actor_name) -); - -/*==============================================================*/ -/* Table: alias */ -/*==============================================================*/ -create table alias -( - alias_name varchar(20) not null, - movies_name varchar(20) not null, - primary key (alias_name) -); - -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - director_name varchar(20) not null, - language varchar(20) not null, - director_gender char(1) not null, - director_constellation char(4) not null, - director_date date not null, - director_birthplace varchar(20) not null, - director_occupation varchar(20) not null, - director_alias char(20) not null, - director_family char(22) not null, - director_imdb int, - primary key (director_name) -); - -/*==============================================================*/ -/* Table: film */ -/*==============================================================*/ -create table film -( - film_name varchar(20) not null, - movies_name varchar(20) not null, - film_headline varchar(30) not null, - film_main body varchar(10) not null, - primary key (film_name) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - language varchar(20) not null, - production_state varchar(20) not null, - director_name varchar(20) not null, - primary key (language) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_select varchar(20) not null, - movie_collect char(20) not null, - movie_recommend varchar(22) not null, - primary key (movie_select) -); - -/*==============================================================*/ -/* Table: movies */ -/*==============================================================*/ -create table movies -( - movies_name varchar(20) not null, - director_name varchar(20) not null, - movie_select varchar(20) not null, - movies_director varchar(22) not null, - movies_scriptwriter varchar(22) not null, - primary key (movies_name) -); - -/*==============================================================*/ -/* Table: production */ -/*==============================================================*/ -create table production -( - production_state varchar(20) not null, - director_name varchar(20) not null, - production_region varchar(20) not null, - primary key (production_state) -); - -/*==============================================================*/ -/* Table: "release" */ -/*==============================================================*/ -create table `release` -( - date date not null, - production_state varchar(20) not null, - director_name varchar(20) not null, - primary key (date) -); - -/*==============================================================*/ -/* Table: short */ -/*==============================================================*/ -create table short -( - short_id int not null auto_increment, - movies_name varchar(20) not null, - short_gender char(1) not null, - short_name varchar(20) not null, - short_account int not null, - primary key (short_id) -); - -/*==============================================================*/ -/* Table: time */ -/*==============================================================*/ -create table `time` -( - `time` date not null, - production_state varchar(20) not null, - primary key (`time`) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - plot varchar(6) not null, - time date not null, - director_name varchar(20) not null, - primary key (plot) -); - -alter table actor add constraint FK_关系 foreign key (plot) - references type (plot) on delete restrict on update restrict; - -alter table actor add constraint FK_同事1 foreign key (director_name) - references director (director_name) on delete restrict on update restrict; - -alter table actor add constraint FK_属于1 foreign key (language) - references language (language) on delete restrict on update restrict; - -alter table alias add constraint FK_关系1 foreign key (movies_name) - references movies (movies_name) on delete restrict on update restrict; - -alter table director add constraint FK_决定4 foreign key (language) - references language (language) on delete restrict on update restrict; - -alter table film add constraint FK_关系6 foreign key (movies_name) - references movies (movies_name) on delete restrict on update restrict; - -alter table language add constraint FK_决定 foreign key (production_state) - references production (production_state) on delete restrict on update restrict; - -alter table language add constraint FK_决定5 foreign key (director_name) - references director (director_name) on delete restrict on update restrict; - -alter table movies add constraint FK_属于 foreign key (director_name) - references director (director_name) on delete restrict on update restrict; - -alter table movies add constraint FK_添加 foreign key (movie_select) - references movie (movie_select) on delete restrict on update restrict; - -alter table production add constraint FK_同事 foreign key (director_name) - references director (director_name) on delete restrict on update restrict; - -alter table release add constraint FK_Relationship_3 foreign key (director_name) - references director (director_name) on delete restrict on update restrict; - -alter table release add constraint FK_决定3 foreign key (production_state) - references production (production_state) on delete restrict on update restrict; - -alter table short add constraint FK_关系3 foreign key (movies_name) - references movies (movies_name) on delete restrict on update restrict; - -alter table `time` add constraint FK_定 foreign key (production_state) - references production (production_state) on delete restrict on update restrict; - -alter table type add constraint FK_决定1 foreign key (time) - references `time` (`time`) on delete restrict on update restrict; - -alter table type add constraint FK_决定6 foreign key (director_name) - references director (director_name) on delete restrict on update restrict; - -``` - - - - - - - -```ER -![a3a0e05f-7bed-468b-a899-78b826de90db](file:///C:/Users/user/Pictures/Typedown/a3a0e05f-7bed-468b-a899-78b826de90db.png) -``` - - - -![a3a0e05f-7bed-468b-a899-78b826de90db](file:///C:/Users/user/Pictures/Typedown/a3a0e05f-7bed-468b-a899-78b826de90db.png) diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.14 \345\214\273\351\231\242\347\227\205\344\272\272.png" "b/49 \346\235\216\350\210\222\346\261\266/9.14 \345\214\273\351\231\242\347\227\205\344\272\272.png" deleted file mode 100644 index f55440bce33ae4124254e099c05b5297a162ab34..0000000000000000000000000000000000000000 Binary files "a/49 \346\235\216\350\210\222\346\261\266/9.14 \345\214\273\351\231\242\347\227\205\344\272\272.png" and /dev/null differ diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.14\345\214\273\347\224\237\347\227\205\344\272\272\346\225\260\346\215\256\345\272\223.md" "b/49 \346\235\216\350\210\222\346\261\266/9.14\345\214\273\347\224\237\347\227\205\344\272\272\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index 15717ce2569c05e85aab2f3fcd99fe6c216dbec6..0000000000000000000000000000000000000000 --- "a/49 \346\235\216\350\210\222\346\261\266/9.14\345\214\273\347\224\237\347\227\205\344\272\272\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,132 +0,0 @@ -9.14作业医生病人数据库 - -```java -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 10:58:41 */ -/*==============================================================*/ - - -drop table if exists despensary; - -drop table if exists doctor; - -drop table if exists doctor_patient; - -drop table if exists office; - -drop table if exists patient; - -drop table if exists pharmacy; - -drop table if exists prescribe; - -/*==============================================================*/ -/* Table: despensary */ -/*==============================================================*/ - -CREATE DATABASE yiyuan charset utf8; -use yiyuan; -create table despensary -( - pharmacy_id int not null, - patient_id int not null, - primary key (pharmacy_id, patient_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null, - office_id int, - doctor_name varchar(20) not null, - doctor_zc varchar(20) not null, - doctor_ss varchar(20) not null, - doctor_age int not null, - doctor_gzh int not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: doctor_patient */ -/*==============================================================*/ -create table doctor_patient -( - doctor_id int not null, - patient_id int not null, - primary key (doctor_id, patient_id) -); - -/*==============================================================*/ -/* Table: office */ -/*==============================================================*/ -create table office -( - office_id int not null auto_increment, - office_name varchar(10) not null, - office_url varchar(10) not null, - office_phone int not null, - primary key (office_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(20) not null, - patient_gender char(1) not null, - patient_doctor varchar(20) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: pharmacy */ -/*==============================================================*/ -create table pharmacy -( - pharmacy_id int not null auto_increment, - pharmacy_name varchar(20) not null, - primary key (pharmacy_id) -); - -/*==============================================================*/ -/* Table: prescribe */ -/*==============================================================*/ -create table prescribe -( - doctor_id int not null, - pharmacy_id int not null, - primary key (doctor_id, pharmacy_id) -); - -alter table despensary add constraint FK_despensary foreign key (pharmacy_id) - references pharmacy (pharmacy_id) on delete restrict on update restrict; - -alter table despensary add constraint FK_despensary2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table doctor add constraint FK_possess foreign key (office_id) - references office (office_id) on delete restrict on update restrict; - -alter table doctor_patient add constraint FK_doctor_patient foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table doctor_patient add constraint FK_doctor_patient2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table prescribe add constraint FK_prescribe foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table prescribe add constraint FK_prescribe2 foreign key (pharmacy_id) - references pharmacy (pharmacy_id) on delete restrict on update restrict; - - -``` - - - - diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.15 \346\261\275\350\275\246\351\224\200\345\224\256.jpg" "b/49 \346\235\216\350\210\222\346\261\266/9.15 \346\261\275\350\275\246\351\224\200\345\224\256.jpg" deleted file mode 100644 index f198dd1b74a2f6b1debd011eb50568f0d6c077ea..0000000000000000000000000000000000000000 Binary files "a/49 \346\235\216\350\210\222\346\261\266/9.15 \346\261\275\350\275\246\351\224\200\345\224\256.jpg" and /dev/null differ diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.15\346\261\275\350\275\246\346\225\260\346\215\256\345\272\223.md" "b/49 \346\235\216\350\210\222\346\261\266/9.15\346\261\275\350\275\246\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index 100c5a1b65c2516196c92e715369fa5ce88927e5..0000000000000000000000000000000000000000 --- "a/49 \346\235\216\350\210\222\346\261\266/9.15\346\261\275\350\275\246\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,118 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 10:54:27 */ -/*==============================================================*/ - -CREATE DATABASE qiche2 CHARSET utf8; -use qiche2; -drop table if exists car; - -drop table if exists client; - -drop table if exists sale; - -drop table if exists record; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ - -create table car -( - car_id int not null auto_increment, - car_name varchar(20) not null, - car_type varchar(20) not null, - primary key (car_id) -); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - ce_id int not null auto_increment, - ce_name varchar(20) not null, - ce_address varchar(20) not null, - ce_phone varchar(20) not null, - primary key (ce_id) -); - -/*==============================================================*/ -/* Table: sale */ -/*==============================================================*/ -create table sale -( - sa_id int not null auto_increment, - sa_name varchar(20) not null, - sa_phone varchar(20) not null, - primary key (sa_id) -); - -/*==============================================================*/ -/* Table: record */ -/*==============================================================*/ -create table record -( - ce_id int not null, - sa_id int not null, - re_id int not null auto_increment, - car_id int, - datatime datetime not null, - price float(9,2) not null, - primary key (re_id) -); - -INSERT into car VALUES -(1,"路虎","豪车"), -(2,"劳斯莱斯","顶级豪车"), -(3,"北京BJ","越野"), -(4,"红旗h5","小轿车"); - -insert into client VALUES -(1,"赵四","金佳独院","1986787"), -(2,"王五","广商逸墅","1596123"), -(3,"李富贵","建业橙园","1236569"), -(4,"黄富贵","建业一品","1589762"); - -insert into sale values -(1,"杨销售","12789"), -(2,"王销售","12561"), -(3,"赵销售","12669"); - -insert into record VALUES -(1,2,1,2,"2020-12-1",8956.66), -(3,1,2,3,"2020-1-16",9875.77), -(2,3,3,3,"2025-5-20",789456.88), -(4,2,4,1,"2014-11-29",8549612.99); - - - -alter table record add constraint FK_car foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table record add constraint FK_sale foreign key (ce_id) - references client (ce_id) on delete restrict on update restrict; - -alter table record add constraint FK_record foreign key (sa_id) - references sale (sa_id) on delete restrict on update restrict; - - - - - --- 1.查询特定销售员的销售记录 - select * from record where re_id=2; - -- 2.查找销售记录中销售价格最高的汽车 - select * from record order by price desc limit 1; - -- 3.统计某个销售员的销售总额 - select s01.sa_id,SUM(price) from sale s01,record s02 where s01.sa_id=s02.sa_id and s01.sa_id=2 GROUP BY s01.sa_id; - -- 4.根据客户信息查询其购买过的汽车 - select ce_name,re.* from client c,record r,car re where c.ce_id=r.ce_id and r.car_id=re.car_id and ce_name='李富贵'; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - select car_name,COUNT(car_name),SUM(price) from car c,record s where c.car_id=s.car_id and c.car_id=1 GROUP BY car_name; - -- 6.检索特定日期范围内的销售了哪些汽车 - select * from car c,record s where c.car_id=s.car_id and datatime<"2020-12-1"; - -- 7.查找某车型的销售历史。 - select * from car c,record s where c.car_id=s.car_id and car_type='越野'; - -- 8.统计每个销售员的销售数量 - select s1.sa_id,COUNT(s1.sa_id) from sale s1,record s2 where s1.sa_id=s2.re_id group by sa_id; diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.19mysql\345\244\215\344\271\240.md" "b/49 \346\235\216\350\210\222\346\261\266/9.19mysql\345\244\215\344\271\240.md" deleted file mode 100644 index 813b16685655b5c10364c4d8af6c96d74aa31051..0000000000000000000000000000000000000000 --- "a/49 \346\235\216\350\210\222\346\261\266/9.19mysql\345\244\215\344\271\240.md" +++ /dev/null @@ -1,766 +0,0 @@ -## mysql复习 - - - -### 建库建表 - -```mysql -create database db1 charset utf8; - -use db1; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; -``` - -### 查询语句 - -```mysql -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -select sum(12*salary) from employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - -select sum(salary*12+ifnull(salary*commission_pct*12,0)) from employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - -select distinct job_id from employees; - -# 3.查询工资大于12000的员工姓名和工资 - -select first_name,salary from employees where salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 - -select first_name,department_id from employees where employee_id=176; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -select first_name,salary from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select first_name,department_id from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -select first_name,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select employee_id,salary,grade_level from employees e left join job_grades j on e.salary between j.lowest_sal and j.highest_sal where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select * from employees where first_name like '__尔'; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -select * from employees where last_name like '%特%' and last_name like '%尔%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select * from employees where first_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select e.first_name,j.job_title from employees e left join jobs j on e.job_id=j.job_id where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select first_name,salary,manager_id from employees where manager_id in (100,101,110); - -#第05章_排序与分页的课后练习 - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - -select first_name,department_id,salary*12 from employees order by salary*12 desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select first_name,salary from employees where salary not between 8000 and 17000 order by salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -select * from employees where email like '%e%' order by length(email) desc,department_id asc; - -# 第06章_多表查询的课后练习 - -# 1.显示所有员工的姓名,部门号和部门名称。 - -select first_name,e.department_id,department_name from employees e left join departments d on e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -select e.job_id,d.location_id from employees e left join departments d on e.department_id=d.department_id where e.department_id=90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select e.last_name,d.department_name,d.location_id,l.city from employees e left join departments d on e.department_id=d.department_id left join locations l on d.location_id=l.location_id where commission_pct is not null; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select e.last_name,e.job_id,d.department_id,d.department_name from employees e left join departments d on e.department_id=d.department_id left join locations l on d.location_id=l.location_id where l.city='多伦多'; - -#sql92语法(自然连接): - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -select department_name,street_address,first_name,job_title,salary from jobs j,employees e,departments d,locations l where j.job_id=e.job_id and e.department_id=d.department_id and d.location_id=l.location_id and department_name='行政部'; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select e.first_name,e.employee_id,s.last_name,s.employee_id from employees e inner join employees s on e.employee_id=s.employee_id; - -# 7.查询哪些部门没有员工 - -select department_name from departments d left join employees e on d.department_id=e.department_id where employee_id is null; - -# 8. 查询哪个城市没有部门 - -select city from departments d right join locations l on d.location_id=l.location_id where department_id is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select e.* from departments d,employees e where d.department_id=e.department_id and d.department_name='销售部' or d.department_name='信息技术部'; - -# 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - -select max(salary),min(salary),avg(salary),sum(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - -select job_id,max(salary),min(salary),avg(salary),sum(salary) from employees group by job_id; - -#4.选择各个job_id的员工人数 - -select job_id,count(employee_id) from employees group by job_id; - -# 5.查询员工最高工资和最低工资的差距 - -select max(salary)-min(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - -select manager_id,min(salary) from employees where manager_id is not null group by manager_id having min(salary)>6000; - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name,d.location_id,count(employee_id),avg(salary) from departments d left join employees e on d.department_id=e.department_id group by d.department_id order by avg(salary) desc; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select j.job_title,min(salary),department_name from jobs j left join employees e on j.job_id=e.job_id left join departments d on e.department_id=d.department_id group by j.job_id,d.department_id; - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - -select * from employees where department_id =(select department_id from employees where last_name='兹洛特基') and salary=(select salary from employees where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - -select employee_id,first_name,salary from employees where salary>(select avg(salary) from employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name,job_id,salary from employees where salary>(select max(salary) from employees where JOB_ID = 'SA_MAN'); - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -select employee_id,last_name from employees where department_id=(select department_id from employees where last_name like '%u%'); - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -select first_name,employee_id from employees where department_id in (select department_id from departments where location_id=1700); - -#6.查询管理者是 金 的员工姓名和工资 - -select first_name,salary from employees where manager_id in (select manager_id from employees where last_name='金'); - -#7.查询工资最低的员工信息: last_name, salary - -select last_name,salary from employees where salary=(select min(salary) from employees); - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 - -select * from departments where department_id =(select department_id from employees group by department_id having avg(salary)=(select min(s) from (select avg(salary) s from employees group by department_id) a)); - -#方式2: -# 部门平均<= 公司所有平均 - -select * from departments where department_id=(select department_id from employees group by department_id having avg(salary)<=all(select avg(salary) from employees group by department_id)); - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - -select d.*,(select avg(salary) from employees where department_id=d.department_id) from departments d where department_id =(select department_id from employees group by department_id having avg(salary)=(select min(s) from (select avg(salary) s from employees group by department_id) a)); - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -select * from jobs where job_id=(select job_id from employees group by job_id having avg(salary)=(select max(s) from (select avg(salary) s from employees group by job_id) a)); - -#方式2:平均工资>=所有平均工资 - -select * from jobs where job_id=(select job_id from employees group by job_id having avg(salary)>=all(select avg(salary) from employees group by job_id)); - -#11.查询平均工资高于公司平均工资的部门有哪些? - -select department_id from employees where department_id is not null group by department_id having avg(salary)>(select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - -select e.* from employees e inner join employees s on e.employee_id=s.manager_id; - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - -select * from employees where employee_id=any(select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - -select min(salary) from employees group by department_id having max(salary)<=all(select max(salary) from employees group by department_id); - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary - -select last_name,department_id,email,salary from employees where department_id = (select department_id from employees group by department_id having avg(salary)>=all(select avg(salary) from employees group by department_id)); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 - -select department_id from departments where department_id !=all(select department_id from employees where job_id='ST_CLERK'); - -#16. 选择所有没有管理者的员工的last_name - -select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - -select employee_id,first_name,hire_date,salary from employees e where e.manager_id=(select employee_id from employees where first_name = 'De Haan'); - -#方式2: - -select employee_id, last_name, hire_date, salary from employees e where exists(select * from employees s where e.employee_id=s.manager_id and s.first_name='De Haan'); - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - -select employee_id,last_name,salary from employees e1 where salary > (select avg(salary) from employees e2 where e2.department_id = e1.department_id); - -#方式2:在FROM中声明子查询 - -select employee_id,last_name,salary from employees e1,(select department_id,AVG(salary) s from employees e2 group by department_id) a where e1.department_id = a.department_id and e1.salary > a.s; - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - -select department_name,department_id from departments d where 5 < (select count(*) from employees e where d.department_id = e.department_id); - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -select country_id from locations l where 2 < (select count(*) from departments d where l.location_id=d.location_id); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - -``` - -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不null,就保持原值 - -limit 起始数,显示数 - -desc 库名:显示表结构 - -length(email):email的字节长度 - -#### 自然连接 - -表,表 where 字段=字段 and 字段=字段 - -#### 联表区间 - -表 left join 表 on 表.字段 between 表.字段 and 表.字段(不支持别名) - -#### 自连接 - -inner join - -not in(条件,条件) - -!(between 20 and 50) diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.20RBAC.jpg" "b/49 \346\235\216\350\210\222\346\261\266/9.20RBAC.jpg" deleted file mode 100644 index 9c6f26de7fa38642c729a1cf3a50365abcd3da61..0000000000000000000000000000000000000000 Binary files "a/49 \346\235\216\350\210\222\346\261\266/9.20RBAC.jpg" and /dev/null differ diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.20RBAC.md" "b/49 \346\235\216\350\210\222\346\261\266/9.20RBAC.md" deleted file mode 100644 index c0ee1a4179e4e1cbbb5adfbc6a740b88ab9bbd70..0000000000000000000000000000000000000000 --- "a/49 \346\235\216\350\210\222\346\261\266/9.20RBAC.md" +++ /dev/null @@ -1,176 +0,0 @@ -## RBAC - -基于角色的访问权限管制模型(Role -Base Access Control) - -用户与权限之间产生角色 - -### 在 RBAC 模型里面,有3个基础组成部分,分别是:用户、角色和权限 - -- User(用户):每个用户都有唯一的UID识别,并被授予不同的角色 -- Role(角色):不同角色具有不同的权限 -- Permission(权限):访问权限 -- 用户-角色映射:用户和角色之间的映射关系 -- 角色-权限映射:角色和权限之间的映射 - -### 数据库能存什么? - -1.业务数据表,用户商品 - -2.功能资源表,菜单信息表,页面代码表 - -### 权限 - - 菜单权限:不同的用户查看同一个对象时,展示的菜单不同。 - -按钮权限:不同的用户查看同一个对象时,展示的按钮不一样 - -数据权限:不同的用户查看同一个对象时,可见的数据不一样 - -操作权限:可以看,未必能用 - -RBAC:角色是核心,设计权限表 - -管理员和普通用户被授予不同的权限,普通用户只能去修改和查看个人信息,而不能创建用户和冻结用户,而管理员由于被授予所有权限,所以可以做所有操作 - -## 预习 SKU - -SKU 英文全称为Stock Keeping Unit,简称 SKU ,是产品入库后一种编码归类方法,也是库存控制的最小单位。一款商品,每个颜色,每个尺码,每一型号等都有出现一个 sku ,便于电商品牌识别商品。 - -既然 sku 被定义为最小存货单元,商家就可以选择自己设定 sku,一般来说是以件、盒、个、托盘等为单位。 - -- 大厂的 sku 就可以是一箱, -- 超市的 sku 就可以是一盒, -- 零售商的 sku 可以是一个。 - -## RBAC练习 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 19:11:21 */ -/*==============================================================*/ -create database school charset utf8; - -use school; - -drop table if exists message; - -drop table if exists role; - -drop table if exists role_message; - -drop table if exists user; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: message */ -/*==============================================================*/ -create table message -( - message_id int not null auto_increment, - message_name varchar(10) not null, - message_comment varchar(20) not null, - message_type varchar(10) not null, - primary key (message_id) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name varchar(10) not null, - role_comment char(10) not null, - primary key (role_id) -); - -/*==============================================================*/ -/* Table: role_message */ -/*==============================================================*/ -create table role_message -( - message_id int not null, - role_id int not null, - primary key (message_id, role_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_name varchar(5) not null, - user_pwd char(6) not null, - primary key (user_id) -); - -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - role_id int not null, - user_id int not null, - primary key (role_id, user_id) -); - -alter table role_message add constraint FK_role_message foreign key (message_id) - references message (message_id) on delete restrict on update restrict; - -alter table role_message add constraint FK_role_message2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - - - --- ---------------------------- --- Records of message --- ---------------------------- -INSERT INTO `message` VALUES (1, '学生信息'); -INSERT INTO `message` VALUES (2, '教师信息'); -INSERT INTO `message` VALUES (3,'首页' ); -INSERT INTO `message` VALUES (4, '工资信息'); - --- ---------------------------- --- Records of role --- ---------------------------- -INSERT INTO `role` VALUES (1, '校长'); -INSERT INTO `role` VALUES (2, '教师'); -INSERT INTO `role` VALUES (3, '学生'); - --- ---------------------------- --- Records of role_message --- ---------------------------- -INSERT INTO `role_message` VALUES (1, 1); -INSERT INTO `role_message` VALUES (2, 2); -INSERT INTO `role_message` VALUES (3, 3); -INSERT INTO `role_message` VALUES (4, 2); -INSERT INTO `role_message` VALUES (1, 2); -INSERT INTO `role_message` VALUES (2, 1); -INSERT INTO `role_message` VALUES (3, 2); -INSERT INTO `role_message` VALUES (1, 3); -INSERT INTO `role_message` VALUES (4, 3); --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '张三', '123456'); -INSERT INTO `user` VALUES (2, '李四', '123456'); -INSERT INTO `user` VALUES (3, '王五', '123456'); -INSERT INTO `user` VALUES (4, '张吴', '123456'); - --- ---------------------------- --- Records of user_role --- ---------------------------- -INSERT INTO `user_role` VALUES (1, 1); -INSERT INTO `user_role` VALUES (2, 2); -INSERT INTO `user_role` VALUES (3, 2); -INSERT INTO `user_role` VALUES (3, 4); -``` \ No newline at end of file diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.21 ksu\345\222\214psu.png" "b/49 \346\235\216\350\210\222\346\261\266/9.21 ksu\345\222\214psu.png" deleted file mode 100644 index 48bbedf537fa53c83c76aa25bc37c7fd65c861ad..0000000000000000000000000000000000000000 Binary files "a/49 \346\235\216\350\210\222\346\261\266/9.21 ksu\345\222\214psu.png" and /dev/null differ diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.21ksu.md" "b/49 \346\235\216\350\210\222\346\261\266/9.21ksu.md" deleted file mode 100644 index 5d6d5d8ef22104970f7597904dee29dc01550d02..0000000000000000000000000000000000000000 --- "a/49 \346\235\216\350\210\222\346\261\266/9.21ksu.md" +++ /dev/null @@ -1,139 +0,0 @@ -## SKU - -SKU 英文全称为Stock Keeping Unit,简称 SKU ,是产品入库后一种编码归类方法,也是库存控制的最小单位,SKU是指一款商品,每款都有出现一个SKU。SKU 号包含一种产品的品牌、型号、配置、等级、包装容量、单位、生产日期、保质期、用途、价格、产地等属性,一件产品的属性与其他产品都不一样,这样的商品就是一个单品。 - -## SPU与SKU的区别 - -一般SPU 与SKU 是一对一,或者一对多的关系;如果一对多的话就是不同的规格 - -例子:SPU就是商品的“款”;SKU就是商品的“件” - -SPU指一个商品集合,一般来说就是一个集合链。一个服装的集合链会包括相似款式和不同的尺码,SKU则是最小品类单元,同一个款式的衣服不同的尺码也算不同的SKU。SKU多见于前台的商品编号,SPU多见于后台的商品管理 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:31:44 */ -/*==============================================================*/ -create database jd1 charset utf8; - -use jd1; - -drop table if exists type; - -drop table if exists sku; - -drop table if exists sku_type_value; - -drop table if exists spu; - -drop table if exists `value`; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name varchar(10) not null, - primary key (type_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int not null, - sku_caption varchar(40) not null, - sku_price numeric(4,0) not null, - sku_num int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: sku_attribute_value */ -/*==============================================================*/ -create table sku_type_value -( - relevance_id int not null auto_increment, - sku_id int not null, - value_id int not null, - type_id int not null, - primary key (relevance_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_comment varchar(50) not null, - primary key (spu_id) -); - -/*==============================================================*/ -/* Table: value */ -/*==============================================================*/ -create table `value` -( - value_id int not null auto_increment, - value_name varchar(10) not null, - primary key (value_id) -); - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -alter table sku_type_value add constraint FK_Relationship_2 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table sku_type_value add constraint FK_Relationship_3 foreign key (value_id) - references `value` (value_id) on delete restrict on update restrict; - -alter table sku_type_value add constraint FK_Relationship_4 foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - - - -INSERT INTO `spu` VALUES (1, '华为 Mate 60 Pro', '遥遥领先'); - -INSERT INTO `type` VALUES (1, '颜色'); -INSERT INTO `type` VALUES (2, '容量'); - -INSERT INTO `value` VALUES (1, '雅川青'); -INSERT INTO `value` VALUES (2, '雅丹黑'); -INSERT INTO `value` VALUES (3, '南糯紫'); -INSERT INTO `value` VALUES (4, '白沙银'); -INSERT INTO `value` VALUES (5, '12GB+512GB'); -INSERT INTO `value` VALUES (6, '12GB+1TB'); - -INSERT INTO `sku` VALUES (1, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+1TB 雅丹黑', 7999, 10); -INSERT INTO `sku` VALUES (2, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+1TB 雅川青', 7999, 10); -INSERT INTO `sku` VALUES (3, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+1TB 南糯紫', 7999, 10); -INSERT INTO `sku` VALUES (4, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+1TB 白沙银', 7999, 10); -INSERT INTO `sku` VALUES (5, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+512TB 雅丹黑', 6999, 10); -INSERT INTO `sku` VALUES (6, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+512TB 雅川青', 6999, 10); -INSERT INTO `sku` VALUES (7, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+512TB 南糯紫', 6999, 10); -INSERT INTO `sku` VALUES (8, 1, '华为(HUAWEI)旗舰手机 Mate 60 Pro 12GB+512TB 白沙银', 6999, 10); - -INSERT INTO `sku_type_value` VALUES (1, 2, 1, 2); -INSERT INTO `sku_type_value` VALUES (2, 2, 2, 6); -INSERT INTO `sku_type_value` VALUES (3, 1, 1, 1); -INSERT INTO `sku_type_value` VALUES (4, 1, 2, 6); -INSERT INTO `sku_type_value` VALUES (5, 3, 1, 3); -INSERT INTO `sku_type_value` VALUES (6, 3, 2, 6); -INSERT INTO `sku_type_value` VALUES (7, 4, 1, 4); -INSERT INTO `sku_type_value` VALUES (8, 4, 2, 6); -INSERT INTO `sku_type_value` VALUES (9, 5, 1, 2); -INSERT INTO `sku_type_value` VALUES (10, 5, 2, 5); -INSERT INTO `sku_type_value` VALUES (11, 6, 1, 1); -INSERT INTO `sku_type_value` VALUES (12, 6, 2, 5); -INSERT INTO `sku_type_value` VALUES (13, 7, 1, 3); -INSERT INTO `sku_type_value` VALUES (14, 7, 2, 5); -INSERT INTO `sku_type_value` VALUES (15, 8, 1, 4); -INSERT INTO `sku_type_value` VALUES (16, 8, 2, 5); -``` \ No newline at end of file diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.22\351\242\204\344\271\240\351\253\230\347\272\247\346\225\260\346\215\256\345\272\223.md" "b/49 \346\235\216\350\210\222\346\261\266/9.22\351\242\204\344\271\240\351\253\230\347\272\247\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index 6d0b79b5257dda126a45d82e21b560188bff7c66..0000000000000000000000000000000000000000 --- "a/49 \346\235\216\350\210\222\346\261\266/9.22\351\242\204\344\271\240\351\253\230\347\272\247\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,133 +0,0 @@ -## 数据库 - -##### 1.事务 - -1. 什么是事务? - -为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败 - -2.事务的四个特征: - -1. 原子性:事务包含的这一系列操作,要么全部成功,要么全部失败(由DBMS的事务管理子系统来实现的) -2. 一致性:事务完成之后,不会将非法的数据写入数据库(由DBMS的完整性子系统执行测试任务) -3. 隔离性:多个事务 可以在一定程度上并发执行(由DBMS的并发控制子系统实现) -4. 持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上) - -### 创建存储过程语法 - -使用 create procedure 语句创建存储过程 - -#### 声明语句结束符 - -```mysql -delimiter $$ - -delimiter // -``` - -#### 创建 mysql 存储过程、存储函数 - -```mysql -create procedure 存储过程名(参数) -``` - -#### 存储过程体 - -```mysql -create function 存储函数名(参数) -``` - -#### 参数类型有三种: - -```mysql -IN: 输入参数,该参数的值必须在调用该存储过程时指定,在存储过程内部使用, 不能返回。 - -缺省值是IN。 - -OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - -INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回。 -``` - -### 事务 - - 为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - -# - -#### 隔离级别 - - 隔离级别从低到高依次是"读未提交"、“读已提交”、“可重复读取”和“序列化”,隔离级别越高,性能越低。mysql 数据库默认隔离级别是“可重复读取”,oracle是“读已提交”。数据库底层使用的“加锁”的机制来实现不同的隔离级别,包括对整个表加锁,对表中的行加锁。 - -### 视图 - -在已有的表或者视图上创建的虚拟表。 - -#### 创建视图 - -```mysql -create view 视图名 as select -``` - -注:可以对单表或者多表进行查询,数据库会将视图的定义保存下来。 - -可以对(单表)视图进行一些增删改查操作,这些操作会影响到原始的表。 - -#### 删除视图 - -```mysql -drop view 视图名 -``` - -### 索引 - - 为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - - 注:索引类似于一本书的目录 - -#### 创建索引 - -```mysql -create index 索引名 on 表名(字段列表) -``` - -在经常作为查询条件的字段加索引,除此以外,还要在分组、过滤、排序及联合查询的字段上加索引。 - -#### 删除索引 - -```mysql -drop index 索引名 on 表名 -``` - -### 锁 - -共享锁(S锁,读锁)和排他锁(X锁,写锁)——行锁 - -``` -共享锁:若事务A 对某行数据加S锁,此时允许其他事务对该行数据加S锁,即可以有多个事务共同读取改行数 据,但是不允许其他事务对该数据加X锁 - -排他锁(X锁,写锁,独占锁):若事务A对某行数据加X锁,此时不允许其他事务对该行数据加任何锁 -``` - -数据库中 - -1. 数据库中进行增,删,改操作时,会自动给行添加排他锁,行数据添加上了排他锁,不允许其他事务对该行数据加任何锁 - -2. 数据库中进行查(select)操作时,对数据不加任何锁 - -3. 给行数据手动添加共享锁: - - ```mysql - select ..from..lock in share mode - select..from .. for share - ``` - -4. 添加排他锁: - - ```mysql - select...from...for update - ``` - - - - diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.26\350\247\206\345\233\276\347\273\203\344\271\240\351\242\230.md" "b/49 \346\235\216\350\210\222\346\261\266/9.26\350\247\206\345\233\276\347\273\203\344\271\240\351\242\230.md" deleted file mode 100644 index 1c63269ba8ad7a398c4f28fd8a7fb1c8c436103a..0000000000000000000000000000000000000000 --- "a/49 \346\235\216\350\210\222\346\261\266/9.26\350\247\206\345\233\276\347\273\203\344\271\240\351\242\230.md" +++ /dev/null @@ -1,221 +0,0 @@ -#第14章_视图的课后练习 - -USE view_db; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE view employee_nu as -select LAST_NAME 姓名,employee_id 员工号,department_id 部门号 FROM employees; - -select * from employee_nu; - -#2. 显示视图的结构 -desc employee_nu; - -#3. 查询视图中的全部内容 -select * from employee_nu; - -#4. 将视图中的数据限定在部门号是80的范围内 -drop view if exists employee_nu; -create or replace view employee_nu AS -select LAST_NAME 姓名,employee_id 员工号,department_id 部门号 FROM employees where department_id=80; - -select * from employee_nu; - -#练习2: - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -drop view if exists emp_v1; -create view emp_v1 as -select last_name 姓名,salary 工资,email 邮箱,phone_number 电话号码 from employees where phone_number like "011%"; - -select * from emp_v1; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -drop view if exists emp_v1; -create view emp_v1 as -select last_name 姓名,salary 工资,email 邮箱,phone_number 电话号码 from employees where phone_number like "011%" and email like "%e%"; - -select * from emp_v1; - -#3. 向 emp_v1 插入一条记录,是否可以? - -INSERT INTO emp_v1 VALUES('hhh',87000,'hhhh','5201314'); - - - - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE emp_v1 -set 工资=工资+1000; - -#5. 删除emp_v1中姓名为Olsen的员工 - DELETE from emp_v1 - where last_name ='Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -drop view if exists emp_v2; -CREATE view emp_v2 as -select department_id 部门号,MAX(salay) FROM employees GROUP BY department_id HAVING max(salary)>12000; - -select * from emp_v2; - - - -#第14章_视图的课后练习 - -USE view_db; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE view employee_nu as -select LAST_NAME 姓名,employee_id 员工号,department_id 部门号 FROM employees; - -select * from employee_nu; - -#2. 显示视图的结构 -desc employee_nu; - -#3. 查询视图中的全部内容 -select * from employee_nu; - -#4. 将视图中的数据限定在部门号是80的范围内 -drop view if exists employee_nu; -create or replace view employee_nu AS -select LAST_NAME 姓名,employee_id 员工号,department_id 部门号 FROM employees where department_id=80; - -select * from employee_nu; - -#练习2: - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -drop view if exists emp_v1; -create view emp_v1 as -select last_name 姓名,salary 工资,email 邮箱,phone_number 电话号码 from employees where phone_number like "011%"; - -select * from emp_v1; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -drop view if exists emp_v1; -create view emp_v1 as -select last_name 姓名,salary 工资,email 邮箱,phone_number 电话号码 from employees where phone_number like "011%" and email like "%e%"; - -select * from emp_v1; - -#3. 向 emp_v1 插入一条记录,是否可以? - -INSERT INTO emp_v1 VALUES('hhh',87000,'hhhh','5201314'); - - - - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE emp_v1 -set 工资=工资+1000; - -#5. 删除emp_v1中姓名为Olsen的员工 - DELETE from emp_v1 - where last_name ='Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -drop view if exists emp_v2; -CREATE view emp_v2 as -select department_id 部门号,MAX(salay) FROM employees GROUP BY department_id HAVING max(salary)>12000; - -select * from emp_v2; - - - -#第14章_视图的课后练习 - -USE view_db; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE view employee_nu as -select LAST_NAME 姓名,employee_id 员工号,department_id 部门号 FROM employees; - -select * from employee_nu; - -#2. 显示视图的结构 -desc employee_nu; - -#3. 查询视图中的全部内容 -select * from employee_nu; - -#4. 将视图中的数据限定在部门号是80的范围内 -drop view if exists employee_nu; -create or replace view employee_nu AS -select LAST_NAME 姓名,employee_id 员工号,department_id 部门号 FROM employees where department_id=80; - -select * from employee_nu; - -#练习2: - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -drop view if exists emp_v1; -create view emp_v1 as -select last_name 姓名,salary 工资,email 邮箱,phone_number 电话号码 from employees where phone_number like "011%"; - -select * from emp_v1; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -drop view if exists emp_v1; -create view emp_v1 as -select last_name 姓名,salary 工资,email 邮箱,phone_number 电话号码 from employees where phone_number like "011%" and email like "%e%"; - -select * from emp_v1; - -#3. 向 emp_v1 插入一条记录,是否可以? - -INSERT INTO emp_v1 VALUES('hhh',87000,'hhhh','5201314'); - - - - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -UPDATE emp_v1 -set 工资=工资+1000; - -#5. 删除emp_v1中姓名为Olsen的员工 - DELETE from emp_v1 - where last_name ='Olsen'; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create view emp_v2 as select department_id 部门id,max(salary) 最高工资 from employees group by department_id having max(salary)>12000; - - - -#7. 向 emp_v2 中插入一条记录,是否可以? - -INSERT into emp_v2 VALUES('LLL','1702',80,90000); - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view if exists emp_v1,emp_v2; -show tables; - - - -#7. 向 emp_v2 中插入一条记录,是否可以? - -INSERT into emp_v2 VALUES('LLL','1702',80,90000); - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view if exists emp_v1,emp_v2; -show tables; - - - -#7. 向 emp_v2 中插入一条记录,是否可以? - -INSERT into emp_v2 VALUES('LLL','1702',80,90000); - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view if exists emp_v1,emp_v2; -show tables; diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.5\347\254\254\344\270\200\350\257\276.md" "b/49 \346\235\216\350\210\222\346\261\266/9.5\347\254\254\344\270\200\350\257\276.md" deleted file mode 100644 index f052fd3560e0f2f5c86f409537e6e548eb56bf04..0000000000000000000000000000000000000000 --- "a/49 \346\235\216\350\210\222\346\261\266/9.5\347\254\254\344\270\200\350\257\276.md" +++ /dev/null @@ -1,29 +0,0 @@ -大一 - -1. mysql数据库 - -2. JavaScript 原生js (Ajax)做了一些封装成一些框架jQuery,Common,js Html ,css,js - -3. MVC框架。SSM(Maven,Spring,SpringMvc,MyBatis) - - - -大二 - -1. Node.js v8引擎 - -2. Vue.js 前端框架,简易开发,有UI框架配合,美团,饿了么(element-ui),UI框架 - -3. SprinngBoot(Redis.WebAp) 非关系型,NO--SQL,key--value键值对的形式存在 age:18 - - - -实训 - -Linux服务器:Nginx,MongoDB 非关系型 - -项目中可能实现的技术:中间体,签权 - -小程序,uniapp移动端开发 - - diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.6 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" "b/49 \346\235\216\350\210\222\346\261\266/9.6 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" deleted file mode 100644 index 95fe0e1d3c93eb925aa1309501b21c008d955793..0000000000000000000000000000000000000000 --- "a/49 \346\235\216\350\210\222\346\261\266/9.6 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" +++ /dev/null @@ -1,155 +0,0 @@ -以我们学院的组织框架,及学习课程来做系统,院系,专业,班级,学生,教师,课程,课程表,教室 - -```java -create database school charset utf8; - -use school; - --- 院系表 -create table department( - d_id int primary key, - d_name varchar(20) -); -insert into department values -(1,'软件工程学院'); -(2,'财经商贸学院'); - --- 专业表 -create table speciality( - s_id int primary key, - s_name varchar(10), - d_id int, - foreign key (d_id) references department(d_id) -); -insert into speciality values -(101,'软件技术',1); -(102,'会计',2); - --- 教室 -create table classroom( -r_id int PRIMARY KEY, -r_name varchar(10) -); -insert into classroom values -(1,'实训一'), -(2,'实训五'); - --- 班级 -create table class( - c_id int primary key, - c_name varchar(10), - s_id int, - foreign key (s_id) references speciality(s_id) -); -insert into class values -(1,'软件技术1班',101), -(2,'软件技术2班',101); - --- 课程 -CREATE TABLE course( - couseId int PRIMARY key, - courseName varchar(10), - c_id int, - r_id int, - foreign key (c_id) references class(c_id), - foreign key (r_id) references classroom(r_id) -); -insert into course VALUES -(1,'Java',1,1), -(2,'MySQL',2,2); - --- 教师 -create table teacher( - t_id int primary key, - t_name varchar(10), - couseId int, - foreign key (couseId) references course(couseId) -); -insert into teacher values -(1,'一一',1), -(2,'阿九',2); - --- 课程表 -create table `select` ( - selectId int primary key, - couseId int, - time varchar(20), - t_id int, - r_id int, - foreign key (couseId) references course(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references classroom(r_id) -); -insert into `select` values -(1,1,'周一上午',2,1), -(2,2,'周一下午',1,2); - --- 学生 -create table student ( - id int primary key, - name varchar(10), - c_id int, - selectId int, - foreign key (c_id) references class(c_id), - foreign key (selectId) references `select`(selectId) -); -insert into student values -(2301,'李四',1,1), -(2302,'王五',2,2), -(2303,'张三',1,1); - -``` - -数据库关系 - -数据库设计 - -根据用户需求和开发的系统的需求,设计出符合对应的DBMS的需求的数据库结构,使其能有效的存储和管理数据。 - -### 表与表的关系 - -#### 一对一(1,1) - -例如:身份证与学生(将其中任意一表中的主键,放到另一个表当外键) - -#### 一对多(1,N) - -例如:教师与课程(将一所在的表的主键,放到多的表当外键) - -#### 多对多(M,N) - -例如:课程与学生(必须第三张表,将前两张表的主键放进来当外键) - -## E-R图 - -#### 1.概念 - -关系实体图,简记E-R图。E实体(表)、R关系(字段)、实体关系图,是指以实体、关系、属性三个基本概念概括数据的基本结构,从而描述静态数据结构的概念模式 - -#### 2.要素 - -实体、属性和关系 - - - - - -大一 - -1.mysql 数据库高级 - -2.Java Script .原生js - -3.MVC 框架。SSM - -大二 - -1.Node.js v8引擎 - -2.Vue.js 前端框架,简易开发,有UI框架配合,美团,饿了么(element-ui),UI框架 - -3.SpringBoot(Redis,WebAPI) 非关系式 ,NO-SQL,key-value键值对的形式的存在 age;18 - - - - diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.7\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" "b/49 \346\235\216\350\210\222\346\261\266/9.7\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" deleted file mode 100644 index fc10d4d96b100e6c1868615b5ba746a93e7b660f..0000000000000000000000000000000000000000 --- "a/49 \346\235\216\350\210\222\346\261\266/9.7\346\225\260\346\215\256\345\272\223\351\253\230\347\272\247.md" +++ /dev/null @@ -1,97 +0,0 @@ -- ## 数据库高级 -1. 什么是ER图? - 1.实体关系图。 - 2.三要素:实体,属性,关系。 - -## 数据库的范式 - -1.第一范式:要求字段的内容,不可再分割,为的是保证数据的原性。 - -例:姓名;省份,城市,区,县,街道 - -2.第二范式:要求在满足第一范式胡基础上,要求非主键字段要完全依赖主键(非主键,要依赖整个联合主键),而不能只依赖部分 - -3.第三范式:满足第二范式的前提上,要求非主键属性要直接依赖于主键 - -```java --- 创建数据库 -create database school2 charset utf8; - --- 使用数据库 -use school2; - --- 院系表 -CREATE TABLE department( - de_id int PRIMARY key auto_increment, - de_name VARCHAR(20), - de_tel varchar(20) -); - - --- 专业表 -create table major( - ma_id int primary key auto_increment, - ma_name varchar(10), - de_id int, - foreign key (de_id) references department(de_id) -); - - --- 班级表 -create table class( - cl_id int primary key, - cl_name varchar(10), - m_id int, - foreign key (m_id) references major(m_id) -); - - --- 学生表 -create table student( - stu_id int primary key, - stu_name varchar(5), - stu_gender varchar(1), - stu_age int, - cl_id int, - foreign key (cl_id) references class(cl_id) -); - --- 课程信息表 -create table course( - cu_id int primary key, - cu_name varchar(6), - stu_id int, - foreign key (stu_id) references student(stu_id) -); - --- 教师表 -create table teacher( - te_id int primary key, - te_name varchar(5), - cu_id int, - foreign key (cu_id) references course(cu_id) -); - --- 教室表 -create table classroom( - cr_id int primary key, - cr_name varchar(6), - cr_address varchar(20), - cu_id int, - foreign key (cu_id) references course(cu_id) -); - --- 课程表 -create table timetable( - ti_week varchar(3), - ti_time int, - cl_id int, # 班级编号 - foreign key (cl_id) references class(cl_id), - stu_id int, # 学生编号 - foreign key (stu_id) references student(stu_id), - cu_id int, # 课程编号 - foreign key (cu_id) references course(cu_id), - te_id int, # 教师编号 - foreign key (te_id) references teacher(te_id) -); -``` diff --git "a/49 \346\235\216\350\210\222\346\261\266/9.8\345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" "b/49 \346\235\216\350\210\222\346\261\266/9.8\345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index 91c29449dfc0341c873a40da50745fb98d1142e7..0000000000000000000000000000000000000000 --- "a/49 \346\235\216\350\210\222\346\261\266/9.8\345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,122 +0,0 @@ -### 9.8笔记 - -第一步:创建概念模型(类似ER图) CDM (用户角度) -第二步:转换成逻辑模型 LDM (计算机角度) -第三步:转换成物理模型 PDM (数据库角度) -第四步:生成DDL - -### 数据库设计步骤 - -1.需求分析,了解要开发的系统的需求,明确数据和格式 -2.概念结构设计:将需求分析得到的抽象成概念模型,将ER图向关系模型转化 -3.逻辑结构设计:将概念结构转化成DBMS所支持的数据模型 -4.物理结构设计:将概念模型,转换成选定数据库管理系统需要的物理模型 -5.数据库实施:根据物理模型生成对应的DDL -6.数据库维护 - -#### 图书馆数据库 - -```java -CREATE DATABASE book charset utf8; -use book; -create table ad -( - A_id int not null, - L_name double not null, - A_password int not null, - primary key (A_id) -); - -/*==============================================================*/ -/* Table: books */ -/*==============================================================*/ -create table books -( - b_id int not null, - j_loan int not null, - time int not null, - b_name char(10) not null, - b_author char(10) not null, - b_press char(20) not null, - primary key (b_id) -); - -/*==============================================================*/ -/* Table: guanl */ -/*==============================================================*/ -create table guanl -( - st_id int not null, - j_loan int not null, - primary key (st_id, j_loan) -); - -/*==============================================================*/ -/* Table: jieyue */ -/*==============================================================*/ -create table jieyue -( - j_loan int not null, - j_also int not null, - primary key (j_loan) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - L_name double not null, - st_id int not null, - primary key (L_name) -); - -/*==============================================================*/ -/* Table: manage */ -/*==============================================================*/ -create table manage -( - time int not null, - A_id int not null, - mode char(20) not null, - primary key (time) -); - -/*==============================================================*/ -/* Table: student */ -/*==============================================================*/ -create table student -( - st_id int not null, - L_name double not null, - st_name char(5) not null, - st_pa int not null, - st_sex char(1) not null, - primary key (st_id) -); - -alter table ad add constraint FK_yongyou5 foreign key (L_name) - references library (L_name) on delete restrict on update restrict; - -alter table books add constraint FK_guanl5 foreign key (time) - references manage (time) on delete restrict on update restrict; - -alter table books add constraint FK_guanli foreign key (j_loan) - references jieyue (j_loan) on delete restrict on update restrict; - -alter table guanl add constraint FK_guanl foreign key (st_id) - references student (st_id) on delete restrict on update restrict; - -alter table guanl add constraint FK_guanl2 foreign key (j_loan) - references jieyue (j_loan) on delete restrict on update restrict; - -alter table library add constraint FK_yongyou foreign key (st_id) - references student (st_id) on delete restrict on update restrict; - -alter table manage add constraint FK_yongy2 foreign key (A_id) - references ad (A_id) on delete restrict on update restrict; - -alter table student add constraint FK_yongyou2 foreign key (L_name) - references library (L_name) on delete restrict on update restrict; - -``` diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230905 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\200\350\212\202\350\257\276.md" "b/50 \345\274\240\350\265\267\347\221\236/20230905 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\200\350\212\202\350\257\276.md" deleted file mode 100644 index f0940317e2a6f1f2dd72ba58fb85b5d8213e07a4..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230905 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\270\200\350\212\202\350\257\276.md" +++ /dev/null @@ -1,32 +0,0 @@ -## 数据库高级 - -##### 开学第一课: - -我们要了解一下本学期的学习任务 - -实际应用(实操)学习mysql高级 MVC框架等 - -### 大二下 - -Node.js(前端) - -vue.js(前端) - -spring Boot (redis,webApi) - - - - 1.Linux服务器 Nginx,mogoDB - -2. 项目中可能实现的技术:中间件 ,签权 ,鉴别权限 -3. 小程序 uniapp移动端开发 - -### 感想: - -1.我们应该多关注招聘网站以及招聘职位的岗位要求,为我们的学习目标 可以更好的适应今后的工作 - -2.在学习的课余时间自己学习一些拓展的知识 - -3.树立目标持之以恒 - -4.学会做笔记,认真巩固复习当天的知识 diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230906 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\272\214\350\212\202\350\257\276 E-R\345\233\276.md" "b/50 \345\274\240\350\265\267\347\221\236/20230906 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\272\214\350\212\202\350\257\276 E-R\345\233\276.md" deleted file mode 100644 index c8eb7925e5ce455ad94180191138ca3a62bc8525..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230906 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\347\254\254\344\272\214\350\212\202\350\257\276 E-R\345\233\276.md" +++ /dev/null @@ -1,140 +0,0 @@ -### 数据库高级 - -**一.数据库设计分为六个阶段** - -1. 需求分析 -2. 概念结构设计 -3. 逻辑结构设计 -4. 物理结构设计 -5. 数据库实施 -6. 数据库维护 - -需求分析和概念结构设计独立于任何数据库管理系统,逻辑结构设计和物理结构设计与选用的数据库管理系统密切相关。 - -#### 二.E-R模型 - -描述概念模型的工具:E-R模型 - -**三.实体之间的联系** - -(1)两个实体型之间的联系 - -1. 一对一 - 将其中任一表主键,放到另一表当外键 - 如果对于实体集 A 中的每一个实体,实体集 B 中至多有一个(也可以没有)实体与之联系,反之亦然,则称实体集 A 与实体集 B 具有一对一联系,记为 1:1。 - 如:学校里一个班级只有一个正班长,而一个班长只在一个班中任职,则班级与班长之间具有一对一联系。 -2. 一对多的关系(多对一的关系) - 将一所在表的主键,放到多的表当外键 - 如果对于实体集 A 中的每一个实体,实体集 B 中有 n 个实体( n⩾0 )与之联系,反之,对于实体集 B 中的每一个实体,实体集 A 中至多只有一个实体与之联系,则称实体集 A 与实体集 B 有一对多联系,记为 1:n。 - 如: 一个班级中有若干名学生,而每个学生只在一个班级中学习,则班级与学生之间具有一对多联系。 -3. 多对多的关系 - 必须有第三张表,作中转表,将前面两个表主键放进来当外键 - 如果对于实体集 A 中的每一个实体,实体集 B 中有 n 个实体(n⩾0 )与之联系,反之,对于实体集 B 中的每一个实体,实体集 A 中也有 m 个实体(m⩾0 )与之联系,则称实体集 A 与实体集 B 具有多对多联系,记为 m:n。 - 如:一门课程同时有若干个学生选修,而一个学生可以同时选修多门课程,则课程与学生之间具有多对多联系。 - -(2)两个及以上实体之间的关系 - -一般的来说,两个以上的实体之间也存在着一对一、一对多、多对多的联系 - -##### E-R图 - -​ E-R图 有三大要素:**实体、属性、关系** - -(1). 实体型:用矩形表示,矩形框内写明实体名 也可以通俗点理解MySQL当中的表 - -(2). 属性:用椭圆形表示,并用无向变将其与相应的实体型连接起来 可以理解成MySQL表当中的字段 - -(3). 联系用菱形表示,菱形框内写明联系名,用无向边分别与有关实体型连接起来,同时在无向边旁标上联系的类型(1:1、1:n 或 m:n)。 类似于外键约束 - -~~~MySQL -CREATE DATABASE school CHARSET utf8; -use school; --- 院系表 -CREATE TABLE faculty( - d_id INT PRIMARY KEY, - d_name VARCHAR(255) -); -INSERT INTO faculty VALUES - (1,'软件工程学院'); --- 专业表 -CREATE TABLE specialty( - S_id int PRIMARY KEY, - S_name VARCHAR(255), - d_id int, - FOREIGN KEY (d_id) REFERENCES faculty(d_id) -); -INSERT INTO specialty VALUES - (1,'软件技术',1); --- 班级表 -CREATE TABLE class( - C_id INT PRIMARY KEY, - C_name VARCHAR(20), - grade VARCHAR(5), - s_id INT, - FOREIGN KEY (s_id) REFERENCES specialty(s_id) -); -INSERT INTO class VALUES - (1,'软件技术1班','22级',1), - (2,'软件技术2班','22级',1), - (3,'软件技术7班','22级',1), - (4,'软件技术9班','22级',1); --- 课程 -CREATE TABLE course( - couseId int PRIMARY key, - courseName varchar(10), - c_id int, - r_id int, - foreign key (c_id) references class(C_id), - foreign key (r_id) references classroom(r_id) -); -insert into course VALUES - (1,'Java',1,1), - (2,'MySQL',2,2); --- 教室 -create table classroom( - r_id int PRIMARY KEY, - r_name varchar(10) -); - insert into classroom values -(1,'实训二'), -(2,'实训八'); --- 课程表 -create table `select` ( - selectId int primary key, - couseId int, - time varchar(20), - t_id int, - r_id int, - foreign key (couseId) references course(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references classroom(r_id) -); -insert into `select` values -(1,1,'周一8:00-11:40',2,1), -(2,2,'周一14:00-17:40',1,2); --- 教师 -create table teacher( - t_id int primary key, - t_name varchar(10), - couseId int, - foreign key (couseId) references course(couseId) -); -insert into teacher values -(1,'张三',1), -(2,'李四',2); --- 学生 -CREATE TABLE student ( - stu_name VARCHAR(25), - stu_id INT PRIMARY KEY, - C_id INT, - select_id INT, - foreign key (C_id) references class(C_id), - FOREIGN KEY (select_id) REFERENCES `select`(selectId) -); -INSERT INTO student VALUES - ('王五',17,1,1), - ('陈六',50,2,2), - ('张琦',66,3,1), - ('李八',31,4,1); -~~~ - diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" "b/50 \345\274\240\350\265\267\347\221\236/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" deleted file mode 100644 index c7e8136401b41a1548a5486a253bf789b0b637e3..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" +++ /dev/null @@ -1,95 +0,0 @@ -### 第一范式: - -要求字段的内容,不可再分割,为的是保证数据的原子性 - -例:姓名,省份、城市、区具、地址址 -### 第二范式: - -要求在满足第一范式的基础上,要求非主键字投要完全依赖主健(非主键雪完全依赖整个联合主键,而不只很赖部分) - -例:小明的存在,必须贾依父亲和母亲的存在 -### 第三范式: - -满足第二范式的前提下,要求非主键属性要有接依赖于主键 - -示例:儿子依赖爸爸,爸爸依赖爷爷。其中儿子与爷爷属于间接依赖,则不属于第三范式。 -## 数据库设计步聚 - -1.需求分析(实体分析),再进行属性分析 -2.夯析Visio图 -3.在mysql建表 - -```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/50 \345\274\240\350\265\267\347\221\236/20230909 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/50 \345\274\240\350\265\267\347\221\236/20230909 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index 0aca77d31ae50ded89009de443ba74f87c29ace7..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230909 \345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,115 +0,0 @@ -## PowerDesigner - -第一步:创建概念模型(类似E-R图)CDM以用户角度 - -第二步:转换成逻辑模型(LDM) 以计算机角度 - -第三步:转换成物理模型 PDM(以数据库角度) - -第四步:生成DDL - -数据库设计步骤 - -1.需求分析,了解要开发的系统的需求,明确数据和格式 - -2.概念结构设计:将需求分析得到的抽象成概念模型,将ER图向关系模型转化 - -3.逻辑结构设计:将概念结构转化成DBMS所支持的数据模型 - -4.物理结构设计:将概念模型,转换成选定数据库管理系统需要的物理模型 - -5.数据库实施:根据物理模型生成对应的DDL - -6.数据库维护 - -通过本次作业我意识到逻辑思维真的很重要 - - - -```java -CREATE DATABASE test22 charset utf8; -use test22; - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 10:13:52 */ -/*==============================================================*/ - - -drop table if exists bookrent; - -drop table if exists bookreturn; - -drop table if exists bookse; - -drop table if exists uesr; - -/*==============================================================*/ -/* Table: bookrent */ -/*==============================================================*/ -create table bookrent -( - rent_id numeric(10,0) not null, - book_id int, - rent_date date not null, - book_odate date not null, - primary key (rent_id) -); - -/*==============================================================*/ -/* Table: bookreturn */ -/*==============================================================*/ -create table bookreturn -( - re_id numeric(10,0) not null, - book_id int, - re_date date not null, - primary key (re_id) -); - -/*==============================================================*/ -/* Table: "bookse-+" */ -/*==============================================================*/ -create table bookse -( - book_id int not null auto_increment, - user_id numeric(10,0) not null, - book_name char(5) not null, - book_bname char(10) not null, - book_number numeric(30,0) not null, - floor numeric(10,0) not null, - price int not null, - book_bid char(65) not null, - primary key (book_id) -); - -/*==============================================================*/ -/* Table: uesr */ -/*==============================================================*/ -create table uesr -( - user_id numeric(10,0) not null, - re_id numeric(30,0), - user_name char(10) not null, - password numeric(10,0) not null, - primary key (user_id) -); - -alter table bookrent add constraint FK_Relationship_2 foreign key (book_id) - references bookse (book_id) on delete restrict on update restrict; - -alter table bookreturn add constraint FK_Relationship_5 foreign key (book_id) - references bookse (book_id) on delete restrict on update restrict; - -alter table bookse add constraint FK_rent foreign key (user_id) - references uesr (user_id) on delete restrict on update restrict; - -alter table uesr add constraint FK_Relationship_4 foreign key (re_id) - references bookreturn (re_id) on delete restrict on update restrict; - - -``` - - - diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230913 \345\275\261\350\247\206.md" "b/50 \345\274\240\350\265\267\347\221\236/20230913 \345\275\261\350\247\206.md" deleted file mode 100644 index 7553a6594ef00e2dae9ea44861ed0dda779c3e0a..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230913 \345\275\261\350\247\206.md" +++ /dev/null @@ -1,132 +0,0 @@ -```mysql -###这次作业让我知道了温故而知新的重要性,以后我要好好复习过去学过的知识,多钻研MySQL,增强自己的逻辑思维能力 -create database test0913 charset utf8; -use test0913; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 9:03:16 */ -/*==============================================================*/ - - -drop table if exists actor; - -drop table if exists country; - -drop table if exists evaluate; - -drop table if exists language; - -drop table if exists movie; - -drop table if exists type; - -drop table if exists user; - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - act_id int not null auto_increment, - director varchar(10) not null, - act_name varchar(10) not null, - act_age numeric(8,0) not null, - act_sex varchar(10) not null, - primary key (act_id) -); -insert into actor value (1,'王宝强','王宝强',18,'男'); -/*==============================================================*/ -/* Table: country */ -/*==============================================================*/ -create table country -( - co_id numeric(8,0) not null, - co_name varchar(10) not null, - primary key (co_id) -); -insert into country value (1,'中国'); -/*==============================================================*/ -/* Table: evaluate */ -/*==============================================================*/ -create table evaluate -( - evaluate_id int not null auto_increment, - director varchar(10), - user_id numeric(8,0), - evaluate_title varchar(30) not null, - evaluate_time time not null, - state varchar(10) not null, - primary key (evaluate_id) -); -insert into evaluate value(2,'王宝强',54,'过往人生',2023=1=21,'已上映'); -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - lan_id int not null, - lan_name varchar(18) not null, - primary key (���Ա�) -); -insert into `language` value (1,'汉语') ; -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - director varchar(10) not null, - co_id numeric(8,0), - type numeric(10,0), - ���Ա�� int not null, - `write` varchar(10) not null, - act varchar(10) not null, - movie_time datetime not null, - movie_length date not null, - movie_nname varchar(10) not null, - imdb varchar(15) not null, - primary key (director) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type numeric(10,0) not null, - type_name varchar(18) not null, - primary key (type) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id numeric(8,0) not null, - user_name varchar(15) not null, - user_sex varchar(10) not null, - user_area varchar(10) not null, - primary key (user_id) -); - -alter table actor add constraint FK_Relationship_4 foreign key (director) - references movie (director) on delete restrict on update restrict; - -alter table evaluate add constraint FK_Relationship_5 foreign key (director) - references movie (director) on delete restrict on update restrict; - -alter table evaluate add constraint FK_Relationship_6 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_3 foreign key (co_id) - references country (co_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_7 foreign key (type) - references type (type) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_8 foreign key (���Ա��) - references language (���Ա��) on delete restrict on update restrict; - - -``` - diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230914 \345\214\273\351\231\242\347\256\241\347\220\206.md" "b/50 \345\274\240\350\265\267\347\221\236/20230914 \345\214\273\351\231\242\347\256\241\347\220\206.md" deleted file mode 100644 index 58f6784841ec84b05356fa478dd3dbcb347be35e..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230914 \345\214\273\351\231\242\347\256\241\347\220\206.md" +++ /dev/null @@ -1,209 +0,0 @@ -### 分析 - -医生:医生编号、姓名 、 地址、 联系、科室、年龄 、职位 - -处方:处方号、病人年龄、处方内容、主治医师、病人姓名、病人性别 - -科室:科室编号 、 科室名称 - -护士:护士编号、姓名、联系电话、 - -患者:姓名、年龄、联系电话、性别、医保号、家庭住址、职业 - -检查项目:检查序号、检查工序、检验内容、检查结果、检查收费情况、检查医师 - -病例单: 病历号、病人姓名、病例内容、诊断时间、主治医师 - -收费项目:收费项目编号、项目类型、收费金额、收费人员、病人姓名 - -药品:药品编号、药品名称,药品介绍、分类 - -#### 概念模型 - -![image-20230914084659961](C:\Users\zhangpaopao\Desktop\PVUsy5CbW6OY8Bp.png) - -#### 逻辑模型 - -![](C:\Users\zhangpaopao\Desktop\KYc4sSX1Wp38V6w.png) - -### DDL语句 - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 8:53:39 */ -/*==============================================================*/ - -CREATE DATABASE hospital CHARSET utf8; -use hospital; -drop table if exists detailed; - -drop table if exists doctor; - -drop table if exists dossier; - -drop table if exists medicine; - -drop table if exists nurse; - -drop table if exists patient; - -drop table if exists prescription; - -drop table if exists section; - -drop table if exists tariff; - -/*==============================================================*/ -/* Table: detailed */ -/*==============================================================*/ -create table detailed -( - detailed_id char(10) not null, - tariff_id char(11) not null, - pre_id char(10) not null, - detailed_deta char(10) not null, - primary key (detailed_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id char(10) not null, - doctor_name varchar(20) not null, - doctor_age int not null, - doctor_sex char(1) not null, - doctor_tel char(11) not null, - doctor_post varchar(10) not null, - doctor_address varchar(15), - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: dossier */ -/*==============================================================*/ -create table dossier -( - dossier_id char(12) not null, - doctor_id char(10) not null, - dossier_name varchar(8) not null, - dossier_content varchar(25) not null, - dossier_time varchar(15) not null, - dossier_doctor char(10) not null, - primary key (dossier_id) -); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - medicine_id char(10) not null, - pre_id char(10) not null, - medicine_name char(10) not null, - medicine_type char(10) not null, - medicine_introduce char(10) not null, - primary key (medicine_id) -); - -/*==============================================================*/ -/* Table: nurse */ -/*==============================================================*/ -create table nurse -( - nurse_id char(10) not null, - section_id char(10) not null, - nurse_name char(10) not null, - nurse_tel char(10) not null, - primary key (nurse_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id char(10) not null, - dossier_id char(12) not null, - patient_name varchar(10) not null, - patient_age int not null, - patient_sex char(1) not null, - patient_address varchar(12) not null, - patient_idnumber char(18) not null, - patient_post varchar(10), - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - pre_id char(10) not null, - doctor_id char(10) not null, - patient_id char(10) not null, - pra_content varchar(15) not null, - patient_name varchar(10) not null, - patient_sex char(1) not null, - patient_age int not null, - attending_doctor char(8) not null, - primary key (pre_id) -); - -/*==============================================================*/ -/* Table: section */ -/*==============================================================*/ -create table section -( - section_id char(10) not null, - doctor_id char(10), - section_name varchar(10) not null, - primary key (section_id) -); - -/*==============================================================*/ -/* Table: tariff */ -/*==============================================================*/ -create table tariff -( - tariff_id char(11) not null, - tariff_name varchar(5) not null, - tariff_project varchar(5) not null, - project_type varchar(10) not null, - tariff_money decimal(5,1) not null, - tariff_staff varchar(5) not null, - primary key (tariff_id) -); - -alter table detailed add constraint FK_detailed_tariff foreign key (tariff_id) - references tariff (tariff_id) on delete restrict on update restrict; - -alter table detailed add constraint FK_pay foreign key (pre_id) - references prescription (pre_id) on delete restrict on update restrict; - -alter table dossier add constraint FK_write foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table medicine add constraint FK_reason foreign key (pre_id) - references prescription (pre_id) on delete restrict on update restrict; - -alter table nurse add constraint FK_section_nurse foreign key (section_id) - references section (section_id) on delete restrict on update restrict; - -alter table patient add constraint FK_pertain foreign key (dossier_id) - references dossier (dossier_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_doctor_pre foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_possess foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table section add constraint FK_doctor_section foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - - -~~~ - diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230915 \346\261\275\350\275\246\347\256\241\347\220\206.md" "b/50 \345\274\240\350\265\267\347\221\236/20230915 \346\261\275\350\275\246\347\256\241\347\220\206.md" deleted file mode 100644 index b5c8be891df761a540cf4c90b358074b5f5c4dee..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230915 \346\261\275\350\275\246\347\256\241\347\220\206.md" +++ /dev/null @@ -1,102 +0,0 @@ -```mysql -create database test915 charset utf8; -use test915; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 09:33:00 */ -/*==============================================================*/ - - -drop table if exists car; - -drop table if exists customer; - -drop table if exists deal; - -drop table if exists saleman; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_name varchar(18) not null, - car_id int not null auto_increment, - car_brand varchar(18) not null, - primary key (car_id) -); -insert into car value ('劳斯莱斯',1,'豪华汽车'), -('宾利',2,'汽车'), -('奇瑞',3,'小汽车'); -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - cus_name varchar(15) not null, - cus_age int not null, - cus_sex varchar(5) not null, - cus_id int not null auto_increment, - primary key (cus_id) -); -insert into customer value('小红',13,'男',34), -('小李',23,'女',65), -('小王',55,'男',99); -/*==============================================================*/ -/* Table: deal */ -/*==============================================================*/ -create table deal -( - car_id int, - cus_id int, - sale_id int, - deal_name varchar(10) not null, - deal_time time not null, - deal_mooney numeric(8,0) not null -); -insert into deal value(1,33,45,'奇瑞',2023-3-01,9000000), -(2,77,67,'比亚迪',2023-5-21,8000000), -(3,99,78,'奥迪',2023-9-01,70000000); -/*==============================================================*/ -/* Table: saleman */ -/*==============================================================*/ -create table saleman -( - sale_id int not null auto_increment, - sale_name varchar(2) not null, - sale_number numeric(8,0) not null, - sale_time time not null, - primary key (sale_id) -); -insert into saleman value(1,'王华',20,2023-01-10), -(2,'李明',98,2023-10-05), -(3,'黄莎',87,2023-09-09); - - -alter table deal add constraint FK_Relationship_1 foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table deal add constraint FK_Relationship_2 foreign key (cus_id) - references customer (cus_id) on delete restrict on update restrict; - -alter table deal add constraint FK_Relationship_3 foreign key (sale_id) - references saleman (sale_id) on delete restrict on update restrict; - -##-- 1.查询特定销售员的销售记录 -SELECT * FROM saleman where sale_id=(SELECT sale_id FROM saleman where sale_name='王华'); - -- 2.查找销售记录中销售价格最高的汽车 - SELECT MAX(deal_mooney) FROM deal; - SELECT * FROM car c LEFT JOIN deal d on c.car_id=d.car_id where deal_mooney=(SELECT MAX(deal_mooney) FROM deal); - - -- 3.统计某个销售员的销售总额 - -SELECT deal_mooney FROM deal d LEFT JOIN saleman saon sa.sale_id=d.sale_id WHERE sale_name="黄莎"; - -- 4.根据客户信息查询其购买过的汽车 - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - SELECT * FROM car c LEFT JOIN deal d on c.car_id=d.car_id WHERE c.car_brand='奇瑞'; - -- 8.统计每个销售员的销售数量 - SELECT s.sale_name, COUNT(s.sale_number) FROM saleman GROUP BY cale_name; -``` - diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230919 \346\237\245\350\257\242\347\233\270\345\205\263\344\271\240\351\242\230.md" "b/50 \345\274\240\350\265\267\347\221\236/20230919 \346\237\245\350\257\242\347\233\270\345\205\263\344\271\240\351\242\230.md" deleted file mode 100644 index 621f4e0b086ccdbaba43dcebe2354aee324de205..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230919 \346\237\245\350\257\242\347\233\270\345\205\263\344\271\240\351\242\230.md" +++ /dev/null @@ -1,225 +0,0 @@ -如果值是空的,那么所有参与null的运算,返回的值是null - -```mysql - #第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -select sum(salary*12) 工资总和 from employees; -#理解1:计算12月的基本工资 -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 -select * from employees; -select sum(salary*12+ifnull(salary*commission_pct*12,0)) from employees; - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct -select distinct job_id from employees; - - -# 3.查询工资大于12000的员工姓名和工资 -select first_name,salary from employees where salary>12000; -# 4.查询员工号为176的员工的姓名和部门号 -select last_name,department_id from employees where employee_id=176; - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -select * from departments; -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -select last_name,salary from employees where salary not between 5000 and 12000; - - -# 2.选择在20或50号部门工作的员工姓名和部门号 -select first_name,department_id from employees where department_id=20 or department_id=50; - -# 3.选择公司中没有管理者的员工姓名及job_id -select first_name,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select last_name,salary,grade_level from employees e left join job_grades j on e.salary between j.lowest_sal and j.highest_sal where commission_pct is not null; -select employee_id,salary,grade_level from employees e left join job_grades j on e.salary between j.lowest_sal and j.highest_sal where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select * from employees where last_name like"_尔"; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -select * from employees where last_name like "%特%尔%" or last_name like "%尔%特%"; - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -select * from employees where first_name like "%尔"; - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select * from employees where department_id between 80 and 100; -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -select * from employees where manager_id in (100,101,110); - - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - -select first_name,department_id,salary*12 from employees order by salary*12 desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select last_name,salary from employees where salary<8000 or salary >17000 order by salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -select * from employees where email like '%e%' order by length(email) desc,department_id asc; - - - -# 第06章_多表查询的课后练习 - - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - -select manager_id,min(salary) from employees where manager_id is not null group by manager_id having min(salary)>6000; - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name,d.location_id,count(employee_id),avg(salary) from departments d left join employees e on d.department_id=e.department_id group by d.department_id order by avg(salary) desc; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select j.job_title,min(salary),department_name from jobs j left join employees e on j.job_id=e.job_id left join departments d on e.department_id=d.department_id group by j.job_id,d.department_id; - -# 第09章_子查询的课后练习 - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - -select * from employees where department_id =(select department_id from employees where last_name='兹洛特基') and salary=(select salary from employees where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - -select employee_id,first_name,salary from employees where salary>(select avg(salary) from employees); - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name,job_id,salary from employees where salary>(select max(salary) from employees where JOB_ID = 'SA_MAN'); - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -select employee_id,last_name from employees where department_id=(select department_id from employees where last_name like '%u%'); - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -select first_name,employee_id from employees where department_id in (select department_id from departments where location_id=1700); - -#6.查询管理者是 金 的员工姓名和工资 - -select first_name,salary from employees where manager_id in (select manager_id from employees where last_name='金'); - -#7.查询工资最低的员工信息: last_name, salary - -select last_name,salary from employees where salary=(select min(salary) from employees); - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 - -select * from departments where department_id =(select department_id from employees group by department_id having avg(salary)=(select min(s) from (select avg(salary) s from employees group by department_id) a)); - -#方式2: -# 部门平均<= 公司所有平均 - -select * from departments where department_id=(select department_id from employees group by department_id having avg(salary)<=all(select avg(salary) from employees group by department_id)); - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - -select d.*,(select avg(salary) from employees where department_id=d.department_id) from departments d where department_id =(select department_id from employees group by department_id having avg(salary)=(select min(s) from (select avg(salary) s from employees group by department_id) a)); - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -select * from jobs where job_id=(select job_id from employees group by job_id having avg(salary)=(select max(s) from (select avg(salary) s from employees group by job_id) a)); - -#方式2:平均工资>=所有平均工资 - -select * from jobs where job_id=(select job_id from employees group by job_id having avg(salary)>=all(select avg(salary) from employees group by job_id)); - -#11.查询平均工资高于公司平均工资的部门有哪些? - -select department_id from employees where department_id is not null group by department_id having avg(salary)>(select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - -select e.* from employees e inner join employees s on e.employee_id=s.manager_id; - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - -select * from employees where employee_id=any(select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - -select min(salary) from employees group by department_id having max(salary)<=all(select max(salary) from employees group by department_id); - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary - -select last_name,department_id,email,salary from employees where department_id = (select department_id from employees group by department_id having avg(salary)>=all(select avg(salary) from employees group by department_id)); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 - -select department_id from departments where department_id !=all(select department_id from employees where job_id='ST_CLERK'); - -#16. 选择所有没有管理者的员工的last_name - -select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - -select employee_id,first_name,hire_date,salary from employees e where e.manager_id=(select employee_id from employees where first_name = 'De Haan'); - -#方式2: - -select employee_id, last_name, hire_date, salary from employees e where exists(select * from employees s where e.employee_id=s.manager_id and s.first_name='De Haan'); - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - -select employee_id,last_name,salary from employees e1 where salary > (select avg(salary) from employees e2 where e2.department_id = e1.department_id); - -#方式2:在FROM中声明子查询 - -select employee_id,last_name,salary from employees e1,(select department_id,AVG(salary) s from employees e2 group by department_id) a where e1.department_id = a.department_id and e1.salary > a.s; - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - -select department_name,department_id from departments d where 5 < (select count(*) from employees e where d.department_id = e.department_id); - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -select country_id from locations l where 2 < (select count(*) from departments d where l.location_id=d.location_id); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -``` - diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230920 RBAC \347\254\254\344\270\200\350\257\276.md" "b/50 \345\274\240\350\265\267\347\221\236/20230920 RBAC \347\254\254\344\270\200\350\257\276.md" deleted file mode 100644 index aa81554de9dfe85dd7e3fbfad4f91a6f48afd650..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230920 RBAC \347\254\254\344\270\200\350\257\276.md" +++ /dev/null @@ -1,237 +0,0 @@ -```mysql -RBAC是基于角色的权限访问控制模型。 -RBAC允许您通过分配一组权限来创建和实施高级访问。权限基于特定用户类别执行其职责所需的访问级别。 -RBAC0(Core RBAC):基本模型有三个元素:用户、角色和权限。模型设计基于“多对多”原则,即多个用户可以具有相同的角色,一个用户可以具有多个角色。同样,您可以将同一权限分配给多个角色,也可以将同一角色分配给多个权限。 -``` - -```mysql -SELECT - user_name,user_pwd,role_name,asd -FROM - `USER` U, - ROLE R, - `LIMIT` L, - relationship_1 R1, - relationship_2 R2 -WHERE -R1.role_id=R2.role_id AND -L.limit_id=R2.limit_id AND -R1.user_id=U.user_id AND -R2.role_id=R.role_id AND -R1.role_id=R.role_id AND -user_name='陈六'AND -user_pwd='555555'; -``` - -```mysql -create database test920 charset utf8; -use test920; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 16:03:24 */ -/*==============================================================*/ - - -drop table if exists Relationship_1; - -drop table if exists Relationship_2; - -drop table if exists `limit`; - -drop table if exists role; - -drop table if exists user; - -/*==============================================================*/ -/* Table: Relationship_1 */ -/*==============================================================*/ -create table Relationship_1 -( - role_id int not null, - user_id int not null, - primary key (role_id, user_id) -); - -/*==============================================================*/ -/* Table: Relationship_2 */ -/*==============================================================*/ -create table Relationship_2 -( - limit_id int not null, - role_id int not null, - primary key (limit_id, role_id) -); - -/*==============================================================*/ -/* Table: "limit" */ -/*==============================================================*/ -create table `limit` -( - limit_name varchar(19) not null, - limit_level numeric(8,0) not null, - limit_add varchar(18) not null, - limit_id int not null auto_increment, - primary key (limit_id) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name varchar(20) not null, - primary key (role_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table `user` -( - user_name varchar(100) not null, - user_pwd numeric(18,0) not null, - user_id int not null auto_increment, - primary key (user_id) -); - -alter table Relationship_1 add constraint FK_Relationship_1 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table Relationship_1 add constraint FK_Relationship_3 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table Relationship_2 add constraint FK_Relationship_2 foreign key (limit_id) - references `limit` (limit_id) on delete restrict on update restrict; - -alter table Relationship_2 add constraint FK_Relationship_4 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; -``` - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : localhost_3306 - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : test920 - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 20/09/2023 17:30:43 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for limit --- ---------------------------- -DROP TABLE IF EXISTS `limit`; -CREATE TABLE `limit` ( - `limit_add` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `limit_id` int NOT NULL AUTO_INCREMENT, - `asd` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`limit_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of limit --- ---------------------------- -INSERT INTO `limit` VALUES ('www.mxdx.net/index', 1, '首页'); -INSERT INTO `limit` VALUES ('www.mxdx.net/student', 2, '学生信息'); -INSERT INTO `limit` VALUES ('www.mxdx.net/teacher', 3, '教师信息'); -INSERT INTO `limit` VALUES ('eetehm.ruyhtr', 4, '全部'); - --- ---------------------------- --- Table structure for relationship_1 --- ---------------------------- -DROP TABLE IF EXISTS `relationship_1`; -CREATE TABLE `relationship_1` ( - `role_id` int NOT NULL, - `user_id` int NOT NULL, - PRIMARY KEY (`role_id`, `user_id`) USING BTREE, - INDEX `FK_Relationship_3`(`user_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of relationship_1 --- ---------------------------- -INSERT INTO `relationship_1` VALUES (4, 1); -INSERT INTO `relationship_1` VALUES (4, 2); -INSERT INTO `relationship_1` VALUES (2, 3); -INSERT INTO `relationship_1` VALUES (2, 4); -INSERT INTO `relationship_1` VALUES (5, 5); - --- ---------------------------- --- Table structure for relationship_2 --- ---------------------------- -DROP TABLE IF EXISTS `relationship_2`; -CREATE TABLE `relationship_2` ( - `limit_id` int NOT NULL, - `role_id` int NOT NULL, - PRIMARY KEY (`limit_id`, `role_id`) USING BTREE, - INDEX `FK_Relationship_4`(`role_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`limit_id`) REFERENCES `limit` (`limit_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of relationship_2 --- ---------------------------- -INSERT INTO `relationship_2` VALUES (1, 2); -INSERT INTO `relationship_2` VALUES (2, 2); -INSERT INTO `relationship_2` VALUES (3, 2); -INSERT INTO `relationship_2` VALUES (1, 4); -INSERT INTO `relationship_2` VALUES (2, 4); -INSERT INTO `relationship_2` VALUES (1, 5); -INSERT INTO `relationship_2` VALUES (2, 5); -INSERT INTO `relationship_2` VALUES (3, 5); -INSERT INTO `relationship_2` VALUES (4, 5); - --- ---------------------------- --- Table structure for role --- ---------------------------- -DROP TABLE IF EXISTS `role`; -CREATE TABLE `role` ( - `role_id` int NOT NULL AUTO_INCREMENT, - `role_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`role_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role --- ---------------------------- -INSERT INTO `role` VALUES (2, '老师'); -INSERT INTO `role` VALUES (4, '学生'); -INSERT INTO `role` VALUES (5, '校长'); - --- ---------------------------- --- Table structure for user --- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `user_name` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `user_pwd` decimal(18, 0) NOT NULL, - `user_id` int NOT NULL AUTO_INCREMENT, - PRIMARY KEY (`user_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES ('张三', 111111, 1); -INSERT INTO `user` VALUES ('李四', 222222, 2); -INSERT INTO `user` VALUES ('黄山', 333333, 3); -INSERT INTO `user` VALUES ('赵五', 444444, 4); -INSERT INTO `user` VALUES ('陈六', 555555, 5); - -SET FOREIGN_KEY_CHECKS = 1; -``` - diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230921 \346\211\213\346\234\272.md" "b/50 \345\274\240\350\265\267\347\221\236/20230921 \346\211\213\346\234\272.md" deleted file mode 100644 index ac0b0f87424300fe700bae4ef584693099775c58..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230921 \346\211\213\346\234\272.md" +++ /dev/null @@ -1,169 +0,0 @@ -```mysql -SPU: 是商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个产品的特性。通俗点讲,属性值、特性相同的商品就可以称为一个SPU。 -/* - Navicat Premium Data Transfer - - Source Server : fad - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : db7 - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 21/09/2023 17:17:12 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for attribute --- ---------------------------- -DROP TABLE IF EXISTS `attribute`; -CREATE TABLE `attribute` ( - `attribute_id` int NOT NULL AUTO_INCREMENT, - `attribute_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`attribute_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of attribute --- ---------------------------- -INSERT INTO `attribute` VALUES (1, '颜色'); -INSERT INTO `attribute` VALUES (2, '内存'); - --- ---------------------------- --- Table structure for attribute_value --- ---------------------------- -DROP TABLE IF EXISTS `attribute_value`; -CREATE TABLE `attribute_value` ( - `relve` int NOT NULL AUTO_INCREMENT, - `sku_id` int NOT NULL, - `attribute_id` int NOT NULL, - `value_id` int NOT NULL, - PRIMARY KEY (`relve`) USING BTREE, - INDEX `FK_Relationship_2`(`sku_id` ASC) USING BTREE, - INDEX `FK_Relationship_3`(`attribute_id` ASC) USING BTREE, - INDEX `FK_Relationship_4`(`value_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`sku_id`) REFERENCES `sku` (`sku_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`attribute_id`) REFERENCES `attribute` (`attribute_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_4` FOREIGN KEY (`value_id`) REFERENCES `value` (`value_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of attribute_value --- ---------------------------- -INSERT INTO `attribute_value` VALUES (1, 1, 1, 1); -INSERT INTO `attribute_value` VALUES (2, 1, 2, 5); -INSERT INTO `attribute_value` VALUES (3, 2, 1, 2); -INSERT INTO `attribute_value` VALUES (4, 2, 2, 5); -INSERT INTO `attribute_value` VALUES (6, 3, 1, 4); -INSERT INTO `attribute_value` VALUES (7, 3, 2, 5); -INSERT INTO `attribute_value` VALUES (8, 4, 1, 3); -INSERT INTO `attribute_value` VALUES (9, 4, 2, 5); -INSERT INTO `attribute_value` VALUES (10, 5, 1, 1); -INSERT INTO `attribute_value` VALUES (11, 5, 2, 6); -INSERT INTO `attribute_value` VALUES (12, 6, 1, 2); -INSERT INTO `attribute_value` VALUES (13, 6, 2, 6); -INSERT INTO `attribute_value` VALUES (14, 7, 1, 4); -INSERT INTO `attribute_value` VALUES (15, 7, 2, 6); -INSERT INTO `attribute_value` VALUES (16, 8, 1, 3); -INSERT INTO `attribute_value` VALUES (19, 8, 2, 6); - --- ---------------------------- --- Table structure for sku --- ---------------------------- -DROP TABLE IF EXISTS `sku`; -CREATE TABLE `sku` ( - `sku_id` int NOT NULL AUTO_INCREMENT, - `stu_id` int NOT NULL, - `sku_tlite` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `sku_price` decimal(7, 2) NOT NULL, - `sku_inventory` int NOT NULL, - PRIMARY KEY (`sku_id`) USING BTREE, - INDEX `FK_stu_sku`(`stu_id` ASC) USING BTREE, - CONSTRAINT `FK_stu_sku` FOREIGN KEY (`stu_id`) REFERENCES `stu` (`stu_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of sku --- ---------------------------- -INSERT INTO `sku` VALUES (1, 1, '华为mate60pro 雅丹黑 256G', 6499.00, 10); -INSERT INTO `sku` VALUES (2, 1, '华为Mate 60 pro 青 256G ', 6499.00, 5); -INSERT INTO `sku` VALUES (3, 1, '华为Mate 60 pro 白沙银 256G', 6499.00, 9); -INSERT INTO `sku` VALUES (4, 1, '华为 Mate 60 pro 紫 256G', 6499.00, 10); -INSERT INTO `sku` VALUES (5, 1, '华为 Mate 60 pro 雅丹黑 512G', 7499.00, 0); -INSERT INTO `sku` VALUES (6, 1, '华为 Mate 60 pro 青 512G', 7499.00, 5); -INSERT INTO `sku` VALUES (7, 1, '华为 Mate 60 pro 白沙银 512G', 7499.00, 6); -INSERT INTO `sku` VALUES (8, 1, '华为 Mate 60 pro 紫 512G', 7499.00, 8); - --- ---------------------------- --- Table structure for stu --- ---------------------------- -DROP TABLE IF EXISTS `stu`; -CREATE TABLE `stu` ( - `stu_id` int NOT NULL AUTO_INCREMENT, - `stu_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `stu_details` text CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`stu_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of stu --- ---------------------------- -INSERT INTO `stu` VALUES (1, '华为mete60pro', '遥遥领先'); -INSERT INTO `stu` VALUES (2, '小米MIXFold X3', '小米龙骨转轴创新结构,'); - --- ---------------------------- --- Table structure for value --- ---------------------------- -DROP TABLE IF EXISTS `value`; -CREATE TABLE `value` ( - `value_id` int NOT NULL AUTO_INCREMENT, - `value_v` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`value_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 8 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of value --- ---------------------------- -INSERT INTO `value` VALUES (1, '雅丹黑'); -INSERT INTO `value` VALUES (2, '青'); -INSERT INTO `value` VALUES (3, '紫'); -INSERT INTO `value` VALUES (4, '流沙银'); -INSERT INTO `value` VALUES (5, '256G'); -INSERT INTO `value` VALUES (6, '512G'); -INSERT INTO `value` VALUES (7, '1TB'); - -SET FOREIGN_KEY_CHECKS = 1; -``` - -```mysql -查询: -SELECT - s.sku_id,s.sku_tlite,s.sku_price,attribute_name,value_v,st.stu_details -FROM -sku s, -stu st, -`value` v, -attribute att, -attribute_value attr -WHERE -s.sku_id=st.stu_id -AND -attr.attribute_id=att.attribute_id -AND -attr.sku_id = s.sku_id -AND -attr.value_id = v.value_id -AND -s.sku_id=(SELECT attr.sku_id FROM (SELECT sku_id,value_v FROM attribute_value av,`value` v WHERE av.value_id=v.value_id AND value_v='雅丹黑') AS a, -(SELECT sku_id,value_v FROM attribute_value av,`value` v WHERE av.value_id=v.value_id -AND v.value_v ='256G') as b -WHERE -a.sku_id = b.sku_id); -``` - diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230922 \346\225\260\346\215\256\345\272\223\351\242\204\344\271\240.md" "b/50 \345\274\240\350\265\267\347\221\236/20230922 \346\225\260\346\215\256\345\272\223\351\242\204\344\271\240.md" deleted file mode 100644 index 520b0e76b20c6a7874f2877deb8a80783093d9cd..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230922 \346\225\260\346\215\256\345\272\223\351\242\204\344\271\240.md" +++ /dev/null @@ -1,49 +0,0 @@ -#### 1.如何创建存储过程? - -create procedure 存储过程名(I参数])参数格式(参数类型 参数名 数据型)参数类型有三种: -IN: 输入参数,该参数的值必须在调用该存储过程时指定,在存储过程内部使用不能返回缺省值是IN。 -OUT: 输出参数,该参数值的值可以在存储过程内部修改,并可返回。INOUT: 输入输出参数,该参数需要在调用时指定,并且可以返回。 - -#### 2.事务: - -1.什么是事务,事务的特性是什么? -事务是指对数据库进行操作的最小执行单元.不可再分,要么全都执行成功,全都执行失败! -2.特性:ACID -一致性、隔离性、持久性、原子性 -3.数据库中事务的提交和回滚 -提交:事务中的一系列操作都执行结束,提交,表示事务执行成功 - -回滚:事务中若有步骤执行失败,此时回滚事务,该事务执行失败 - -原子性: 事务包含的这一系列操作,要么全部成功,要么全部失败。 -一致性: 事务完成之后,不会将非法的数据写入数据库。 -隔离性: 多个事务可以在一定程度上并发执行。 -持久性: 事务完成之后,数据要永久保存(一般会保存在硬盘上) - -原子性Q (由DBMS的事务管理子系统来实现) -致性 (由DBMS的完整性子系统执行测试任务) -隔离性 (由DBMS的并发Q控制子系统实现) -持久性 (由DBMS的恢复管理子系统实现的) - -#### 3.多表查询 - -多表查询有如下几种: -1.合并结果集:UNION 、UNION ALL -2.连接查询 -2.1内连接TINNER]JOIN ON -2.2外连接 OUTER JOIN ON -左外连接 LEFT[OUTER]JOIN -右外连接 RIGHT[OUTER] JOIN --全外连接 (MySQL不支持) FULL JOIN - -2.3 自然连接 NATURAL JOIN - -#### 4.多表查询 - -select 列名 from 表1 -inner join 表2 on 表1.列名=表2.列名 -inner join 表3 on 表1或表2.列名=表3.列名 -where -等价于: -select 列名 from 表1,表2,表3 -where 表1.列名=表2.列名 and 表1/表2.列名=表3.列名 \ No newline at end of file diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230922 \346\225\260\346\215\256\345\272\223\345\244\215\344\271\240.md" "b/50 \345\274\240\350\265\267\347\221\236/20230922 \346\225\260\346\215\256\345\272\223\345\244\215\344\271\240.md" deleted file mode 100644 index b3088e0398976b3b32354bde6ada109f520c6636..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230922 \346\225\260\346\215\256\345\272\223\345\244\215\344\271\240.md" +++ /dev/null @@ -1,93 +0,0 @@ -#### E-R图查数据逻辑 - -**课程信息表(course_info):** - -字段:id(主键)、teacher_id(教师id 主键)、course_name(课程名称)、course_code(课程号)、course_type(课程类别)、course_score(学分) 、create_id(创建人)、create_time(创建时间) 、update_id (修改人) 、update_time(修改时间) - -**教师表(teacher_info):** - -字段:id(主键)、code(工号)、name(姓名)、sex(性别)、professional(职称)、create_id(创建人)、create_time(创建时间) 、update_id (修改人) 、update_time(修改时间) - - -**学生表(student_info):** - -字段:id(主键)、code(学号)、name(姓名)、sex(性别)、age(年龄)、class_name(专业班级)、create_id(创建人)、create_time(创建时间) 、update_id (修改人) 、update_time(修改时间) - - - -**学生课程关联表(student_course_info):** - -字段:id(主键)、stu_id(学生id)、cou_id(课程id)、socre(成绩)、create_id(创建人)、create_time(创建时间) 、update_id (修改人) 、update_time(修改时间)** -** - -#### 内连接 - -```mysql - -select * from a [inner] join b on a.key = b.key -``` - -#### 左外连接 - -```mysql - -select * from a left join b on a.key = b.key -``` - -#### 右外连接 - -```mysql - -select * from a right join b on a.key = b.key -``` - -#### 全外连接 - -```mysql -elect * from a full outer join b on a.key = b.key; -``` - -##### 上面的全外连接sql只在Oracle中适用,MYSQL中不支持,因此在MYSQL中想要实现全外连接,得用联合查询(union)实现 - -```MYSQL - -select * from a left join b on a.key = b.key -union -select * from a right join b on a.key = b.key - -``` - -##### E-R图概述 - -概念模型中最常用的方法就是实体-联系方法(Entity-Relationship approach),该方法用E-R图来描述现实世界的概念模型,即E-R模型。 - -该模型中包含实体、属性以及实体之间的联系。在E-R图中,用矩形表示实体,椭圆形表示属性,菱形表示实体之间的联系(联系也是可以有属性的) -E-R图也称实体-联系图(Entity Relationship Diagram),提供了表示实体类型、属性和联系的方法,用来描述现实世界的概念模型。 - -##### 基本的概念 - -实体:客观存在并且可以相互区分的事物为实体。可以是具体的人,事,物或者抽象的概念 - -属性:实体所具有的某一个特性就称为属性,一个实体可以由若干个属性来刻画。 - -码:唯一标识实体的属性集 - -域:属性的取值范围称为该属性的域 - -实体型:用实体名及其属性名集合来抽象和刻画同类实体称为实体型 - -实体集:同一类型实体的集合称为实体集 -联系:现实世界中事物内部以及事物之间的联系在信息世界中反映为实体内部的联系和实体之间的联系。包括实体内部的联系及实体之间的联系 - -其中码分为超码,候选码,主码,外码 -超码:一个或多个属性的集合,这些属性的组合可以使我们在一个实体集中唯一的标识一个实体 - -候选码:任意超码的真子集不能包括超码,则称其为候选码;超码包括候选码 - -主码: 其实主码一般指的就是主关键字。主关键字是表中的一个或多个字段,它的值用于唯一地标识表中的某一条记录,主关键字又可以称为主键。 主键可以由一个字段,也可以由多个字段组成,分别称为单字段主键或多字段主键。又称主码。 - -外码: 外码别称外键,具体来说就是比如说这个外码是相对于关系R来说的,但是如果相对于关系S来说的话是关系R中的主码,外码就是这个意思。 - -#### 数据库设计分6个阶段: - -需求分析、概念结构设计、逻辑结构设计、物理结构设计、数据库实施、数据库运行和维护。 \ No newline at end of file diff --git "a/50 \345\274\240\350\265\267\347\221\236/20230926 \350\247\206\345\233\276\344\275\234\344\270\232.md" "b/50 \345\274\240\350\265\267\347\221\236/20230926 \350\247\206\345\233\276\344\275\234\344\270\232.md" deleted file mode 100644 index 3455bfe31afcb601920f84d849a4d1acb1069b04..0000000000000000000000000000000000000000 --- "a/50 \345\274\240\350\265\267\347\221\236/20230926 \350\247\206\345\233\276\344\275\234\344\270\232.md" +++ /dev/null @@ -1,287 +0,0 @@ -```mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -create view employee_vu as -select last_name 姓名,employee_id 员工号,department_id 部门号 from employees; - - -#2. 显示视图的结构 -desc employee_vu; - -#3. 查询视图中的全部内容 -select * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -select * from employee_vu WHERE 部门号<80; - -#练习2: -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -create view emp_v1 as -select last_name,salary,email from employees where phone_number like '011%'; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -create or replace VIEW emp_v1 as -select last_name,salary,email,phone_number from employees where phone_number like '011%' and email like 'e%'; - -select * from emp_v1; - - -#3. 向 emp_v1 插入一条记录,是否可以? -不可以 - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -update emp_v1 set salary=salary+100; -select * from emp_v1; -#5. 删除emp_v1中姓名为Olsen的员工 -DELETE FROM emp_v1 WHERE last_name='olsen'; -select * from emp_v1; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create view emp_v2 as -select department_id,max(salary) from employees where salary>12000; -select * from emp_v2; - - -#7. 向 emp_v2 中插入一条记录,是否可以? -不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 -DROP view if exists emp_v2,emp_v1; -``` - diff --git "a/51 \347\250\213\350\210\234/20230905.md" "b/51 \347\250\213\350\210\234/20230905.md" deleted file mode 100644 index 38fdcf4201732b23820659b86f446252c8896c16..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230905.md" +++ /dev/null @@ -1,43 +0,0 @@ -## 开学第一课 - -#### 总结大一以及大二的学需要学的知识以及方向 - - $\textcolor{red}{大一:主打理论知识,学习基础知识,打下大二的基础}$ - - $\textcolor{red}{大二:实际应用(实操)}$ - - $\textcolor{red}{}$1、学习MySQL高级语言 - - 2、JavaScript(Ajax) - - 3、MVC框架(全称:model view controller) - - 以上为大二上学期所需要学习的内容 - - $\textcolor{red}{大二下:}$ - - 1、node.js - - 2、Vue.js ----简化开发,有UI框架配合 - - (1,2为前端) - - 3、Spring boot框架 - - $\textcolor{red}{大二下实训:}$ - - 1、Linux服务器 - - 2、项目周可能实现的技术:中间件、签权:鉴别权限 - - 3、小程序:app移动端开发 - - $\textcolor{red}{知识普及}$ - - 技术栈: - - 一个项目要求用什么技术实现,可以称为技术选型(选方案) - - 技能树: - - 一个人具备的技能,称为技能树(通俗来讲就是一个人的天赋加点) \ No newline at end of file diff --git "a/51 \347\250\213\350\210\234/20230906.md" "b/51 \347\250\213\350\210\234/20230906.md" deleted file mode 100644 index d9ed88f41f0a677f9d72f0b7545117e72bbd5b62..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230906.md" +++ /dev/null @@ -1,106 +0,0 @@ -# 笔记 - -## 表与表的关系有几种:1对1、1对多、多对多 - -1对1的关系:将其中任一表中的主键,放在另一个表当外键 - -1对多的关系:将一所在的表的主键,放到多的表当外键 - -多对多的关系:必须第三张表,将前两个表的主键放进来当主键 - -## E-R图 - -E-R图又称**实体关系图**,是一种提供了实体,属性和联系的方法,用来描述现实世界的概念模型。 - -## E-R图中的基本元素 - -### 1)实体 - -实际问题中客观存在的并且可以相互区别的事物称为实体。实体是现实世界中的对象,可以具体到人,事,物。 - -### 2)属性 - -实体所具有的某一个特性称为属性,在E-R图中属性用来描述实体。 - -### 3)实体集 - -具有相同属性的实体的集合称为实体集。例如:全体学生就是一个实体集, - -### 4)键 - -在描述实体集的所有属性中,可以唯一标识每个实体的属性称为键。键也是属于实体的属性,作为键的属性取值必须唯一且不能“空置”。 - -### 5)实体型 - -具有相同的特征和性质的实体一定有相同的属性,用实体名及其属性名集合来抽象和刻画同类实体称为实体型,其表示格式为:实体名(属性1,属性2,……) - -### 6)联系 - -世界上任何事物都不是孤立存在的,事物内部和事物之间都有联系的,实体之间的联系通常有3种类型:一对一联系,一对多联系,多对多联系。 - -# 练习 - -![image-20230907104428249](C:\Users\19915\AppData\Roaming\Typora\typora-user-images\image-20230907104428249.png) - -```mysql -create database school charset utf8; - -use school; - --- 院系表 -create table department( - d_id int primary key, - d_name varchar(10) -); -insert into department values -(1,'软件工程学院'); - --- 专业表 -create table speciality( - s_id int primary key, - s_name varchar(10), - d_id int, - foreign key (d_id) references department(d_id) - ); -insert into speciality values -(11,'开发班',1), -(12,'前端班',1), -(13,'新媒体班',1); - --- 班级表 -create table class( - c_id int primary key, - c_name varchar(10), - grade int -); -insert into class values -(1,'软件技术1班',21), -(2,'软件技术2班',22), -(3,'软件技术3班',23); - --- 教室表 -create table classroom( -r_id int PRIMARY KEY, -r_name varchar(10) -); -insert into classroom values -(1,'实训一'), -(2,'实训二'), -(3,'实训三'); - --- 课程 -CREATE TABLE course( - couseId int PRIMARY key, - courseName varchar(10), - credit int, - c_id int,-- 班级编号 - r_id int,-- 教室编号 - foreign key (c_id) references class(c_id), - foreign key (r_id) references classroom(r_id) -); -insert into course VALUES -(1,'java',78,1,2), -(2,'html',90,2,3), -(3,'mysql',80,3,1); -``` - diff --git "a/51 \347\250\213\350\210\234/20230907.md" "b/51 \347\250\213\350\210\234/20230907.md" deleted file mode 100644 index e5d50b1ad3d3b77c265c2664ff9c1355e483f424..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230907.md" +++ /dev/null @@ -1,14 +0,0 @@ -## 数据库的范式 - -2023年9月7日 - -1.第一范式: - 要求字段的内容,不可再分割,为的是保证数据的原子性 - -2.第二范式:要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键,要依赖整个联合主键)而不能只依赖部分 - -3.第三范式:满足第二范式的前提上,要求,非主键属性要直接依赖于主键,而不能出现传递依赖 - -#### 注意 - -实际开发不会完全按照范式来设计,因为需求不一样,有时会故意反范式 \ No newline at end of file diff --git "a/51 \347\250\213\350\210\234/20230908.md" "b/51 \347\250\213\350\210\234/20230908.md" deleted file mode 100644 index d030ab4e9e9e7b33f72c3f6a11c4e9b34896601c..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230908.md" +++ /dev/null @@ -1,148 +0,0 @@ -# 笔记 - -## 数据、逻辑、物理模型 - -2023年9月8日 - -软件:PowerDesigner - -概念数据模型:CMD(Concept Data Model) - -逻辑数据模型:LDM(Logical Data Model) - -物理数据模型:PDM(Physical Data Model) - -#### 作用 - -1、概念数据模型 - -概念数据模型的目标是统一业务概念,作为业务人员和技术人员之间沟通的桥梁,确定不同实体之间的最高层次的关系 - -2、逻辑数据模型 - -逻辑模型是概念模型从真实世界向计算机世界的转换,加入了系统设计的相关内容。 - -3、物理数据模型 - -物理数据模型的目标是指定如何用具体的数据库模式来实现逻辑数据模型,以及真正的保存数据。 - -#### 步骤 - -第一步:创建概念数据模型(E-R图)(以用户的角度) - -第二步:转换成逻辑数据模型(LDM)(以计算机的角度)[快捷方式:Ctrl+shift+L] - -第三步:转换成物理模型(PDM)(以数据库角度)[快捷方式:Ctrl+shift+P] - -第四步:生成DDL[快捷方式:Ctrl+G] - -# 作业 - -~~~mysql - -create database books_01; -use books_01; - -drop table if exists Administrator; - -drop table if exists BookReturn; - -drop table if exists Borrow; - -drop table if exists books; - -drop table if exists bookshelf; - -drop table if exists borrower; - -drop table if exists floor; - -drop table if exists library; - - -create table Administrator -( - a_id int not null auto_increment, - l_id int not null, - a_job char(10) not null, - a_name char(5) not null, - a_age int not null, - a_sex char(1) not null, - a_tel char(11) not null, - primary key (a_id) -); - - -create table BookReturn -( - a_id int not null, - bor_id int not null, - bos_id int not null, - bo_id int not null, - f_id int not null, - ɕǚ date not null, - ʱݤ time not null -); - - -create table Borrow -( - bor_id int not null auto_increment, - bor_name char(5) not null, - bor_tel char(11) not null, - primary key (bor_id) -); - - -create table books -( - bos_id int not null auto_increment, - bo_id int not null, - bos_name char(20) not null, - bos_price decimal(5,2) not null, - bos_press char(10) not null, - primary key (bos_id) -); - -create table bookshelf -( - bo_id int not null auto_increment, - f_id int not null, - bo_name char(10) not null, - primary key (bo_id) -); - - -create table borrower -( - bos_id int not null, - bor_id int not null, - primary key (bos_id, bor_id) -); - - -create table floor -( - f_id int not null auto_increment, - l_id int not null, - f_floor int not null, - f_name char(10) not null, - primary key (f_id) -); - - -create table library -( - l_id int not null auto_increment, - l_name char(10) not null, - l_address varchar(50) not null, - l_p varchar(255) not null, - l_tel char(11) not null, - primary key (l_id) -); - - - -~~~ - -![img](https://s2.loli.net/2023/09/11/wusfkoh2pJimdLA.png) \ No newline at end of file diff --git "a/51 \347\250\213\350\210\234/20230912.md" "b/51 \347\250\213\350\210\234/20230912.md" deleted file mode 100644 index cb386d5f42d4ad391ad242c2c151fbb49921851c..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230912.md" +++ /dev/null @@ -1,150 +0,0 @@ -# 作业 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 11:33:36 */ -/*==============================================================*/ - - -drop table if exists Commenttype; - -drop table if exists comment; - -drop table if exists commentssection; - -drop table if exists country; - -drop table if exists language; - -drop table if exists movie; - -drop table if exists movieteam; - -drop table if exists movietypes; - -/*==============================================================*/ -/* Table: Commenttype */ -/*==============================================================*/ -create table Commenttype -( - Commenttype_id int not null auto_increment, - comment_id int not null, - Commenttype_name varchar(10) not null, - primary key (Commenttype_id) -); - -/*==============================================================*/ -/* Table: comment */ -/*==============================================================*/ -create table comment -( - comment_id int not null auto_increment, - comment_user varchar(10) not null, - comment_time datetime not null, - comment_content varchar(255) not null, - primary key (comment_id) -); - -/*==============================================================*/ -/* Table: commentssection */ -/*==============================================================*/ -create table commentssection -( - commentssection_id int not null auto_increment, - movie_id int not null, - commentssection_theme varchar(20) not null, - commentssection_source varchar(5) not null, - commentssection_time datetime not null, - primary key (commentssection_id) -); - -/*==============================================================*/ -/* Table: country */ -/*==============================================================*/ -create table country -( - country_id int not null auto_increment, - country_name varchar(10) not null, - primary key (country_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - language_id int not null auto_increment, - language varchar(10) not null, - primary key (language_id) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_id int not null auto_increment, - movietypes_id int not null, - country_id int not null, - comment_id int not null, - language_id int not null, - movie_name varchar(20) not null, - movie_time int not null, - movie_alias varchar(20) not null, - movie_data datetime not null, - TMDB varchar(20) not null, - movie_intro varchar(255) not null, - movie_awards varchar(100) not null, - movie_score decimal(2,1) not null, - primary key (movie_id) -); - -/*==============================================================*/ -/* Table: movieteam */ -/*==============================================================*/ -create table movieteam -( - movieteam_id int not null auto_increment, - movie_id int not null, - movieteam_name varchar(10) not null, - movieteam_age char(1) not null, - movieteam_status varchar(10) not null, - primary key (movieteam_id) -); - -/*==============================================================*/ -/* Table: movietypes */ -/*==============================================================*/ -create table movietypes -( - movietypes_id int not null auto_increment, - movietypes_name varchar(5) not null, - primary key (movietypes_id) -); - -alter table Commenttype add constraint FK_Relationship_5 foreign key (comment_id) - references comment (comment_id) on delete restrict on update restrict; - -alter table commentssection add constraint FK_Relationship_7 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_1 foreign key (movietypes_id) - references movietypes (movietypes_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_2 foreign key (country_id) - references country (country_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_3 foreign key (language_id) - references language (language_id) on delete restrict on update restrict; - -alter table movie add constraint FK_Relationship_4 foreign key (comment_id) - references comment (comment_id) on delete restrict on update restrict; - -alter table movieteam add constraint FK_Relationship_6 foreign key (movie_id) - references movie (movie_id) on delete restrict on update restrict; - - -``` - -![2023-09-12_113702](C:\Users\Administrator\Desktop\2023-09-12_113702.png) \ No newline at end of file diff --git "a/51 \347\250\213\350\210\234/20230913.md" "b/51 \347\250\213\350\210\234/20230913.md" deleted file mode 100644 index bc0c530fee362d438daa1416e8a50f38faa1e23e..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230913.md" +++ /dev/null @@ -1,208 +0,0 @@ -### 分析 - -1医生:医生编号、姓名 、 地址、 联系、科室、年龄 、职位 - -处方:处方号、病人年龄、处方内容、主治医师、病人姓名、病人性别 - -科室:科室编号 、 科室名称 - -护士:护士编号、姓名、联系电话、 - -患者:姓名、年龄、联系电话、性别、医保号、家庭住址、职业 - -检查项目:检查序号、检查工序、检验内容、检查结果、检查收费情况、检查医师 - -病例单: 病历号、病人姓名、病例内容、诊断时间、主治医师 - -收费项目:收费项目编号、项目类型、收费金额、收费人员、病人姓名 - -药品:药品编号、药品名称,药品介绍、分类 - -#### 概念模型 - -![image-20230914084659961](https://s2.loli.net/2023/09/14/PVUsy5CbW6OY8Bp.png) - -#### 逻辑模型 - -![](https://s2.loli.net/2023/09/14/KYc4sSX1Wp38V6w.png) - -### DDL语句 - -~~~mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 23:39:50 */ -/*==============================================================*/ - -CREATE DATABASE hospital CHARSET utf8; -use hospital; -drop table if exists detailed; - -drop table if exists doctor; - -drop table if exists dossier; - -drop table if exists medicine; - -drop table if exists nurse; - -drop table if exists patient; - -drop table if exists prescription; - -drop table if exists section; - -drop table if exists tariff; - -/*==============================================================*/ -/* Table: detailed */ -/*==============================================================*/ -create table detailed -( - detailed_id char(10) not null, - tariff_id char(11) not null, - pre_id char(10) not null, - detailed_deta char(10) not null, - primary key (detailed_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id char(10) not null, - doctor_name varchar(20) not null, - doctor_age int not null, - doctor_sex char(1) not null, - doctor_tel char(11) not null, - doctor_post varchar(10) not null, - doctor_address varchar(15), - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: dossier */ -/*==============================================================*/ -create table dossier -( - dossier_id char(12) not null, - doctor_id char(10) not null, - dossier_name varchar(8) not null, - dossier_content varchar(25) not null, - dossier_time varchar(15) not null, - dossier_doctor char(10) not null, - primary key (dossier_id) -); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - medicine_id char(10) not null, - pre_id char(10) not null, - medicine_name char(10) not null, - medicine_type char(10) not null, - medicine_introduce char(10) not null, - primary key (medicine_id) -); - -/*==============================================================*/ -/* Table: nurse */ -/*==============================================================*/ -create table nurse -( - nurse_id char(10) not null, - section_id char(10) not null, - nurse_name char(10) not null, - nurse_tel char(10) not null, - primary key (nurse_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id char(10) not null, - dossier_id char(12) not null, - patient_name varchar(10) not null, - patient_age int not null, - patient_sex char(1) not null, - patient_address varchar(12) not null, - patient_idnumber char(18) not null, - patient_post varchar(10), - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - pre_id char(10) not null, - doctor_id char(10) not null, - patient_id char(10) not null, - pra_content varchar(15) not null, - patient_name varchar(10) not null, - patient_sex char(1) not null, - patient_age int not null, - attending_doctor char(8) not null, - primary key (pre_id) -); - -/*==============================================================*/ -/* Table: section */ -/*==============================================================*/ -create table section -( - section_id char(10) not null, - doctor_id char(10), - section_name varchar(10) not null, - primary key (section_id) -); - -/*==============================================================*/ -/* Table: tariff */ -/*==============================================================*/ -create table tariff -( - tariff_id char(11) not null, - tariff_name varchar(5) not null, - tariff_project varchar(5) not null, - project_type varchar(10) not null, - tariff_money decimal(5,1) not null, - tariff_staff varchar(5) not null, - primary key (tariff_id) -); - -alter table detailed add constraint FK_detailed_tariff foreign key (tariff_id) - references tariff (tariff_id) on delete restrict on update restrict; - -alter table detailed add constraint FK_pay foreign key (pre_id) - references prescription (pre_id) on delete restrict on update restrict; - -alter table dossier add constraint FK_write foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table medicine add constraint FK_reason foreign key (pre_id) - references prescription (pre_id) on delete restrict on update restrict; - -alter table nurse add constraint FK_section_nurse foreign key (section_id) - references section (section_id) on delete restrict on update restrict; - -alter table patient add constraint FK_pertain foreign key (dossier_id) - references dossier (dossier_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_doctor_pre foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_possess foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table section add constraint FK_doctor_section foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - - -~~~ \ No newline at end of file diff --git "a/51 \347\250\213\350\210\234/20230914.md" "b/51 \347\250\213\350\210\234/20230914.md" deleted file mode 100644 index 5ca897e99098fd6a02b9cda175cb0f01c9fbe17f..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230914.md" +++ /dev/null @@ -1,31 +0,0 @@ -## 大二任务 - -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/51 \347\250\213\350\210\234/20230915.md" "b/51 \347\250\213\350\210\234/20230915.md" deleted file mode 100644 index 52220d8aff266c7de839999537d8c87a66ff0178..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230915.md" +++ /dev/null @@ -1,107 +0,0 @@ -```mysql -create database car charset utf8; -use car; -CREATE TABLE `car` ( - `car_id` int NOT NULL AUTO_INCREMENT, - `car_brand` varchar(10) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `car_model` varchar(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`car_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of car --- ---------------------------- -INSERT INTO `car` VALUES (1, '宝马', 'X5'); -INSERT INTO `car` VALUES (2, '奔驰', 'E200L'); -INSERT INTO `car` VALUES (3, '奥迪', 'A8'); -INSERT INTO `car` VALUES (4, '法拉利', '990'); - --- ---------------------------- --- Table structure for client --- ---------------------------- -DROP TABLE IF EXISTS `client`; -CREATE TABLE `client` ( - `client_id` int NOT NULL AUTO_INCREMENT, - `client_name` char(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `client_age` int NOT NULL, - `client_gender` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `client_tel` char(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `client_address` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`client_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of client --- ---------------------------- -INSERT INTO `client` VALUES (1, '张三', 23, '男', '12345678910', '缅甸'); -INSERT INTO `client` VALUES (2, '李四', 24, '女', '12345678910', '福建泉州'); -INSERT INTO `client` VALUES (3, '王五', 22, '男', '12345678910', '福建龙岩'); -INSERT INTO `client` VALUES (4, '赵六', 26, '男', '12345678910', '福建福州'); - --- ---------------------------- --- Table structure for sales --- ---------------------------- -DROP TABLE IF EXISTS `sales`; -CREATE TABLE `sales` ( - `sell_id` int NULL DEFAULT NULL, - `client_id` int NULL DEFAULT NULL, - `car_id` int NULL DEFAULT NULL, - `sales_date` date NOT NULL, - `sales_price` double(10, 2) NOT NULL, - INDEX `FK_Relationship_1`(`sell_id` ASC) USING BTREE, - INDEX `FK_Relationship_2`(`client_id` ASC) USING BTREE, - INDEX `FK_Relationship_3`(`car_id` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`sell_id`) REFERENCES `sell` (`sell_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_2` FOREIGN KEY (`client_id`) REFERENCES `client` (`client_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_Relationship_3` FOREIGN KEY (`car_id`) REFERENCES `car` (`car_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of sales --- ---------------------------- -INSERT INTO `sales` VALUES (1, 2, 3, '2023-09-19', 990000.00); -INSERT INTO `sales` VALUES (2, 1, 1, '2023-07-20', 450000.00); -INSERT INTO `sales` VALUES (2, 4, 4, '2023-08-21', 1500000.00); -INSERT INTO `sales` VALUES (3, 3, 2, '2023-10-22', 500000.00); - --- ---------------------------- --- Table structure for sell --- ---------------------------- -DROP TABLE IF EXISTS `sell`; -CREATE TABLE `sell` ( - `sell_id` int NOT NULL AUTO_INCREMENT, - `sell_name` char(5) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `sell_age` int NOT NULL, - `sell_gender` char(1) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `sell_tel` char(11) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `sell_address` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`sell_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of sell --- ---------------------------- -INSERT INTO `sell` VALUES (1, '官文诚', 28, '男', '12345678910', '缅甸'); -INSERT INTO `sell` VALUES (2, '陈佳炜', 26, '男', '98765432100', '老挝'); -INSERT INTO `sell` VALUES (3, '程舜', 29, '男', '85274196320', '缅北'); -INSERT INTO `sell` VALUES (4, '李俊兴', 30, '男', '96374185212', '柬埔寨'); - -SET FOREIGN_KEY_CHECKS = 1; - --- 1.查询特定销售员的销售记录 - select * from sell s join sales a on s.sell_id=a.sell_id where s.sell_name='官文诚'; - -- 2.查找销售记录中销售价格最高的汽车 - select c.car_brand,s.sales_price from sales s join car c on s.car_id=c.car_id where s.sales_price=(select max(sales_price) from sales); - -- 3.统计某个销售员的销售总额 - select sum(a.sales_price),s.sell_name from sell s join sales a on s.sell_id=a.sell_id where s.sell_name='陈佳炜'; - -- 4.根据客户信息查询其购买过的汽车 - select c.client_name,r.car_brand,r.car_model from client c left join sales s on c.client_id=s.client_id left join car r on s.car_id=r.car_id where c.client_name='张三'; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - select sum(s.sales_price),count(c.car_id) from car c left join sales s on c.car_id=s.car_id group by c.car_brand; - -- 6.检索特定日期范围内的销售了哪些汽车 - select * from car c join sales s on c.car_id=s.car_id where s.sales_date between '2023-07-20' and '2023-10-01'; - -- 7.查找某车型的销售历史。 - select * from car c join sales s on c.car_id=s.car_id where c.car_model='X5'; - -- 8.统计每个销售员的销售数量 - select s.sell_name,count(a.car_id) from sell s join sales a on s.sell_id=a.sell_id group by s.sell_id; -``` \ No newline at end of file diff --git "a/51 \347\250\213\350\210\234/20230919.md" "b/51 \347\250\213\350\210\234/20230919.md" deleted file mode 100644 index d041d8f1b9e4994272868f57309179489948aba3..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230919.md" +++ /dev/null @@ -1,1400 +0,0 @@ -```mysql -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ CREATE DATABASE db1 charset utf8; -USE db1; - -SET NAMES utf8mb4; - -SET FOREIGN_KEY_CHECKS = 0;-- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE -IF - EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` CHAR ( 2 ) NOT NULL, - `country_name` VARCHAR ( 40 ) DEFAULT NULL, - `region_id` INT DEFAULT NULL, - PRIMARY KEY ( `country_id` ), - KEY `countr_reg_fk` ( `region_id` ), - CONSTRAINT `countr_reg_fk` FOREIGN KEY ( `region_id` ) REFERENCES `regions` ( `region_id` ) -) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'AR', '阿根廷', 2 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'AU', '澳大利亚', 3 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'BE', '比利时', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'BR', '巴西', 2 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'CA', '加拿大', 2 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'CH', '瑞士', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'CN', '中国', 3 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'DE', '德国', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'DK', '丹麦', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'EG', '埃及', 4 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'FR', '法国', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'HK', '香港', 3 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'IL', '以色列', 4 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'IN', '印度', 3 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'IT', '意大利', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'JP', '日本', 3 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'KW', '科威特', 4 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'MX', '墨西哥', 2 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'NG', '尼日利亚', 4 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'NL', '荷兰', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'SG', '新加坡', 3 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'UK', '英国', 1 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'US', '美国', 2 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'ZM', '赞比亚', 4 ); - INSERT INTO `countries` ( `country_id`, `country_name`, `region_id` ) - VALUES - ( 'ZW', '津巴布韦', 4 ); - COMMIT;-- ---------------------------- --- Table structure for departments --- ---------------------------- - DROP TABLE - IF - EXISTS `departments`; - CREATE TABLE `departments` ( - `department_id` INT NOT NULL DEFAULT '0', - `department_name` VARCHAR ( 30 ) NOT NULL, - `manager_id` INT DEFAULT NULL, - `location_id` INT DEFAULT NULL, - PRIMARY KEY ( `department_id` ), - UNIQUE KEY `dept_id_pk` ( `department_id` ), - KEY `dept_loc_fk` ( `location_id` ), - KEY `dept_mgr_fk` ( `manager_id` ), - CONSTRAINT `dept_loc_fk` FOREIGN KEY ( `location_id` ) REFERENCES `locations` ( `location_id` ), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY ( `manager_id` ) REFERENCES `employees` ( `employee_id` ) - ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of departments --- ---------------------------- - BEGIN; - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 10, '行政部', 200, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 20, '营销部', 201, 1800 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 30, '采购部', 114, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 40, '人力资源部', 203, 2400 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 50, '物流部', 121, 1500 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 60, '信息技术部', 103, 1400 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 70, '公共关系部', 204, 2700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 80, '销售部', 145, 2500 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 90, '执行部门', 100, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 100, '财务部', 108, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 110, '会计部', 205, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 120, '财务部门1', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 130, '企业税务部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 140, '控制和信用部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 150, '股东服务部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 160, '员工福利部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 170, '制造部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 180, '建筑部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 190, '承包部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 200, '运营部', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 210, '信息技术支持部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 220, '网络运营中心', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 230, '信息技术帮助台', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 240, '政府销售部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 250, '零售销售部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 260, '招聘部门', NULL, 1700 ); - INSERT INTO `departments` ( `department_id`, `department_name`, `manager_id`, `location_id` ) - VALUES - ( 270, '工资单部门', NULL, 1700 ); - COMMIT;-- ---------------------------- --- Table structure for employees --- ---------------------------- - DROP TABLE - IF - EXISTS `employees`; - CREATE TABLE `employees` ( - `employee_id` INT NOT NULL DEFAULT '0', - `first_name` VARCHAR ( 20 ) DEFAULT NULL, - `last_name` VARCHAR ( 25 ) NOT NULL, - `email` VARCHAR ( 25 ) NOT NULL, - `phone_number` VARCHAR ( 20 ) DEFAULT NULL, - `hire_date` DATE NOT NULL, - `job_id` VARCHAR ( 10 ) NOT NULL, - `salary` DOUBLE ( 8, 2 ) DEFAULT NULL, - `commission_pct` DOUBLE ( 2, 2 ) DEFAULT NULL, - `manager_id` INT DEFAULT NULL, - `department_id` INT DEFAULT NULL, - PRIMARY KEY ( `employee_id` ), - UNIQUE KEY `emp_email_uk` ( `email` ), - UNIQUE KEY `emp_emp_id_pk` ( `employee_id` ), - KEY `emp_dept_fk` ( `department_id` ), - KEY `emp_job_fk` ( `job_id` ), - KEY `emp_manager_fk` ( `manager_id` ), - CONSTRAINT `emp_dept_fk` FOREIGN KEY ( `department_id` ) REFERENCES `departments` ( `department_id` ), - CONSTRAINT `emp_job_fk` FOREIGN KEY ( `job_id` ) REFERENCES `jobs` ( `job_id` ), - CONSTRAINT `emp_manager_fk` FOREIGN KEY ( `manager_id` ) REFERENCES `employees` ( `employee_id` ) - ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of employees --- ---------------------------- - BEGIN; - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110 ); - INSERT INTO `employees` ( `employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id` ) - VALUES - ( 206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110 ); - COMMIT;-- ---------------------------- --- Table structure for job_grades --- ---------------------------- - DROP TABLE - IF - EXISTS `job_grades`; - CREATE TABLE `job_grades` ( `grade_level` VARCHAR ( 3 ) DEFAULT NULL, `lowest_sal` INT DEFAULT NULL, `highest_sal` INT DEFAULT NULL ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of job_grades --- ---------------------------- - BEGIN; - INSERT INTO `job_grades` ( `grade_level`, `lowest_sal`, `highest_sal` ) - VALUES - ( 'A', 1000, 2999 ); - INSERT INTO `job_grades` ( `grade_level`, `lowest_sal`, `highest_sal` ) - VALUES - ( 'B', 3000, 5999 ); - INSERT INTO `job_grades` ( `grade_level`, `lowest_sal`, `highest_sal` ) - VALUES - ( 'C', 6000, 9999 ); - INSERT INTO `job_grades` ( `grade_level`, `lowest_sal`, `highest_sal` ) - VALUES - ( 'D', 10000, 14999 ); - INSERT INTO `job_grades` ( `grade_level`, `lowest_sal`, `highest_sal` ) - VALUES - ( 'E', 15000, 24999 ); - INSERT INTO `job_grades` ( `grade_level`, `lowest_sal`, `highest_sal` ) - VALUES - ( 'F', 25000, 40000 ); - COMMIT;-- ---------------------------- --- Table structure for job_history --- ---------------------------- - DROP TABLE - IF - EXISTS `job_history`; - CREATE TABLE `job_history` ( - `employee_id` INT NOT NULL, - `start_date` DATE NOT NULL, - `end_date` DATE NOT NULL, - `job_id` VARCHAR ( 10 ) NOT NULL, - `department_id` INT DEFAULT NULL, - PRIMARY KEY ( `employee_id`, `start_date` ), - UNIQUE KEY `jhist_emp_id_st_date_pk` ( `employee_id`, `start_date` ), - KEY `jhist_job_fk` ( `job_id` ), - KEY `jhist_dept_fk` ( `department_id` ), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY ( `department_id` ) REFERENCES `departments` ( `department_id` ), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY ( `employee_id` ) REFERENCES `employees` ( `employee_id` ), - CONSTRAINT `jhist_job_fk` FOREIGN KEY ( `job_id` ) REFERENCES `jobs` ( `job_id` ) - ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of job_history --- ---------------------------- - BEGIN; - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 101, '1993-10-28', '1997-03-15', 'AC_MGR', 110 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 102, '1993-01-13', '1998-07-24', 'IT_PROG', 60 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 176, '1998-03-24', '1998-12-31', 'SA_REP', 80 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 176, '1999-01-01', '1999-12-31', 'SA_MAN', 80 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 200, '1987-09-17', '1993-06-17', 'AD_ASST', 90 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90 ); - INSERT INTO `job_history` ( `employee_id`, `start_date`, `end_date`, `job_id`, `department_id` ) - VALUES - ( 201, '1996-02-17', '1999-12-19', 'MK_REP', 20 ); - COMMIT;-- ---------------------------- --- Table structure for jobs --- ---------------------------- - DROP TABLE - IF - EXISTS `jobs`; - CREATE TABLE `jobs` ( - `job_id` VARCHAR ( 10 ) NOT NULL DEFAULT '', - `job_title` VARCHAR ( 35 ) NOT NULL, - `min_salary` INT DEFAULT NULL, - `max_salary` INT DEFAULT NULL, - PRIMARY KEY ( `job_id` ), - UNIQUE KEY `job_id_pk` ( `job_id` ) - ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of jobs --- ---------------------------- - BEGIN; - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'AC_ACCOUNT', '公共会计师', 4200, 9000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'AC_MGR', '会计经理', 8200, 16000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'AD_ASST', '行政助理', 3000, 6000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'AD_PRES', '总裁', 20000, 40000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'AD_VP', '行政副总裁', 15000, 30000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'FI_ACCOUNT', '会计', 4200, 9000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'FI_MGR', '财务经理', 8200, 16000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'HR_REP', '人力资源代表', 4000, 9000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'IT_PROG', '程序员', 4000, 10000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'MK_MAN', '市场营销经理', 9000, 15000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'MK_REP', '市场营销代表', 4000, 9000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'PR_REP', '公共关系代表', 4500, 10500 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'PU_CLERK', '采购文员', 2500, 5500 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'PU_MAN', '采购经理', 8000, 15000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'SA_MAN', '销售经理', 10000, 20000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'SA_REP', '销售代表', 6000, 12000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'SH_CLERK', '发货文员', 2500, 5500 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'ST_CLERK', '库存文员', 2000, 5000 ); - INSERT INTO `jobs` ( `job_id`, `job_title`, `min_salary`, `max_salary` ) - VALUES - ( 'ST_MAN', '库存经理', 5500, 8500 ); - COMMIT;-- ---------------------------- --- Table structure for locations --- ---------------------------- - DROP TABLE - IF - EXISTS `locations`; - CREATE TABLE `locations` ( - `location_id` INT NOT NULL DEFAULT '0', - `street_address` VARCHAR ( 40 ) DEFAULT NULL, - `postal_code` VARCHAR ( 12 ) DEFAULT NULL, - `city` VARCHAR ( 30 ) NOT NULL, - `state_province` VARCHAR ( 25 ) DEFAULT NULL, - `country_id` CHAR ( 2 ) DEFAULT NULL, - PRIMARY KEY ( `location_id` ), - UNIQUE KEY `loc_id_pk` ( `location_id` ), - KEY `loc_c_id_fk` ( `country_id` ), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY ( `country_id` ) REFERENCES `countries` ( `country_id` ) - ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of locations --- ---------------------------- - BEGIN; - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL' ); - INSERT INTO `locations` ( `location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id` ) - VALUES - ( 3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX' ); - COMMIT;-- ---------------------------- --- Table structure for order --- ---------------------------- - DROP TABLE - IF - EXISTS `order`; - CREATE TABLE `order` ( `order_id` INT DEFAULT NULL, `order_name` VARCHAR ( 15 ) DEFAULT NULL ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of order --- ---------------------------- - BEGIN; - INSERT INTO `order` ( `order_id`, `order_name` ) - VALUES - ( 1, 'shkstart' ); - INSERT INTO `order` ( `order_id`, `order_name` ) - VALUES - ( 2, 'tomcat' ); - INSERT INTO `order` ( `order_id`, `order_name` ) - VALUES - ( 3, 'dubbo' ); - COMMIT;-- ---------------------------- --- Table structure for regions --- ---------------------------- - DROP TABLE - IF - EXISTS `regions`; - CREATE TABLE `regions` ( `region_id` INT NOT NULL, `region_name` VARCHAR ( 25 ) DEFAULT NULL, PRIMARY KEY ( `region_id` ), UNIQUE KEY `reg_id_pk` ( `region_id` ) ) ENGINE = INNODB DEFAULT CHARSET = utf8mb3;-- ---------------------------- --- Records of regions --- ---------------------------- - BEGIN; - INSERT INTO `regions` ( `region_id`, `region_name` ) - VALUES - ( 1, '欧洲' ); - INSERT INTO `regions` ( `region_id`, `region_name` ) - VALUES - ( 2, '美洲' ); - INSERT INTO `regions` ( `region_id`, `region_name` ) - VALUES - ( 3, '亚洲' ); - INSERT INTO `regions` ( `region_id`, `region_name` ) - VALUES - ( 4, '中东和非洲' ); - COMMIT;-- ---------------------------- --- View structure for emp_details_view --- ---------------------------- - DROP VIEW - IF - EXISTS `emp_details_view`; - CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS SELECT - `e`.`employee_id` AS `employee_id`, - `e`.`job_id` AS `job_id`, - `e`.`manager_id` AS `manager_id`, - `e`.`department_id` AS `department_id`, - `d`.`location_id` AS `location_id`, - `l`.`country_id` AS `country_id`, - `e`.`first_name` AS `first_name`, - `e`.`last_name` AS `last_name`, - `e`.`salary` AS `salary`, - `e`.`commission_pct` AS `commission_pct`, - `d`.`department_name` AS `department_name`, - `j`.`job_title` AS `job_title`, - `l`.`city` AS `city`, - `l`.`state_province` AS `state_province`, - `c`.`country_name` AS `country_name`, - `r`.`region_name` AS `region_name` - FROM - ((((( `employees` `e` JOIN `departments` `d` ) JOIN `jobs` `j` ) JOIN `locations` `l` ) JOIN `countries` `c` ) JOIN `regions` `r` ) - WHERE - (( - `e`.`department_id` = `d`.`department_id` - ) - AND ( `d`.`location_id` = `l`.`location_id` ) - AND ( `l`.`country_id` = `c`.`country_id` ) - AND ( `c`.`region_id` = `r`.`region_id` ) - AND ( `j`.`job_id` = `e`.`job_id` )); - - SET FOREIGN_KEY_CHECKS = 1;#第03章_基本的SELECT语句的课后练习 -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - SELECT - sum( salary * 12 ) 工资总和 - FROM - employees; -#理解1:计算12月的基本工资 -#SELECT sum(salary*12) as 工资总和 FROM employees; -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - SELECT - sum( salary * 12 ), - sum( - ifnull( salary * 12 * commission_pct, 0 )) - FROM - employees; -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - SELECT DISTINCT - job_id - FROM - employees; -# 3.查询工资大于12000的员工姓名和工资 - SELECT - last_name, - salary - FROM - employees - WHERE - salary > 12000; -# 4.查询员工号为176的员工的姓名和部门号 - SELECT - last_name, - department_id - FROM - employees - WHERE - employee_id = 176; -#; -# 5.显示表 departments 的结构,并查询其中的全部数据 - DESC departments; - SELECT - * - FROM - departments; -# 第04章_运算符课后练习 -# 1.选择工资不在5000到12000的员工的姓名和工资 - SELECT - last_name, - salary - FROM - employees - WHERE - salary NOT BETWEEN 5000 - AND 12000; -# 2.选择在20或50号部门工作的员工姓名和部门号 - SELECT - last_name, - department_id - FROM - employees - WHERE - department_id = 20 - OR department_id = 50; -# 3.选择公司中没有管理者的员工姓名及job_id - SELECT - last_name, - job_id - FROM - employees - WHERE - manager_id IS NULL; -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - SELECT - last_name, - salary, - salary * commission_pct, - g.grade_level - FROM - employees e - JOIN job_grades g ON e.salary * commission_pct BETWEEN g.lowest_sal - AND g.highest_sal - WHERE - commission_pct IS NOT NULL; -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - SELECT - * - FROM - employees - WHERE - last_name LIKE '__尔'; -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - SELECT - * - FROM - employees - WHERE - last_name LIKE '%尔%特%' - OR last_name LIKE '%特%尔%'; -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - SELECT - * - FROM - employees - WHERE - first_name LIKE '%尔'; -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - SELECT - * - FROM - employees - WHERE - department_id BETWEEN 80 - AND 100; -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - SELECT - * - FROM - employees - WHERE - manager_id IN ( 100, 101, 110 ); -#第05章_排序与分页的课后练习 -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - SELECT - salary * 12 - FROM - employees - ORDER BY - salary * 12 DESC; - # -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - SELECT - * - FROM - employees - WHERE - salary NOT BETWEEN 8000 - AND 17000 - ORDER BY - salary DESC - LIMIT 2, - 20; -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - SELECT - * - FROM - employees - WHERE - email LIKE '%e%' - ORDER BY - length( email ) DESC, - department_id ASC; -# 第06章_多表查询的课后练习 -# 1.显示所有员工的姓名,部门号和部门名称。 - SELECT - e.last_name, - d.department_id, - d.department_name - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id; -# 2.查询90号部门员工的job_id和90号部门的location_id - SELECT - * - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - WHERE - d.department_id = 90; -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - SELECT - e.last_name, - d.department_name, - l.location_id, - l.city - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - LEFT JOIN locations l ON d.location_id = l.location_id - WHERE - e.commission_pct IS NOT NULL; -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - SELECT - e.last_name, - e.job_id, - d.department_id, - d.department_name - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - LEFT JOIN locations l ON d.location_id = l.location_id - WHERE - l.city = '多伦多'; -#sql92语法(自然连接): -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - SELECT - * - FROM - departments d - LEFT JOIN employees e ON d.department_id = e.department_id - WHERE - d.department_name = '行政部'; - SELECT - * - FROM - departments d, - employees e - WHERE - d.department_id = e.department_id - AND d.department_name = '行政部'; -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - SELECT - e.first_name 员工姓名, - e.employee_id 员工号, - s.last_name 上级姓名, - s.employee_id 上级员工号 - FROM - employees e - INNER JOIN employees s ON e.employee_id = s.employee_id; -# 7.查询哪些部门没有员工 - SELECT - * - FROM - departments d - LEFT JOIN employees e ON d.department_id = e.department_id - WHERE - d.manager_id IS NULL; -# 8. 查询哪个城市没有部门 - SELECT - * - FROM - locations l - LEFT JOIN departments d ON l.location_id = d.location_id - WHERE - d.department_id IS NULL; -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - SELECT - * - FROM - employees e - LEFT JOIN departments d ON e.department_id = d.department_id - WHERE - d.department_name = '销售部' - OR d.department_name = '信息技术部'; -# 第08章_聚合函数的课后练习 -#2.查询公司员工工资的最大值,最小值,平均值,总和 - SELECT - max( salary ), - min( salary ), - avg( salary ), - sum( salary ) - FROM - employees; -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - SELECT - max( salary ), - min( salary ), - avg( salary ), - sum( salary ), - job_id - FROM - employees - GROUP BY - job_id; -#4.选择各个job_id的员工人数 - SELECT - count( job_id ) - FROM - employees; -# 5.查询员工最高工资和最低工资的差距 - SELECT - max( salary )- min( salary ) differnce - FROM - employees; -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - SELECT - min( salary ) 最低工资, - manager_id - FROM - employees - GROUP BY - manager_id - HAVING - 最低工资 >= 6000 - AND manager_id IS NOT NULL; -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - SELECT - department_id, - count( employee_id ), - avg( salary ) - FROM - employees - GROUP BY - department_id - ORDER BY - avg( salary ) DESC; -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - SELECT - min( salary ), - d.department_id, - d.department_name, - e.job_id - FROM - employees e - INNER JOIN departments d ON e.department_id = d.department_id - GROUP BY - department_id, - job_id; -# 第09章_子查询的课后练习 -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - SELECT - last_name, - salary - FROM - employees - WHERE - department_id =( - SELECT - department_id - FROM - employees - WHERE - last_name = '兹洛特基' - ); -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - SELECT - * - FROM - employees - WHERE - salary >( - SELECT - avg( salary ) - FROM - employees - ); -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - SELECT - last_name, - job_id, - salary - FROM - employees - WHERE - salary > ALL ( SELECT salary FROM employees WHERE job_id = 'SA_MAN' ); -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - SELECT - employee_id, - last_name - FROM - employees - WHERE - department_id = ANY ( SELECT department_id FROM employees WHERE email LIKE '%u%' ); -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - SELECT - department_id - FROM - employees - WHERE - department_id IN ( SELECT department_id FROM departments WHERE location_id = 1700 ); -#6.查询管理者是 金 的员工姓名和工资 - SELECT - last_name, - salary - FROM - employees - WHERE - manager_id IN ( SELECT employee_id FROM employees WHERE last_name = '金' ); -#7.查询工资最低的员工信息: last_name, salary - SELECT - last_name, - salary - FROM - employees - WHERE - salary = ( SELECT min( salary ) FROM employees ) -#8.查询平均工资最低的部门信息 - SELECT - * - FROM - departments - WHERE - department_id = ( SELECT department_id FROM employees GROUP BY department_id HAVING AVG( salary ) <= ALL ( SELECT AVG( salary ) FROM employees GROUP BY department_id ) ); - #方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - SELECT - d.*,( - SELECT - AVG( salary ) - FROM - employees - WHERE - department_id = d.department_id - ) avg_sal - FROM - departments d - WHERE - department_id = ( - SELECT - department_id - FROM - employees - GROUP BY - department_id - HAVING - AVG( salary ) <= ALL ( SELECT AVG( salary ) avg_sal FROM employees GROUP BY department_id ) - ); -#10.查询平均工资最高的 job 信息 - SELECT - * - FROM - jobs - WHERE - job_id = ( SELECT job_id FROM employees GROUP BY job_id HAVING AVG( salary ) >= ALL ( SELECT AVG( salary ) FROM employees GROUP BY job_id ) );#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 -#11.查询平均工资高于公司平均工资的部门有哪些? - SELECT - department_id - FROM - employees - WHERE - department_id IS NOT NULL - GROUP BY - department_id - HAVING - AVG( salary ) > ( SELECT AVG( salary ) FROM employees ); -#12.查询出公司中所有 manager 的详细信息 - SELECT - employee_id, - last_name, - salary - FROM - employees - WHERE - employee_id IN ( SELECT DISTINCT manager_id FROM employees ); -#方式1:自连接 自己连自己 -#方式2:子查询 -#员工编号=(管理员编号有哪些) -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - SELECT - * - FROM - employees - WHERE - department_id = 10; - #方式: -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - SELECT - department_id - FROM - departments - WHERE - department_id NOT IN ( SELECT DISTINCT department_id FROM employees WHERE job_id = 'ST_CLERK' ); -#16. 选择所有没有管理者的员工的last_name - SELECT - last_name - FROM - employees e1 - WHERE - NOT EXISTS ( SELECT * FROM employees e2 WHERE e1.manager_id = e2.employee_id ); -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - SELECT - employee_id, - last_name, - hire_date, - salary - FROM - employees - WHERE - manager_id = ( SELECT employee_id FROM employees WHERE last_name = 'De Haan' ); - #方式2: -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) -#方式1:使用相关子查询 -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - SELECT - department_name, - department_id - FROM - departments d - WHERE - 5 < ( SELECT COUNT(*) FROM employees e WHERE d.department_id = e.department_id ); -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - SELECT - country_id - FROM - locations l - WHERE - 2 < ( SELECT COUNT(*) FROM departments d WHERE l.`location_id` = d.`location_id` ); -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` \ No newline at end of file diff --git "a/51 \347\250\213\350\210\234/20230920.md" "b/51 \347\250\213\350\210\234/20230920.md" deleted file mode 100644 index 116e52b3446fc18788947c5fb347196f99ef8275..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230920.md" +++ /dev/null @@ -1,201 +0,0 @@ -### RBAC (Role-Based Access Control) - -RBAC : 基于角色访问控制权限 - -一个控制模型 - -**角色**是RBAC是的核心 - - RBAC是主流设计模式 - -#### 数据库能存什么 - -1. 业务数据表:用户、商品 -2. 功能资源表:菜单信息表、页面代码表 - -#### 权限使用背景 - -菜单权限: 不同用户登录系统后,展示菜单不同 - -按钮权限:不同用户查看同一个对象时,展示按钮不一样 - -数据权限:可见数据不同 - -操作权限:看得到点不着 例如:腾讯视频VIP你可以看到视频但是不可以播放 - -#### RBAC由三个部分组成 - -1. 用户 -2. 角色 -3. 权限 - -- User(用户):每个用户都有唯一的UID识别,并被授予不同的角色 -- Role(角色):不同角色具有不同的权限 -- Permission(权限):访问权限 -- 用户-角色映射:用户和角色之间的映射关系 -- 角色-权限映射:角色和权限之间的映射 - -权限关联实现授权,给用户分配应当有的对应权限 - -##### RBAC的优点: - -简化了用户和权限的关系 - -易扩展,易维护 - -##### 缺点: - -RBAC模型没有提供操作顺序的控制机制,这一缺陷得RBAC模型很难适应那些对操作次序有严格要求的系统 - -###### 表结构 - -~~~mysql -/* - Navicat Premium Data Transfer - - Source Server : 456 - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : test - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 20/09/2023 20:33:19 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for authority --- ---------------------------- -DROP TABLE IF EXISTS `authority`; -CREATE TABLE `authority` ( - `author_id` int NOT NULL AUTO_INCREMENT, - `author_vip` varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `author_address` varchar(200) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`author_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of authority --- ---------------------------- -INSERT INTO `authority` VALUES (1, '首页', 'http://www.mxdx.com/index'); -INSERT INTO `authority` VALUES (2, '学生权限', 'http://www.mxdx.com/student'); -INSERT INTO `authority` VALUES (3, '老师信息', 'http://www.mxdx.com/teacher'); -INSERT INTO `authority` VALUES (4, '职工工资', 'http://www.mxdx.com/salay'); - --- ---------------------------- --- Table structure for role --- ---------------------------- -DROP TABLE IF EXISTS `role`; -CREATE TABLE `role` ( - `role_id` int NOT NULL AUTO_INCREMENT, - `role_name` varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`role_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role --- ---------------------------- -INSERT INTO `role` VALUES (1, '老师'); -INSERT INTO `role` VALUES (2, '学生'); -INSERT INTO `role` VALUES (3, '校长'); - --- ---------------------------- --- Table structure for role_authority --- ---------------------------- -DROP TABLE IF EXISTS `role_authority`; -CREATE TABLE `role_authority` ( - `author_id` int NOT NULL, - `role_id` int NOT NULL, - PRIMARY KEY (`author_id`, `role_id`) USING BTREE, - INDEX `FK_role_authority2`(`role_id` ASC) USING BTREE, - CONSTRAINT `FK_role_authority` FOREIGN KEY (`author_id`) REFERENCES `authority` (`author_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_role_authority2` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of role_authority --- ---------------------------- -INSERT INTO `role_authority` VALUES (1, 1); -INSERT INTO `role_authority` VALUES (2, 1); -INSERT INTO `role_authority` VALUES (3, 1); -INSERT INTO `role_authority` VALUES (1, 2); -INSERT INTO `role_authority` VALUES (2, 2); -INSERT INTO `role_authority` VALUES (1, 3); -INSERT INTO `role_authority` VALUES (2, 3); -INSERT INTO `role_authority` VALUES (3, 3); -INSERT INTO `role_authority` VALUES (4, 3); - --- ---------------------------- --- Table structure for user --- ---------------------------- -DROP TABLE IF EXISTS `user`; -CREATE TABLE `user` ( - `user_id` int NOT NULL AUTO_INCREMENT, - `user_name` varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `user_pwd` char(18) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`user_id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user --- ---------------------------- -INSERT INTO `user` VALUES (1, '程舜', '222222'); -INSERT INTO `user` VALUES (2, '张起瑞', '2222222'); -INSERT INTO `user` VALUES (3, '丘丘', '123456'); -INSERT INTO `user` VALUES (4, '梁凯', '7456123'); - --- ---------------------------- --- Table structure for user_role --- ---------------------------- -DROP TABLE IF EXISTS `user_role`; -CREATE TABLE `user_role` ( - `role_id` int NOT NULL, - `user_id` int NOT NULL, - PRIMARY KEY (`role_id`, `user_id`) USING BTREE, - INDEX `FK_user_role2`(`user_id` ASC) USING BTREE, - CONSTRAINT `FK_user_role` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_user_role2` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of user_role --- ---------------------------- -INSERT INTO `user_role` VALUES (2, 1); -INSERT INTO `user_role` VALUES (2, 2); -INSERT INTO `user_role` VALUES (1, 3); -INSERT INTO `user_role` VALUES (3, 4); - -SET FOREIGN_KEY_CHECKS = 1; - -~~~ - - - -###### 查询 - -~~~mysql -SELECT u.user_name,ro.role_name, aut.author_vip, aut.author_address FROM -`user` u, -user_role us, -role ro, -role_authority au, -authority aut -WHERE -u.user_id=us.user_id -AND -us.role_id=ro.role_id -AND -ro.role_id=au.role_id -AND -au.author_id=aut.author_id -AND -u.user_name='丘丘' -AND -u.user_pwd='123456'; -~~~ \ No newline at end of file diff --git "a/51 \347\250\213\350\210\234/20230921.md" "b/51 \347\250\213\350\210\234/20230921.md" deleted file mode 100644 index 28987f8b231a59bf153c482a621e505409c638d2..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230921.md" +++ /dev/null @@ -1,131 +0,0 @@ -### sku - -SKU是类似一款商品,每款都有出现一个SKU。一款商品有许多颜色,则是有多个SKU - -例如:一款手机,有白色,黑色,红色 - -### spu - -一般SPU 与SKU 是一对一,或者一对多的关系;如果一对多的话就是不同的规格 - -例如:spu比作商品的款,sku比作商品的数量 - -SPU指一个商品集合,一般来说就是一个集合链。一个服装的集合链会包括相似款式和不同的尺码,SKU则是最小品类单元,同一个款式的衣服不同的尺码也算不同的SKU。SKU多见于前台的商品编号,SPU多见于后台的商品管理 - - - -![image-20230921223126500](C:\Users\1761144610\AppData\Roaming\Typora\typora-user-images\image-20230921223126500.png) - - - - - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:41:07 */ -/*==============================================================*/ - -CREATE DATABASE biao charset utf8; - -use biao; - -drop table if exists lan; - -drop table if exists property; - -drop table if exists sku; - -drop table if exists spu; - -drop table if exists valuez; - -/*==============================================================*/ -/* Table: lan */ -/*==============================================================*/ -create table lan -( - lan_id int not null auto_increment, - property_id int, - values_id int, - sku_id int, - primary key (lan_id) -); - -/*==============================================================*/ -/* Table: property */ -/*==============================================================*/ -create table property -( - property_id int not null auto_increment, - property_name varchar(10) not null, - primary key (property_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(20) not null, - sku_price decimal(8,1) not null, - sku_numb int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_text text, - primary key (spu_id) -); - -/*==============================================================*/ -/* Table: valuez */ -/*==============================================================*/ -create table valuez -( - values_id int not null auto_increment, - values_name varchar(20) not null, - primary key (values_id) -); - -alter table lan add constraint FK_Relationship_1 foreign key (property_id) - references property (property_id) on delete restrict on update restrict; - -alter table lan add constraint FK_Relationship_2 foreign key (values_id) - references valuez (values_id) on delete restrict on update restrict; - -alter table lan add constraint FK_Relationship_3 foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table sku add constraint FK_Relationship_4 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - - -``` - -```mysql -INSERT INTO `spu` (`spu_id`, `spu_name`, `spu_text`) VALUES (1, '红米50', '还不错哦!'); - -INSERT INTO `sku` (`sku_id`, `spu_id`, `sku_name`, `sku_price`, `sku_numb`) VALUES (1, 1, '红米 白色', 3450.0, 400); -INSERT INTO `sku` (`sku_id`, `spu_id`, `sku_name`, `sku_price`, `sku_numb`) VALUES (2, 1, '红米 黑色', 3452.0, 500); -INSERT INTO `sku` (`sku_id`, `spu_id`, `sku_name`, `sku_price`, `sku_numb`) VALUES (3, NULL, '红米 红色', 3333.0, 600); - -INSERT INTO `valuez` (`values_id`, `values_name`) VALUES (1, '红色'); -INSERT INTO `valuez` (`values_id`, `values_name`) VALUES (2, '黑色'); -INSERT INTO `valuez` (`values_id`, `values_name`) VALUES (3, '白色'); -INSERT INTO `valuez` (`values_id`, `values_name`) VALUES (4, '512'); -INSERT INTO `valuez` (`values_id`, `values_name`) VALUES (5, '252'); -INSERT INTO `valuez` (`values_id`, `values_name`) VALUES (6, '128'); - -INSERT INTO `property` (`property_id`, `property_name`) VALUES (1, '颜色'); -INSERT INTO `property` (`property_id`, `property_name`) VALUES (2, '内存'); - -``` \ No newline at end of file diff --git "a/51 \347\250\213\350\210\234/20230922.md" "b/51 \347\250\213\350\210\234/20230922.md" deleted file mode 100644 index 38ba81f3a04cb1bf08e318a15846044b06baa12a..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230922.md" +++ /dev/null @@ -1,127 +0,0 @@ -## 数据库高级预习 - -当数据库复杂需要多条 SQL 语句查询时,可以使用存储过程去完成这个需求。 - -### 创建存储过程语法 - -使用 create procedure 语句创建存储过程 - -#### 声明语句结束符 - -```mysql -delimiter $$ - -delimiter // -``` - -#### 创建 mysql 存储过程、存储函数 - -```mysql -create procedure 存储过程名(参数) -``` - -#### 存储过程体 - -```mysql -create function 存储函数名(参数) -``` - -#### 参数类型有三种: - -```mysql -IN: 输入参数,该参数的值必须在调用该存储过程时指定,在存储过程内部使用, 不能返回。 - -缺省值是IN。 - -OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - -INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回。 -``` - -### 事务 - - 为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - -#### 事务的四个特性 - -原子性:事务包含的这一系列操作,要么全部成功,要么全部失败(由DBMS的事务管理子系统来实现)。 - -一致性:事务完成之后,不会将非法的数据写入数据库(由DBMS的完整性子系统执行测试任务)。 - -隔离性:多个事务可以在一定程度上并发执行(由DBMS的并发控制子系统实现)。 - -持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上)(由DBMS的恢复管理子系统实现的)。 - -#### 隔离级别 - - 隔离级别从低到高依次是"读未提交"、“读已提交”、“可重复读取”和“序列化”,隔离级别越高,性能越低。mysql 数据库默认隔离级别是“可重复读取”,oracle是“读已提交”。数据库底层使用的“加锁”的机制来实现不同的隔离级别,包括对整个表加锁,对表中的行加锁。 - -### 视图 - -在已有的表或者视图上创建的虚拟表。 - -#### 创建视图 - -```mysql -create view 视图名 as select -``` - -注:可以对单表或者多表进行查询,数据库会将视图的定义保存下来。 - -可以对(单表)视图进行一些增删改查操作,这些操作会影响到原始的表。 - -#### 删除视图 - -```mysql -drop view 视图名 -``` - -### 索引 - - 为了提高查询的速度而在数据库端创建的一种排序的数据结构。 - - 注:索引类似于一本书的目录 - -#### 创建索引 - -```mysql -create index 索引名 on 表名(字段列表) -``` - -在经常作为查询条件的字段加索引,除此以外,还要在分组、过滤、排序及联合查询的字段上加索引。 - -#### 删除索引 - -```mysql -drop index 索引名 on 表名 -``` - -### 锁 - -共享锁(S锁,读锁)和排他锁(X锁,写锁)——行锁 - -``` -共享锁:若事务A 对某行数据加S锁,此时允许其他事务对该行数据加S锁,即可以有多个事务共同读取改行数 据,但是不允许其他事务对该数据加X锁 - -排他锁(X锁,写锁,独占锁):若事务A对某行数据加X锁,此时不允许其他事务对该行数据加任何锁 -``` - -数据库中 - -1. 数据库中进行增,删,改操作时,会自动给行添加排他锁,行数据添加上了排他锁,不允许其他事务对该行数据加任何锁 -2. 数据库中进行查(select)操作时,对数据不加任何锁 - -1. 给行数据手动添加共享锁: - - ```mysql - select ..from..lock in share mode - select..from .. for share - ``` - -2. 添加排他锁: - - ```mysql - select...from...for update - ``` - - \ No newline at end of file diff --git "a/51 \347\250\213\350\210\234/20230926.md" "b/51 \347\250\213\350\210\234/20230926.md" deleted file mode 100644 index 8ee4ac7e2bca5ad317d4b2eb03f088a285882a34..0000000000000000000000000000000000000000 --- "a/51 \347\250\213\350\210\234/20230926.md" +++ /dev/null @@ -1,83 +0,0 @@ -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -```mysql -CREATE VIEW employee_vu AS SELECT LAST_NAME 姓名,EMPLOYEE_ID 员工号,DEPARTMENT_ID 部门号 FROM employees; -``` - -#2. 显示视图的结构 - -```mysql -DESC employee_vu; -``` - -#3. 查询视图中的全部内容 - -````mysql -SELECT * FROM employee_vu; -```` - -#4. 将视图中的数据限定在部门号是80的范围内 - -```mysql -SELECT * FROM employee_vu WHERE 部门号>=0 AND 部门号<=80; -``` - -#练习2: - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -```mysql -CREATE VIEW emp_v1 AS SELECT last_name 员工姓名,salary 工资,email 邮箱 FROM employees where phone_number LIKE '011%'; -``` - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - -```mysql -CREATE OR REPLACE VIEW emp_v1 AS -SELECT last_name 员工姓名,salary 工资,email 邮箱,phone_number 电话 FROM employees WHERE phone_number LIKE '011%' AND email LIKE 'e%'; -``` - -#3. 向 emp_v1 插入一条记录,是否可以? - -```mysql -INSERT INTO emp_v1(员工姓名,工资,邮箱,电话) VALUES ( -"locations","10086","weqadsad","011.44.1344.429019" -); -``` - -不可以!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -#4. 修改emp_v1中员工的工资,每人涨薪1000 - -```mysql -UPDATE emp_v1 SET 工资=工资+1000; -``` - -#5. 删除emp_v1中姓名为Olsen的员工 - -```mysql -DELETE FROM emp_v1 WHERE 员工姓名='Olsen'; -``` - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -```mysql -CREATE OR REPLACE VIEW emp_v2(dept_id,max_sal) AS SELECT department_id,MAX(salary) FROM employees GROUP BY department_id HAVING MAX(salary)>12000; -``` - -#7. 向 emp_v2 中插入一条记录,是否可以? -不可以!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -#8. 删除刚才的emp_v2 和 emp_v1 - -```mysql -DROP VIEW IF EXISTS emp_v2,emp_v1; -SHOW TABLES; -``` - diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/123.sql" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/123.sql" deleted file mode 100644 index 44cd8236dd05f3bdaba1aba7aa47b33891cbd4d3..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/123.sql" +++ /dev/null @@ -1,32 +0,0 @@ -CREATE DATABASE school charset utf8; -use school; - -CREATE TABLE yuanxi( -yx_id int PRIMARY KEY auto_increment, -yx_name VARCHAR(10) -); - -CREATE TABLE zhuanye( -zy_id int PRIMARY KEY auto_increment, -zy_name VARCHAR(10) -); - - -CREATE TABLE class ( -cl_id int PRIMARY KEY auto_increment, -); - - -CREATE TABLE student( -stu_id int PRIMARY KEY auto_increment, -stu_name VARCHAR(10), -stu_age int -); - - -create table course( - co_id int(11) primary key auto_increment, - co_name varchar(20) not null unique, - teacher_id int(11) not null, - foreign key(teacher_id) references teacher (id) - ); \ No newline at end of file diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9.19.md" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/9.19.md" deleted file mode 100644 index 9f3ba01920c39cda2d9ed85573e3437d27e638b6..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9.19.md" +++ /dev/null @@ -1,322 +0,0 @@ -``` -作业 -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 -select * from employees; -SELECT sum((ifnull(commission_pct,0)*salary+salary)*12) as 工资总和 FROM employees; - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct -select * from employees; -select DISTINCT job_id from employees; - -# 3.查询工资大于12000的员工姓名和工资 -select * from employees; -select first_name,salary from employees where salary>12000; -# 4.查询员工号为176的员工的姓名和部门号 -select * from employees; -select first_name,department_id from employees WHERE employee_id=176; -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc employees; -select * from employees; -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -select * from employees; -select first_name,salary from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 -select * from employees; -select first_name,department_id from employees where department_id in (20,50); -# 3.选择公司中没有管理者的员工姓名及job_id -select * from employees; -select first_name,job_id from employees where manager_id is null; - - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -select * from employees; -select first_name,salary,g.grade_level from employees e join job_grades g on e.salary between g.lowest_sal and g.highest_sal where commission_pct is not null; - - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 -select * from employees; -select * from employees where last_name like '__尔%'; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -select * from employees; -select * from employees where last_name like '%尔%' and last_name like '%特%'; - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -select * from employees; -select * from employees where first_name like '%尔'; - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -select * from employees; -select first_name,j.job_title from employees e join jobs j on e.job_id=j.job_id where department_id between 80 and 100; -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -select * from employees; -select first_name,salary,manager_id from employees where manager_id in(100,101,110); - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select * from employees ; -SELECT (ifnull(commission_pct,0)*salary+salary)*12 aaa FROM employees ORDER BY aaa desc; -# - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -select * from employees ; -select first_name,salary from employees where salary not between 8000 and 17000 ORDER BY salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select * from employees ; - -select * from employees where email like '%e%' ORDER BY length(email) desc,department_id; - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -select first_name,d.department_id,department_name from employees e join departments d on e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id -select job_id,location_id from employees e join departments d on e.department_id=d.department_id where e.employee_id=90 or d.department_id=90; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -SELECT last_name,department_name,l.location_id,city FROM employees e join departments d join locations l on e.department_id=d.department_id and d.location_id=l.location_id; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -SELECT last_name , job_id , d.department_id , department_name FROM employees e join departments d join locations l on e.department_id=d.department_id and d.location_id=l.location_id where city='多伦多'; - - -#sql92语法(自然连接): - -SELECT last_name , job_id , d.department_id , department_name FROM employees e,departments d,locations l where city='多伦多' and e.department_id=d.department_id and d.location_id=l.location_id ; - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -select * from employees e join departments d join locations l on e.department_id=d.department_id and d.location_id=l.location_id where d.department_name='行政部'; - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select a.last_name,a.employee_id,b.last_name,b.employee_id from employees a inner join employees b on a.employee_id=b.manager_id; - - -# 7.查询哪些部门没有员工 -select d.department_name from employees e right join departments d on e.department_id=d.department_id where employee_id is null; -# 8. 查询哪个城市没有部门 - -select city from departments dep right join locations loc on dep.location_id=loc.location_id where department_id is null; - - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -select * from employees e join departments d on e.department_id=d.department_id where department_name in ('销售部','信息技术部'); - - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - -select job_id,max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees GROUP BY job_id; -#4.选择各个job_id的员工人数 -select job_id,count(job_id) from employees GROUP BY job_id; -# 5.查询员工最高工资和最低工资的差距 -select max(salary)-min(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 -select * from employees where manager_id is not null group by manager_id having min(salary)>=6000; - - - - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select d.department_name 部门名称,d.location_id 地点编号,count(employee_id) 员工数量,avg(salary) 平均工资 from employees e left join departments d on e.department_id=d.department_id GROUP by d.department_id ORDER BY 平均工资 desc; - - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - -select job_title,department_name,min(salary) from employees emp -left join departments dep on emp.department_id=dep.department_id -left join jobs on emp.job_id=jobs.job_id group by job_title,department_name; - - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -; -select department_id from employees where last_name='兹洛特基'; -select last_name,salary from employees where department_id=(select department_id from employees where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -select avg(salary) from employees; -select employee_id,last_name,salary from employees where salary>(select avg(salary) from employees); - - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select max(salary) from employees left join jobs on employees.job_id=jobs.job_id where jobs.job_id='SA_MAN'; -select employees.last_name, jobs.job_id, employees.salary from employees left join jobs on employees.job_id=jobs.job_id where salary>(select max(salary) from employees left join jobs on employees.job_id=jobs.job_id where jobs.job_id='SA_MAN'); - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -SELECT employee_id,last_name -FROM employees -SELECT department_id FROM employees where last_name like '%u%' or first_name like '%u%'; - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -select d.department_id from employees e right join departments d on e.department_id=d.department_id where location_id=1700 GROUP BY d.department_id; -select employee_id from employees e left join departments d on e.department_id=d.department_id where e.department_id in (select d.department_id from employees e right join departments d on e.department_id=d.department_id where location_id=1700 GROUP BY d.department_id); - - - -#6.查询管理者是 金 的员工姓名和工资 - -select employee_id from employees where last_name='金'; -select last_name,salary from employees where manager_id in (select employee_id from employees where last_name='金'); - - - -#7.查询工资最低的员工信息: last_name, salary -select min(salary) from employees; -select last_name, salary from employees where salary=(select min(salary) from employees); - - - -#8.查询平均工资最低的部门信息 -select * from employees a left join departments b on a.department_id=b.department_id where salary=(select min(salary)from employees); -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - - - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -select b.*,avg(salary) from employees a left join departments b on a.department_id=b.department_id where salary=(select min(salary) from employees) group by department_id; - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 -select jobs.job_id,avg(salary) from employees left join jobs on employees.job_id=jobs.job_id GROUP BY job_id; -select * from employees a left join jobs b on a.job_id=b.job_id group by b.job_id having salary=(select max(salary) from employees) ; - - - -#11.查询平均工资高于公司平均工资的部门有哪些? - -select department_id,avg(salary) from employees group by department_id having avg(salary)>(select avg(salary) from employees) ; - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - -select * from employees a left join employees b on a.employee_id=b.manager_id; -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - - - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - - - -#方式: - -select department_id,min(最高工资) from (select max(salary) 最高工资,department_id from employees group by department_id) as a group by department_id; - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: -select avg(salary) 平均工资 from employees group by department_id ; -select last_name,department_id,email,salary from employees group by department_id having avg(salary)=(select max(平均工资)from (select avg(salary) 平均工资 from employees group by department_id) as a); - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - -select department_id from employees where job_id !='ST_CLERK'; - - - -#16. 选择所有没有管理者的员工的last_name - -select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - - -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 -select avg(salary) 平均工资,department_id from employees group by department_id; -select * from employees a left join (select avg(salary) 平均工资,department_id from employees group by department_id) -b on a.department_id=b.department_id where a.salary>b.平均工资; - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -select department_id from employees group by department_id having count(department_id)>5; -select * from departments where department_id in(select department_id from employees group by department_id having count(department_id)>5); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -select country_id,count(department_id) from departments a left join locations b on a.location_id=b.location_id group by country_id -having count(department_id)>2; -``` \ No newline at end of file diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9.20.md" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/9.20.md" deleted file mode 100644 index c190580f5ea8fa13d6a00362b11dcf713590fb65..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9.20.md" +++ /dev/null @@ -1,97 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 16:43:12 */ -/*==============================================================*/ -CREATE DATABASE game charset utf8; -use game; - -drop table if exists menu; - -drop table if exists role; - -drop table if exists role_menu; - -drop table if exists user; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: menu */ -/*==============================================================*/ -create table menu -( - id int not null auto_increment, - menu_message varchar(150) not null, - menu_address varchar(200) not null, - primary key (id) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_name varchar(10) not null, - role_id int not null, - primary key (role_name) -); - -/*==============================================================*/ -/* Table: role_menu */ -/*==============================================================*/ -create table role_menu -( - role_name varchar(10) not null, - id int not null, - primary key (role_name, id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_name varchar(10) not null, - user_passward int not null, - primary key (user_id) -); - -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - user_id int not null, - role_name varchar(10) not null, - primary key (user_id, role_name) -); - -alter table role_menu add constraint FK_role_menu foreign key (role_name) - references role (role_name) on delete restrict on update restrict; - -alter table role_menu add constraint FK_role_menu2 foreign key (id) - references menu (id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (role_name) - references role (role_name) on delete restrict on update restrict; - - - -SELECT - * -FROM - menu m ,role r, role_menu rm ,`user` u ,user_role ur - where m.id=rm.id - AND rm.role_name=r.role_name - and r.role_name=ur.role_name - and ur.user_id=u.user_id - and role_id='111' and user_passward='1111'; - - - - - \ No newline at end of file diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21012\346\227\245\344\275\234\344\270\232.md" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21012\346\227\245\344\275\234\344\270\232.md" deleted file mode 100644 index 11285a8d9985301cd5583432c31d50a96ac192e3..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21012\346\227\245\344\275\234\344\270\232.md" +++ /dev/null @@ -1,131 +0,0 @@ -# 作业 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 22:59:04 */ -/*==============================================================*/ -create database movie charset utf8; -use movie; - - -drop table if exists Relationship_3; - -drop table if exists class; - -drop table if exists library; - -drop table if exists reader; - -drop table if exists student; - -drop table if exists "tea and stu"; - -drop table if exists teacher; - -/*==============================================================*/ -/* Table: Relationship_3 */ -/*==============================================================*/ -create table Relationship_3 -( - cl_id int not null, - tea_id int not null, - primary key (cl_id, tea_id) -); - -/*==============================================================*/ -/* Table: class */ -/*==============================================================*/ -create table class -( - cl_id int not null, - stu_id int not null, - cl_name char(10) not null, - primary key (cl_id) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - li_id int not null, - li_name char(10) not null, - li_number char(11) not null, - primary key (li_id) -); - -/*==============================================================*/ -/* Table: reader */ -/*==============================================================*/ -create table reader -( - re_id varchar(110) not null, - li_id int not null, - re_name varchar(11) not null, - re_number varchar(11) not null, - primary key (re_id) -); - -/*==============================================================*/ -/* Table: student */ -/*==============================================================*/ -create table student -( - stu_id int not null, - li_id int not null, - stu_name char(10) not null, - stu_number char(11) not null, - primary key (stu_id) -); - -/*==============================================================*/ -/* Table: "tea and stu" */ -/*==============================================================*/ -create table "tea and stu" -( - stu_id int not null, - tea_id int not null, - primary key (stu_id, tea_id) -); - -/*==============================================================*/ -/* Table: teacher */ -/*==============================================================*/ -create table teacher -( - tea_id int not null, - li_id int not null, - tea_name char(10) not null, - tea_number char(11) not null, - primary key (tea_id) -); - -alter table Relationship_3 add constraint FK_Relationship_3 foreign key (cl_id) - references class (cl_id) on delete restrict on update restrict; - -alter table Relationship_3 add constraint FK_Relationship_4 foreign key (tea_id) - references teacher (tea_id) on delete restrict on update restrict; - -alter table class add constraint FK_xuexi foreign key (stu_id) - references student (stu_id) on delete restrict on update restrict; - -alter table reader add constraint FK_kehu foreign key (li_id) - references library (li_id) on delete restrict on update restrict; - -alter table student add constraint FK_jieyue foreign key (li_id) - references library (li_id) on delete restrict on update restrict; - -alter table "tea and stu" add constraint "FK_tea and stu" foreign key (stu_id) - references student (stu_id) on delete restrict on update restrict; - -alter table "tea and stu" add constraint "FK_tea and stu2" foreign key (tea_id) - references teacher (tea_id) on delete restrict on update restrict; - -alter table teacher add constraint FK_yonghu foreign key (li_id) - references library (li_id) on delete restrict on update restrict; - - -``` - - \ No newline at end of file diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21013\346\227\245\344\275\234\344\270\232.md" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21013\346\227\245\344\275\234\344\270\232.md" deleted file mode 100644 index 648f0226c6bca7a6f4bea35841251066220c019f..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21013\346\227\245\344\275\234\344\270\232.md" +++ /dev/null @@ -1,140 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/18 11:24:01 */ -/*==============================================================*/ -create database ey charset utf8; -use ey ; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists guahao; - -drop table if exists hospital; - -drop table if exists kaiyao; - -drop table if exists maiyao; - -drop table if exists patient; - -drop table if exists tigong; - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doc_id int not null, - dep_id int, - doc_name varchar(10) not null, - doc_tel numeric(11,0) not null, - doc_dep varchar(10) not null, - primary key (doc_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_id int not null, - drug_name varchar(15) not null, - drug_address varchar(20) not null, - drug_date date not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: guahao */ -/*==============================================================*/ -create table guahao -( - dep_id int not null, - pa_id int not null, - primary key (dep_id, pa_id) -); - -/*==============================================================*/ -/* Table: hospital */ -/*==============================================================*/ -create table hospital -( - dep_id int not null, - dep_name varchar(10) not null, - dep_tel numeric(11,0) not null, - dep_address varchar(15) not null, - primary key (dep_id) -); - -/*==============================================================*/ -/* Table: kaiyao */ -/*==============================================================*/ -create table kaiyao -( - doc_id int not null, - pa_id int not null, - primary key (doc_id, pa_id) -); - -/*==============================================================*/ -/* Table: maiyao */ -/*==============================================================*/ -create table maiyao -( - drug_id int not null, - pa_id int not null, - primary key (drug_id, pa_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - pa_id int not null, - pa_name varchar(10) not null, - pa_age int not null, - pa_number numeric(11,0) not null, - primary key (pa_id) -); - -/*==============================================================*/ -/* Table: tigong */ -/*==============================================================*/ -create table tigong -( - dep_id int not null, - drug_id int not null, - primary key (dep_id, drug_id) -); - -alter table doctor add constraint FK_7 foreign key (dep_id) - references hospital (dep_id) on delete restrict on update restrict; - -alter table guahao add constraint FK_guahao foreign key (dep_id) - references hospital (dep_id) on delete restrict on update restrict; - -alter table guahao add constraint FK_guahao2 foreign key (pa_id) - references patient (pa_id) on delete restrict on update restrict; - -alter table kaiyao add constraint FK_kaiyao foreign key (doc_id) - references doctor (doc_id) on delete restrict on update restrict; - -alter table kaiyao add constraint FK_kaiyao2 foreign key (pa_id) - references patient (pa_id) on delete restrict on update restrict; - -alter table maiyao add constraint FK_maiyao foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -alter table maiyao add constraint FK_maiyao2 foreign key (pa_id) - references patient (pa_id) on delete restrict on update restrict; - -alter table tigong add constraint FK_tigong foreign key (dep_id) - references hospital (dep_id) on delete restrict on update restrict; - -alter table tigong add constraint FK_tigong2 foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - - diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21015\346\227\245\344\275\234\344\270\232.md" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21015\346\227\245\344\275\234\344\270\232.md" deleted file mode 100644 index c34716f0345122e0486258f9ed54ce83323214a1..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21015\346\227\245\344\275\234\344\270\232.md" +++ /dev/null @@ -1,101 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 09:06:48 */ -/*==============================================================*/ -create database 4s charset utf8; -use 4s; - -drop table if exists car; - -drop table if exists car_salesman; - -drop table if exists client; - -drop table if exists client_car; - -drop table if exists salesman; - - - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null, - car_name varchar(10) not null, - car_type varchar(10) not null, - car_date date not null, - car_address varchar(15) not null, - primary key (car_id) -); - -/*==============================================================*/ -/* Table: car_salesman */ -/*==============================================================*/ -create table car_salesman -( - car_id int not null, - salesman_id char(10) not null, - primary key (car_id, salesman_id) -); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - cl_id int not null, - cl_name varchar(10) not null, - cl_ag int not null, - cl_tel numeric(11,0) not null, - cl_sfz numeric(16,0) not null, - primary key (cl_id) -); - -/*==============================================================*/ -/* Table: client_car */ -/*==============================================================*/ -create table client_car -( - car_id int not null, - cl_id int not null, - primary key (car_id, cl_id) -); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id char(10) not null, - salesman_name char(10) not null, - salesman_sex char(10) not null, - salesman_age char(10) not null, - salesman_tel char(10) not null, - primary key (salesman_id) -); - -/*==============================================================*/ -/* Table: "salesman_trading satatement" */ -/*==============================================================*/ - - -/*==============================================================*/ -/* Table: "trading satatement" */ -/*==============================================================*/ - - -alter table car_salesman add constraint FK_car_salesman foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table car_salesman add constraint FK_car_salesman2 foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - -alter table client_car add constraint FK_client_car foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table client_car add constraint FK_client_car2 foreign key (cl_id) - references client (cl_id) on delete restrict on update restrict; - - diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21021\346\227\245\344\275\234\344\270\232.md" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21021\346\227\245\344\275\234\344\270\232.md" deleted file mode 100644 index cf3657afa3363e3aa5c4ab0c645012f9883319cf..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21021\346\227\245\344\275\234\344\270\232.md" +++ /dev/null @@ -1,58 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 17:14:06 */ -/*==============================================================*/ - -create database jingdong charset utf8; - -use jingdong; - -drop table if exists commodity; - -drop table if exists property; - -drop table if exists value; - -/*==============================================================*/ -/* Table: commodity */ -/*==============================================================*/ -create table commodity -( - com_id int not null auto_increment, - com_name varchar(10) not null, - com_color varchar(10) not null, - com_state varchar(10) not null, - com_many char(10) not null, - primary key (com_id) -); - -/*==============================================================*/ -/* Table: property */ -/*==============================================================*/ -create table property -( - pro_id int not null auto_increment, - com_id int, - pro_name varchar(10) not null, - pro_classify varchar(10) not null, - primary key (pro_id) -); - -/*==============================================================*/ -/* Table: value */ -/*==============================================================*/ -create table value -( - value_id int not null auto_increment, - pro_id int, - value_name varchar(10) not null, - value_state varchar(10) not null, - primary key (value_id) -); - -alter table property add constraint FK_commodity_property foreign key (com_id) - references commodity (com_id) on delete restrict on update restrict; - -alter table value add constraint FK_property_value foreign key (pro_id) - references property (pro_id) on delete restrict on update restrict; - diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21022\346\227\245\344\275\234\344\270\232.md" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21022\346\227\245\344\275\234\344\270\232.md" deleted file mode 100644 index 760a6c590952344db697fb549f20ee6e9c3ba857..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21022\346\227\245\344\275\234\344\270\232.md" +++ /dev/null @@ -1,177 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-22 10:09:44 */ -/*==============================================================*/ - -create database if not exists milk_tea charset utf8; - -use milk_tea; - -drop table if exists goods; - -drop table if exists menu; - -drop table if exists middle; - -drop table if exists size; - -drop table if exists size_value; - -drop table if exists sweet; - -drop table if exists type; - -/*==============================================================*/ -/* Table: goods */ -/*==============================================================*/ -create table goods -( - goods_id int not null auto_increment, - goods_name varchar(50) not null, - goods_introduce varchar(50) not null, - primary key (goods_id) -); - -insert into goods values -(1,古茗), -(2,蜜雪冰城), -(3,霸王茶姬), -(4,沪上阿姨); - -/*==============================================================*/ -/* Table: menu */ -/*==============================================================*/ -create table menu -( - menu_id int not null auto_increment, - goods_id int, - menu_name varchar(50) not null, - price numeric(4,2) not null, - number int not null, - primary key (menu_id) -); - -insert into menu value -(1,1,'芝士乌龙',18,3), -(2,1,'牛奶烧仙草',11,2), -(3,1,'茉莉奶芙',16,5), -(4,1,'椰奶波波',9,10), -(5,1,'经典奶茶',10,15), -(6,2,'杨枝甘露',9,5), -(7,2,'百香果',7,7), -(8,2,'柠檬红茶',6,3), -(9,2,'草莓波波',5,7), -(10,2,'柠檬水',4,1), -(11,3,'茉莉语',18,2), -(12,3,'桃茗香',18,7), -(13,3,'伯牙绝铉',16,3), -(14,3,'高山流水',15,7), -(15,3,'玫瑰雨',14,1), -(16,4,'红豆奶茶',9,5), -(17,4,'燕麦奶茶',9,7), -(18,4,'珍珠奶茶',9,3), -(19,4,'巧克力奶盖',9,7), -(20,4,'王国奶盖',8,11); - - -/*==============================================================*/ -/* Table: middle */ -/*==============================================================*/ -create table middle -( - ID int not null auto_increment, - menu_id int, - size_id int, - size_value int, - sweet_id int, - sweet_name varchar(15), - type_id int, - primary key (ID) -); - -insert into middle value (1,1 ),(),(),(),(),(),(),(); -/*==============================================================*/ -/* Table: size */ -/*==============================================================*/ -create table size -( - size_id int not null auto_increment, - charge varchar(50) not null, - cut varchar(50) not null, - primary key (size_id) -); - -insert into size VALUES -(1,'加冰','加珍珠'), -(2,'加冰','加红豆'), -(3,'加冰','去红豆'), -(4,'加冰','去红豆'), -(5,'去冰','加珍珠'), -(6,'去冰','加珍珠'), -(7,'去冰','去红豆'), -(8,'去冰','去红豆'); - -/*==============================================================*/ -/* Table: size_value */ -/*==============================================================*/ -create table size_value -( - size_value int not null auto_increment, - size_value—_name varchar(50) not null, - primary key (size_value) -); - -insert into size_value values -(1,'加料'), -(2,'去料'); -(3,'甜度'); -(4,'奶茶类型'); - -/*==============================================================*/ -/* Table: sweet */ -/*==============================================================*/ -create table sweet -( - sweet_id int not null auto_increment, - sweet_name varchar(15) not null, - primary key (sweet_id, sweet_name) -); - -insert into sweet value -(1,'三分甜'), -(2,'五分甜'), -(3,'不加糖'); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type char(2) not null, - primary key (type_id) -); - -insert into type values -(1,'大杯'), -(2,'中杯'), -(3,'小杯'); - -alter table menu add constraint FK_order foreign key (goods_id) - references goods (goods_id) on delete restrict on update restrict; - -alter table middle add constraint FK_Relationship_5 foreign key (sweet_id, sweet_name) - references sweet (sweet_id, sweet_name) on delete restrict on update restrict; - -alter table middle add constraint FK_Relationship_6 foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table middle add constraint FK_menu_middle foreign key (menu_id) - references menu (menu_id) on delete restrict on update restrict; - -alter table middle add constraint FK_middle_size_value foreign key (size_value) - references size_value (size_value) on delete restrict on update restrict; - -alter table middle add constraint FK_middle——size foreign key (size_id) - references size (size_id) on delete restrict on update restrict; - diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21026\346\227\245\344\275\234\344\270\232.md" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21026\346\227\245\344\275\234\344\270\232.md" deleted file mode 100644 index 5d2000575d17e40c21dbf0b3582b11a3220a0f67..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/9\346\234\21026\346\227\245\344\275\234\344\270\232.md" +++ /dev/null @@ -1,287 +0,0 @@ -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/dbtext14 /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE dbtext14; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -#第14章_视图的课后练习 - -#USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -CREATE VIEW employee_vu (姓名,员工号,部门号) AS SELECT LAST_NAME,EMPLOYEE_ID ,DEPARTMENT_ID FROM employees; - - -#2. 显示视图的结构 -DESC employee_vu; -#3. 查询视图中的全部内容 -SELECT * FROM employee_vu; - - -#4. 将视图中的数据限定在部门号是80的范围内 -CREATE or replace VIEW employee_vu AS SELECT * FROM employees where DEPARTMENT_ID<=80 and DEPARTMENT_ID>=0; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -CREATE VIEW emp_v1 - - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - - - -#3. 向 emp_v1 插入一条记录,是否可以? - - - - - - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 - - -#5. 删除emp_v1中姓名为Olsen的员工 - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - - - - - - -#7. 向 emp_v2 中插入一条记录,是否可以? - - - - -#8. 删除刚才的emp_v2 和 emp_v1 -DROP VIEW emp_v2 and emp_v1; \ No newline at end of file diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/crebas.sql" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/crebas.sql" deleted file mode 100644 index 9125d3cbcc27deb6124bc01d0336443e5fcb3283..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/crebas.sql" +++ /dev/null @@ -1,122 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 22:59:04 */ -/*==============================================================*/ - - -drop table if exists Relationship_3; - -drop table if exists class; - -drop table if exists library; - -drop table if exists reader; - -drop table if exists student; - -drop table if exists "tea and stu"; - -drop table if exists teacher; - -/*==============================================================*/ -/* Table: Relationship_3 */ -/*==============================================================*/ -create table Relationship_3 -( - cl_id int not null, - tea_id int not null, - primary key (cl_id, tea_id) -); - -/*==============================================================*/ -/* Table: class */ -/*==============================================================*/ -create table class -( - cl_id int not null, - stu_id int not null, - cl_name char(10) not null, - primary key (cl_id) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - li_id int not null, - li_name char(10) not null, - li_number char(11) not null, - primary key (li_id) -); - -/*==============================================================*/ -/* Table: reader */ -/*==============================================================*/ -create table reader -( - re_id varchar(110) not null, - li_id int not null, - re_name varchar(11) not null, - re_number varchar(11) not null, - primary key (re_id) -); - -/*==============================================================*/ -/* Table: student */ -/*==============================================================*/ -create table student -( - stu_id int not null, - li_id int not null, - stu_name char(10) not null, - stu_number char(11) not null, - primary key (stu_id) -); - -/*==============================================================*/ -/* Table: "tea and stu" */ -/*==============================================================*/ -create table "tea and stu" -( - stu_id int not null, - tea_id int not null, - primary key (stu_id, tea_id) -); - -/*==============================================================*/ -/* Table: teacher */ -/*==============================================================*/ -create table teacher -( - tea_id int not null, - li_id int not null, - tea_name char(10) not null, - tea_number char(11) not null, - primary key (tea_id) -); - -alter table Relationship_3 add constraint FK_Relationship_3 foreign key (cl_id) - references class (cl_id) on delete restrict on update restrict; - -alter table Relationship_3 add constraint FK_Relationship_4 foreign key (tea_id) - references teacher (tea_id) on delete restrict on update restrict; - -alter table class add constraint FK_xuexi foreign key (stu_id) - references student (stu_id) on delete restrict on update restrict; - -alter table reader add constraint FK_kehu foreign key (li_id) - references library (li_id) on delete restrict on update restrict; - -alter table student add constraint FK_jieyue foreign key (li_id) - references library (li_id) on delete restrict on update restrict; - -alter table "tea and stu" add constraint "FK_tea and stu" foreign key (stu_id) - references student (stu_id) on delete restrict on update restrict; - -alter table "tea and stu" add constraint "FK_tea and stu2" foreign key (tea_id) - references teacher (tea_id) on delete restrict on update restrict; - -alter table teacher add constraint FK_yonghu foreign key (li_id) - references library (li_id) on delete restrict on update restrict; - diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/\344\275\234\344\270\2321.md" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/\344\275\234\344\270\2321.md" deleted file mode 100644 index 10c53dab425df7211d19ff8a4f9dc1ee952cbf04..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/\344\275\234\344\270\2321.md" +++ /dev/null @@ -1,440 +0,0 @@ -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/\344\275\234\344\270\2324.md" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/\344\275\234\344\270\2324.md" deleted file mode 100644 index c34716f0345122e0486258f9ed54ce83323214a1..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/\344\275\234\344\270\2324.md" +++ /dev/null @@ -1,101 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 09:06:48 */ -/*==============================================================*/ -create database 4s charset utf8; -use 4s; - -drop table if exists car; - -drop table if exists car_salesman; - -drop table if exists client; - -drop table if exists client_car; - -drop table if exists salesman; - - - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null, - car_name varchar(10) not null, - car_type varchar(10) not null, - car_date date not null, - car_address varchar(15) not null, - primary key (car_id) -); - -/*==============================================================*/ -/* Table: car_salesman */ -/*==============================================================*/ -create table car_salesman -( - car_id int not null, - salesman_id char(10) not null, - primary key (car_id, salesman_id) -); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - cl_id int not null, - cl_name varchar(10) not null, - cl_ag int not null, - cl_tel numeric(11,0) not null, - cl_sfz numeric(16,0) not null, - primary key (cl_id) -); - -/*==============================================================*/ -/* Table: client_car */ -/*==============================================================*/ -create table client_car -( - car_id int not null, - cl_id int not null, - primary key (car_id, cl_id) -); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id char(10) not null, - salesman_name char(10) not null, - salesman_sex char(10) not null, - salesman_age char(10) not null, - salesman_tel char(10) not null, - primary key (salesman_id) -); - -/*==============================================================*/ -/* Table: "salesman_trading satatement" */ -/*==============================================================*/ - - -/*==============================================================*/ -/* Table: "trading satatement" */ -/*==============================================================*/ - - -alter table car_salesman add constraint FK_car_salesman foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table car_salesman add constraint FK_car_salesman2 foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - -alter table client_car add constraint FK_client_car foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table client_car add constraint FK_client_car2 foreign key (cl_id) - references client (cl_id) on delete restrict on update restrict; - - diff --git "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" "b/52\345\217\267 \347\250\213\345\270\205\347\277\224/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" deleted file mode 100644 index aa23c3810b66c2ea4011440334113dcca52e8f7b..0000000000000000000000000000000000000000 --- "a/52\345\217\267 \347\250\213\345\270\205\347\277\224/\347\254\254\344\270\200\346\254\241\344\275\234\344\270\232.md" +++ /dev/null @@ -1,29 +0,0 @@ - 通过老师的讲解初步了解了什么是技术栈和技术树。对自己大二的学习方向有了大概的方向。 - -开发框架:JavaScript 、SpringBoot 、SSM(Spring、SpringMVC、MyBatis) 、SSH(Struts,Spring,Hibernate) - -技术:js 、node.js 、Ajax 、Vue.js - -1、基本概念 - -SSH框架是JAVA EE中三种框架所集成,分别是Struts,Spring,Hibernate框架所组成,是当前比较流行的java web开源框架。 - -集成SSH框架的系统从职责上分为(Struts2--控制;spring--解耦;hibernate--操作数据库),以帮助开发人员在短期内搭建结构清晰、可服用好、维护方便的web应用程序。使用Struts作为系统的整体基础框架,负责MVC的分离,在Struts框架的模型部分,控制业务跳转,利用hibernate框架对持久层提供支持,spring做管理,管理Struts和hibernate。 - -2、Struts2 - -Struts2是一个基于MVC设计模式的web应用框架,相当于一个servlet,在MVC设计模式中,Struts2作为控制器(controller)来建立模型与视图的数据交互。Struts2在Struts1融合webwork。struts2以webwork为核心,采用拦截器的机制来处理用户的请求,这样的设计使得业务逻辑控制器能够与servletAPI完全脱离。 - -Struts2的缺点: - -校验较繁琐,多字段出错返回不同。 - -安全性太低 - -获取传参时较麻烦 - -2、Spring - -spring是一个开源开发框架,是一个轻量级控制反转(IoC)和面向切面(AOP)的容器框架。 - -spring主要用来开发java应用,构建J2EE平台的web应用。其核心就是提供一种新的机制管理业务对象及其依赖关系。 \ No newline at end of file diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230905 \347\254\254\344\270\200\346\254\241\344\275\234\344\270\232 \346\226\260\345\255\246\346\234\237\345\277\203\345\276\227/2023-9-5 \347\254\254\344\270\200\346\254\241\344\275\234\344\270\232 \346\226\260\345\255\246\346\234\237\345\277\203\345\276\227.md" "b/53 \345\221\250\345\216\232\350\276\260/20230905 \347\254\254\344\270\200\346\254\241\344\275\234\344\270\232 \346\226\260\345\255\246\346\234\237\345\277\203\345\276\227/2023-9-5 \347\254\254\344\270\200\346\254\241\344\275\234\344\270\232 \346\226\260\345\255\246\346\234\237\345\277\203\345\276\227.md" deleted file mode 100644 index c705bb7ed0be8562fbec29a79d668ad5b96bb488..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230905 \347\254\254\344\270\200\346\254\241\344\275\234\344\270\232 \346\226\260\345\255\246\346\234\237\345\277\203\345\276\227/2023-9-5 \347\254\254\344\270\200\346\254\241\344\275\234\344\270\232 \346\226\260\345\255\246\346\234\237\345\277\203\345\276\227.md" +++ /dev/null @@ -1,7 +0,0 @@ -2023年9月6日 第一次作业 心得 - -1. 制定明确的学习目标:在新学期开始之前,设定清晰的学习目标,包括每门课程的目标和期望成绩。这将帮助你更有动力和方向性地学习。 -2. 制定合理的学习计划:根据每门课程的要求和时间安排,制定一个合理的学习计划。合理分配时间,确保能够充分复习和掌握每门课程的知识。 -3. 建立良好的学习习惯:养成良好的学习习惯,如按时完成作业,定期复习,积极参与课堂讨论等。坚持这些习惯将有助于提高学习效果。 -4. 寻求帮助和合作:如果遇到困难或不理解的问题,不要犹豫寻求帮助。可以向老师、同学或在线资源寻求支持和解答。此外,与同学合作学习也能够互相促进。 -5. 保持积极的心态:保持积极的心态对于学习至关重要。相信自己能够取得好成绩,相信自己的努力会有回报。遇到挫折时,要保持乐观,不放弃努力。 \ No newline at end of file diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230906 \347\254\254\344\272\214\346\254\241\344\275\234\344\270\232 \345\205\263\347\263\273\345\236\213\345\233\276 \345\244\264\350\204\221\351\243\216\346\232\264 \351\231\242\347\263\273-\344\270\223\344\270\232/2023-9-6 \347\254\254\344\272\214\346\254\241\344\275\234\344\270\232 \345\205\263\347\263\273\345\236\213\345\233\276 \345\244\264\350\204\221\351\243\216\346\232\264 \351\231\242\347\263\273-\344\270\223\344\270\232....md" "b/53 \345\221\250\345\216\232\350\276\260/20230906 \347\254\254\344\272\214\346\254\241\344\275\234\344\270\232 \345\205\263\347\263\273\345\236\213\345\233\276 \345\244\264\350\204\221\351\243\216\346\232\264 \351\231\242\347\263\273-\344\270\223\344\270\232/2023-9-6 \347\254\254\344\272\214\346\254\241\344\275\234\344\270\232 \345\205\263\347\263\273\345\236\213\345\233\276 \345\244\264\350\204\221\351\243\216\346\232\264 \351\231\242\347\263\273-\344\270\223\344\270\232....md" deleted file mode 100644 index ddfb9b5da5952a9c6c3f4399ce756d9cc16f4e42..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230906 \347\254\254\344\272\214\346\254\241\344\275\234\344\270\232 \345\205\263\347\263\273\345\236\213\345\233\276 \345\244\264\350\204\221\351\243\216\346\232\264 \351\231\242\347\263\273-\344\270\223\344\270\232/2023-9-6 \347\254\254\344\272\214\346\254\241\344\275\234\344\270\232 \345\205\263\347\263\273\345\236\213\345\233\276 \345\244\264\350\204\221\351\243\216\346\232\264 \351\231\242\347\263\273-\344\270\223\344\270\232....md" +++ /dev/null @@ -1,190 +0,0 @@ -## 数据库关系 - -##### 什么是数据库E-R图 - -$$ -解释: -数据库E-R图是一种用于表示数据库中实体、属性和关系之间关系的图形化工具。E-R图是基于实体关系模型(Entity-Relationship Model)的一种图形表示方法,用于描述现实世界中的实体、实体之间的关系以及实体的属性。 - -在E-R图中,实体用矩形表示,属性用椭圆形表示,关系用菱形表示。实体之间的关系可以是一对一、一对多或多对多的关系。E-R图通过箭头表示关系的方向,箭头指向的实体称为从属实体,箭头的起点实体称为主实体。 - -E-R图可以帮助开发人员和数据库设计人员更好地理解数据库中的实体和关系,并帮助他们进行数据库的设计和优化。通过E-R图,可以清晰地表示实体之间的关系,从而更好地进行数据库查询和管理。 -$$ - ---- - -##### 一对一,一对多,多对多又是什么意思 - -$$ -解释: -一对一(One-to-One)关系是指两个实体之间存在唯一的关联关系。在数据库中,一个实体的记录只能与另一个实体的记录相对应,而且每个实体的记录只能与一个其他实体的记录相对应。例如,一个人只能有一个身份证号码,而一个身份证号码也只能对应一个人。 - -一对多(One-to-Many)关系是指一个实体的记录可以与另一个实体的多个记录相关联。在数据库中,一个实体的记录可以与多个其他实体的记录相对应,而每个其他实体的记录只能与一个实体的记录相对应。例如,一个部门可以有多个员工,但每个员工只能属于一个部门。 - -多对多(Many-to-Many)关系是指两个实体之间存在多对多的关联关系。在数据库中,一个实体的记录可以与多个其他实体的记录相关联,而每个其他实体的记录也可以与多个实体的记录相关联。例如,一个学生可以选择多门课程,而一门课程也可以有多个学生选择。 - -在数据库设计中,一对一、一对多和多对多关系的正确建模对于数据的组织和查询至关重要。通过合理地定义和建模实体之间的关系,可以更好地处理数据的一致性、完整性和查询效率。 -$$ - ---- - -### 表与表的关系 - -#### 一对一(1、1) - -例如:身份证与学生(任意放在一个表外键,此外键是另一个表的主键) - -#### 一对多(1、N) - -例如:教师与课程(一的主键放在多的外键) - -#### 多对多(M、N) - -例如:课程与学生(要引入第三张表,第三张表的外键要有前两张表的主键) - ----- - -## E-R图 - -#### 1.概念 - -E实体(表)、R关系(字段)、实体关系图,是指以实体、关系、属性三个基本概念概括数据的基本结构,从而描述静态数据结构的概念模式 - -#### 2.要素 - -实体、属性和关系 - ---- - -## 题目: - -根据院系各阶层制作E-R图,并用MySQL写出相应代码 - -## MySQL代码: - -```mysql --- 如果存在此库则删除 -drop database if exists University; --- 建库 -create database University charset utf8; --- 使用库 -use University; --- 建表 --- 院系 -CREATE TABLE Department ( - D_ID INT PRIMARY KEY auto_increment, - D_name VARCHAR ( 20 ) -); --- 专业 -create table speciality( -s_ID int primary key auto_increment, -s_name varchar(20), -D_ID int, -FOREIGN key (D_ID) references Department (D_ID) -); --- 教师 -create table teacher( -t_ID int primary key auto_increment, -t_name varchar(20), -t_sex varchar(20), -t_age int(20) -); --- 学生 -create table student( -s_ID int primary key auto_increment, -t_name varchar(20), -t_sex varchar(20), -t_age int(20) -); --- 班级 -create table Class( -C_ID int primary key auto_increment, -C_name varchar(20), -T_ID int, -S_ID int, -foreign key (T_ID) references teacher (t_ID), -foreign key (S_ID) references student (s_ID) -); --- 课程 -create table course( -c_ID int primary key auto_increment, -c_name varchar(20), -t_ID int, -foreign key (t_ID) references teacher(t_ID) -); --- 成绩 -create table achievement( -achi_ID int primary key auto_increment, -s_ID int, -course_ID int, -achievement int -); --- 教室 -create table classroom( -CR_ID int primary key auto_increment, -CR_name varchar(20), -CR_time time -); --- 课程表 -create table course_list( -CL_ID int primary key auto_increment, -course_ID int, -CR_ID int, -foreign key (CR_ID) references classroom (CR_ID) -); --- 专业——班级 -create table speciality_Class( -SC_ID int primary key auto_increment, -S_ID int, -C_ID int, -foreign key (S_ID) references speciality(s_ID), -foreign key (C_ID) references Class(C_ID) -); --- 插入数据 --- 院系 -insert into Department values - (null, '软件工程'), - (null, '信息工程'), - (null, '教育艺术'), - (null, '城乡建筑'); --- 专业 -insert into speciality VALUES -(null,'软件技术',1); --- 学生 -insert into student VALUES -(null,'张三','男',18), -(null,'李四','女',18); --- 教师 -insert into teacher VALUES -(null,'王大崔','男',25); --- 班级 -insert into Class VALUES -(null,'软件技术1班',1,1), -(null,'软件技术2班',1,2); --- 专业——班级 -insert into speciality_Class VALUES -(null,1,1); --- 课程 -insert into course values -(null,'Java',1), -(null,'MySQL',1) -; --- 教室 -insert into classroom VALUES -(null,'实训8','08:00'), -(null,'实训2','14:00') -; --- 成绩 -insert into achievement VALUES -(null,1,1,90), -(null,1,2,66) -; --- 课程表 -insert into course_list VALUES -(null,1,1), -(null,2,2) -; - - -``` - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230906 \347\254\254\344\272\214\346\254\241\344\275\234\344\270\232 \345\205\263\347\263\273\345\236\213\345\233\276 \345\244\264\350\204\221\351\243\216\346\232\264 \351\231\242\347\263\273-\344\270\223\344\270\232/\345\267\245\344\275\234\347\260\2771.xlsx" "b/53 \345\221\250\345\216\232\350\276\260/20230906 \347\254\254\344\272\214\346\254\241\344\275\234\344\270\232 \345\205\263\347\263\273\345\236\213\345\233\276 \345\244\264\350\204\221\351\243\216\346\232\264 \351\231\242\347\263\273-\344\270\223\344\270\232/\345\267\245\344\275\234\347\260\2771.xlsx" deleted file mode 100644 index 8856903c7505d03ec6c450f42e0f4920fe07ac69..0000000000000000000000000000000000000000 Binary files "a/53 \345\221\250\345\216\232\350\276\260/20230906 \347\254\254\344\272\214\346\254\241\344\275\234\344\270\232 \345\205\263\347\263\273\345\236\213\345\233\276 \345\244\264\350\204\221\351\243\216\346\232\264 \351\231\242\347\263\273-\344\270\223\344\270\232/\345\267\245\344\275\234\347\260\2771.xlsx" and /dev/null differ diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230906 \347\254\254\344\272\214\346\254\241\344\275\234\344\270\232 \345\205\263\347\263\273\345\236\213\345\233\276 \345\244\264\350\204\221\351\243\216\346\232\264 \351\231\242\347\263\273-\344\270\223\344\270\232/\347\273\230\345\233\2761.pdf" "b/53 \345\221\250\345\216\232\350\276\260/20230906 \347\254\254\344\272\214\346\254\241\344\275\234\344\270\232 \345\205\263\347\263\273\345\236\213\345\233\276 \345\244\264\350\204\221\351\243\216\346\232\264 \351\231\242\347\263\273-\344\270\223\344\270\232/\347\273\230\345\233\2761.pdf" deleted file mode 100644 index 58e2b2bc3734d9e213c01d5e58901e0e4828021c..0000000000000000000000000000000000000000 Binary files "a/53 \345\221\250\345\216\232\350\276\260/20230906 \347\254\254\344\272\214\346\254\241\344\275\234\344\270\232 \345\205\263\347\263\273\345\236\213\345\233\276 \345\244\264\350\204\221\351\243\216\346\232\264 \351\231\242\347\263\273-\344\270\223\344\270\232/\347\273\230\345\233\2761.pdf" and /dev/null differ diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230907 \347\254\254\344\270\211\346\254\241\347\273\204\344\275\234\344\270\232 \344\270\211\345\244\247\350\214\203\345\274\217/\347\254\254\344\270\211\346\254\241\344\275\234\344\270\232 \344\270\211\345\244\247\350\214\203\345\274\217.md" "b/53 \345\221\250\345\216\232\350\276\260/20230907 \347\254\254\344\270\211\346\254\241\347\273\204\344\275\234\344\270\232 \344\270\211\345\244\247\350\214\203\345\274\217/\347\254\254\344\270\211\346\254\241\344\275\234\344\270\232 \344\270\211\345\244\247\350\214\203\345\274\217.md" deleted file mode 100644 index 338d95c237a747d49d454b16b287aee4f1b3b6f4..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230907 \347\254\254\344\270\211\346\254\241\347\273\204\344\275\234\344\270\232 \344\270\211\345\244\247\350\214\203\345\274\217/\347\254\254\344\270\211\346\254\241\344\275\234\344\270\232 \344\270\211\345\244\247\350\214\203\345\274\217.md" +++ /dev/null @@ -1,137 +0,0 @@ -## 数据库三大范式(规则) - -### 第一范式 - -要求字段内容不可再分割,为保证数据原子性 - -例如地址信息表,一个地址可以拆分为省、市、区、街道和详细地址 - -### 第二范式 - -要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 - -例如成绩表,学生学号和课程编号在成绩表中缺一不可 - -| 学号 | 姓名 | 年龄 | 课程名称 | 成绩 | 学分 | -| ---- | ---- | ---- | -------- | ---- | ---- | -| | | | | | | - -1. 假设学号是表中的唯一主键,那由学号就可以确定姓名和年龄了,但是却不能确定课程名称和成绩 - -2. 假设课程名称是表中的唯一主键,那由课程名称就可以确定学分了,但是却不能确定姓名、年龄和成绩 - -3. 虽然通过学号和课程名称的联合主键,可以确定除联合主键外的所有的非主键值,但是基于上述两个假设,也不符合第二范式的要求 - -所以把表拆分开才会符合第二范式的要求 - -学生表 - 学号做主键 - -课程表 - 课程名称做主键 - -成绩表 - 学号和课程名称做联合主键 - -### 第三范式 - -满足第二范式的前提,要求非主键属性要直接依赖于主键 - -| 学号 | 姓名 | 班级 | 班主任 | -| ---- | ---- | ---- | ------ | -| | | | | - -这个表中,学号是主键,它可以唯一确定姓名、班级、班主任,符合了第二范式,但是在非主键字段中,我们也可以通过班级推导出该班级的班主任,所以它是不符合第三范式的 - -学生表 - -| 学号 | 姓名 | 班级 | -| ---- | ---- | ---- | -| | | | - -班级表 - -| 班级 | 班主任 | -| ---- | ------ | -| | | - -通过把班级与班主任的映射关系另外做成一张映射表,我们就成功地消除了表中的传递依赖了 - -```mysql -create database school charset utf8; - -use school; - -# 院系 -create table department( - de_id int primary key auto_increment, - de_name varchar(10) -); - -# 专业 -create table major( - ma_id int primary key auto_increment, - ma_name varchar(10), - de_id int, - foreign key (de_id) references department(de_id) -); - -# 班级 -create table clazz( - cla_id int primary key auto_increment, - cla_name varchar(10), - ma_id int, - foreign key (ma_id) references major(ma_id) -); - -# 学生 -create table student( - st_id int primary key auto_increment, - st_name varchar(10), - st_sex char(1), - cla_id int, - foreign key (cla_id) references clazz(cla_id) -); - -# 课程 -create table course( - cou_id int primary key auto_increment, - cou_name varchar(10), - t_id int, - foreign key (t_id) references teacher (t_id) -); - -# 学生+课程 -create table performance( - id int primary key auto_increment, - st_id int, - foreign key (st_id) references student(st_id), - cou_id int, - foreign key (cou_id) references course(cou_id), - score int -); - -# 教师 -create table teacher( - t_id int primary key auto_increment, - t_name varchar(10) -); - -# 教室 -create table classroom( - r_id int primary key auto_increment, - r_nsme varchar(10) -); - -# 班级+课程+教室+教室 -create table timetable( - time_id int primary key auto_increment, - time varchar(255), - cla_id int, - foreign key (cla_id) references clazz(cla_id), - cou_id int, - foreign key (cou_id) references course(cou_id), - t_id int, - foreign key (t_id) references teacher (t_id), - r_id int , - foreign key (r_id) references classroom (r_id) -); - -``` diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230908 \347\254\254\345\233\233\346\254\241\344\275\234\344\270\232 \344\275\277\347\224\250PowerDesigner \350\256\276\350\256\241\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237/code.sql" "b/53 \345\221\250\345\216\232\350\276\260/20230908 \347\254\254\345\233\233\346\254\241\344\275\234\344\270\232 \344\275\277\347\224\250PowerDesigner \350\256\276\350\256\241\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237/code.sql" deleted file mode 100644 index f8e0ec9ddeaa3ed782e62e00fa4eb387f49fdcc4..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230908 \347\254\254\345\233\233\346\254\241\344\275\234\344\270\232 \344\275\277\347\224\250PowerDesigner \350\256\276\350\256\241\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237/code.sql" +++ /dev/null @@ -1,222 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/9 22:22:09 */ -/*==============================================================*/ - - -drop table if exists Author; - -drop table if exists Book; - -drop table if exists "Book Copy"; - -drop table if exists Book_Category; - -drop table if exists "Fine Record"; - -drop table if exists "Loan record"; - -drop table if exists Publisher; - -drop table if exists "Reservation Record"; - -drop table if exists Review; - -drop table if exists Staff; - -drop table if exists borrower; - -drop table if exists library; - -/*==============================================================*/ -/* Table: Author */ -/*==============================================================*/ -create table Author -( - "Author ID" int not null auto_increment, - Writterf_Name char(5) not null, - Nationality char(5) not null, - Gender char(1) not null, - Writter_contact_way numeric(11,0) not null, - primary key ("Author ID") -); - -alter table Author comment 'ԡ'; - -/*==============================================================*/ -/* Table: Book */ -/*==============================================================*/ -create table Book -( - ISBN int not null auto_increment, - B_ID numeric(10,0) not null, - Lib_ID int not null, - Copy_ID int not null, - Category_ID int not null, - "Author ID" int not null, - Publisher_ID int not null, - address char(20) not null, - Book_name char(10) not null, - publication_date2 date not null, - primary key (ISBN) -); - -/*==============================================================*/ -/* Table: "Book Copy" */ -/*==============================================================*/ -create table "Book Copy" -( - Copy_ID int not null auto_increment, - Lib_ID int, - status char(2) not null, - primary key (Copy_ID) -); - -/*==============================================================*/ -/* Table: Book_Category */ -/*==============================================================*/ -create table Book_Category -( - Category_ID int not null auto_increment, - "Category Name" char(10) not null, - primary key (Category_ID) -); - -alter table Book_Category comment ' - -'; - -/*==============================================================*/ -/* Table: "Fine Record" */ -/*==============================================================*/ -create table "Fine Record" -( - Fine_ID int not null auto_increment, - B_ID numeric(10,0) not null, - Fine_Amount numeric(10,0) not null, - Fine_Date date not null, - primary key (Fine_ID) -); - -/*==============================================================*/ -/* Table: "Loan record" */ -/*==============================================================*/ -create table "Loan record" -( - Record_ID int not null auto_increment, - loan_date datetime not null, - return_date datetime not null, - primary key (Record_ID) -); - -/*==============================================================*/ -/* Table: Publisher */ -/*==============================================================*/ -create table Publisher -( - Publisher_ID int not null auto_increment, - "Publisher Name" char(10) not null, - Location varchar(20) not null, - primary key (Publisher_ID) -); - -/*==============================================================*/ -/* Table: "Reservation Record" */ -/*==============================================================*/ -create table "Reservation Record" -( - Reservation_ID int not null auto_increment, - B_ID numeric(10,0) not null, - Reservation_Time date not null, - Reservation_Status char(2) not null, - primary key (Reservation_ID) -); - -/*==============================================================*/ -/* Table: Review */ -/*==============================================================*/ -create table Review -( - "Review ID" int not null auto_increment, - ISBN int not null, - B_ID numeric(10,0) not null, - Rating decimal(2,1) not null, - "Review Content" varchar(255) not null, - primary key ("Review ID") -); - -/*==============================================================*/ -/* Table: Staff */ -/*==============================================================*/ -create table Staff -( - "Staff ID" int not null auto_increment, - Lib_ID int not null, - Staff_name char(5) not null, - Position char(5) not null, - primary key ("Staff ID") -); - -/*==============================================================*/ -/* Table: borrower */ -/*==============================================================*/ -create table borrower -( - B_ID numeric(10,0) not null, - Record_ID int not null, - B_Name char(5) not null, - B_Gender char(1) not null, - B_contact_way numeric(11,0) not null, - primary key (B_ID) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - Lib_ID int not null auto_increment, - Lib_name char(10) not null, - Lib_address varchar(50) not null, - primary key (Lib_ID) -); - -alter table Book add constraint FK_Copy foreign key (Copy_ID) - references "Book Copy" (Copy_ID) on delete restrict on update restrict; - -alter table Book add constraint "FK_Publisher-Book" foreign key (Publisher_ID) - references Publisher (Publisher_ID) on delete restrict on update restrict; - -alter table Book add constraint "FK_Writer-book" foreign key ("Author ID") - references Author ("Author ID") on delete restrict on update restrict; - -alter table Book add constraint "FK_book classification" foreign key (Category_ID) - references Book_Category (Category_ID) on delete restrict on update restrict; - -alter table Book add constraint FK_borrowe foreign key (B_ID) - references borrower (B_ID) on delete restrict on update restrict; - -alter table Book add constraint "FK_collect books" foreign key (Lib_ID) - references library (Lib_ID) on delete restrict on update restrict; - -alter table "Book Copy" add constraint FK_Relationship_13 foreign key (Lib_ID) - references library (Lib_ID) on delete restrict on update restrict; - -alter table "Fine Record" add constraint FK_Fine foreign key (B_ID) - references borrower (B_ID) on delete restrict on update restrict; - -alter table "Reservation Record" add constraint "FK_Reservation Record" foreign key (B_ID) - references borrower (B_ID) on delete restrict on update restrict; - -alter table Review add constraint FK_Review foreign key (B_ID) - references borrower (B_ID) on delete restrict on update restrict; - -alter table Review add constraint "FK_Review Book" foreign key (ISBN) - references Book (ISBN) on delete restrict on update restrict; - -alter table Staff add constraint FK_Staff foreign key (Lib_ID) - references library (Lib_ID) on delete restrict on update restrict; - -alter table borrower add constraint FK_Record foreign key (Record_ID) - references "Loan record" (Record_ID) on delete restrict on update restrict; - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230908 \347\254\254\345\233\233\346\254\241\344\275\234\344\270\232 \344\275\277\347\224\250PowerDesigner \350\256\276\350\256\241\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.cdm" "b/53 \345\221\250\345\216\232\350\276\260/20230908 \347\254\254\345\233\233\346\254\241\344\275\234\344\270\232 \344\275\277\347\224\250PowerDesigner \350\256\276\350\256\241\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.cdm" deleted file mode 100644 index 58c053997ca2d38f76af7deb78cb0cdba3dcf32c..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230908 \347\254\254\345\233\233\346\254\241\344\275\234\344\270\232 \344\275\277\347\224\250PowerDesigner \350\256\276\350\256\241\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.cdm" +++ /dev/null @@ -1,4153 +0,0 @@ - - - - - - - -00000000-0000-0000-0000-000000000000 - - -F7C051AF-D0D3-4DFD-96C8-AAC5FBA8779F -图书管理系统 -图书管理系统 -1694249554 -榨菜 -1694261781 -榨菜 -[FolderOptions] - -[FolderOptions\Conceptual Data Objects] -GenerationCheckModel=Yes -GenerationPath= -GenerationOptions= -GenerationTasks= -GenerationTargets= -GenerationSelections= - -[FolderOptions\CheckModel] - -[FolderOptions\CheckModel\Package] - -[FolderOptions\CheckModel\Package\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\GenrCircularityYes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\GenrCircularityNo] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\ShortcutUniqCode] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Package\ChildShortcut] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain] - -[FolderOptions\CheckModel\Domain\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckOtherDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item] - -[FolderOptions\CheckModel\Data Item\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\InfoNotUsed] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\InfoUsedSevTime] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\InfoDiffDomn] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\CheckOtherDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity] - -[FolderOptions\CheckModel\Entity\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\MaxLen - NAME] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttNoAttrNo] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttNbSerials] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttNoAttrYes] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EmptyCollYesYes] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttSamePrnt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttMultInhr] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttSevInhr] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\PidtfInhrAtt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute] - -[FolderOptions\CheckModel\Entity.Entity Attribute\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier] - -[FolderOptions\CheckModel\Entity.Identifier\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\EmptyColl - PENTCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckIncludeColl - Entt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\IdtfChildPIdtf] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship] - -[FolderOptions\CheckModel\Relationship\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshReflexiveDeptYes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshReflexiveDeptNo] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshBject] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshMnyMny] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshDepdChild] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association] - -[FolderOptions\CheckModel\Association\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscNbLink] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscNbIdLink1] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscNbIdLink2] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscIdPass] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscBject] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscMaxCard] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscReflex] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscMnyMny] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance] - -[FolderOptions\CheckModel\Inheritance\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\EmptyColl - CHILDCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Replication] - -[FolderOptions\CheckModel\Replication\PartialReplication] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule] - -[FolderOptions\CheckModel\Business Rule\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\EmptyColl - OBJCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object] - -[FolderOptions\CheckModel\Extended Object\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link] - -[FolderOptions\CheckModel\Extended Link\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File] - -[FolderOptions\CheckModel\File\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckPathExists] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format] - -[FolderOptions\CheckModel\Data Format\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckDataFormatNullExpression] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Architecture Area] - -[FolderOptions\CheckModel\Architecture Area\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Architecture Area\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Architecture Area\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Architecture Area\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Architecture Area\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Architecture Area\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Architecture Area\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes -[ModelOptions] - -[ModelOptions\Conceptual options] -CaseSensitive=No -DisplayName=Yes -EnableTrans=No -UseTerm=No -EnableRequirements=No -EnableFullShortcut=Yes -SynchroCode=Yes -InfoUnique=Yes -AllowReuse=Yes -InfoAllowReuse=Yes -Notation=2 -RlshUnique=Yes -DefaultDttp= -DomnCopyDttp=Yes -DomnCopyChck=No -DomnCopyRule=No -DomnCopyExat=No -DomnCopyMand=No -DttpFullName=Yes -RlshAsstTmpl=Each %Entity1.Name%[CRLF].if %Entity1ToEntity2RoleMandatory%[CRLF] must[CRLF].else[CRLF] may[CRLF].endif[CRLF].if %Entity1ToEntity2Role%[CRLF] %.L:Entity1ToEntity2Role%[CRLF].else[CRLF] have[CRLF].endif[CRLF].if %Entity1ToEntity2RoleMaximumCardinality%==1[CRLF].if %Entity1ToEntity2RoleMandatory%[CRLF] one and only one[CRLF].else[CRLF] at most one[CRLF].endif[CRLF].else[CRLF] one or more[CRLF].endif[CRLF].if %Entity1%==%Entity2%[CRLF] other[CRLF].endif[CRLF] %Entity2.Name%.[CRLF]Each %Entity2.Name%[CRLF].if %Entity2ToEntity1RoleMandatory%[CRLF] must[CRLF].else[CRLF] may[CRLF].endif[CRLF].if %Entity2ToEntity1Role%[CRLF] %.L:Entity2ToEntity1Role%[CRLF].else[CRLF] have[CRLF].endif[CRLF].if %Entity2ToEntity1RoleMaximumCardinality%==1[CRLF].if %Entity2ToEntity1RoleMandatory%[CRLF] one and only one[CRLF].else[CRLF] at most one[CRLF].endif[CRLF].else[CRLF] one or more[CRLF].endif[CRLF].if %Entity1%==%Entity2%[CRLF] other[CRLF].endif[CRLF] %Entity1.Name%. -RlshAsstExt= - -[ModelOptions\Conceptual options\NamingOptionsTemplates] - -[ModelOptions\Conceptual options\ClssNamingOptions] - -[ModelOptions\Conceptual options\ClssNamingOptions\FILO] - -[ModelOptions\Conceptual options\ClssNamingOptions\FILO\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\FILO\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\FRMEOBJ] - -[ModelOptions\Conceptual options\ClssNamingOptions\FRMEOBJ\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\FRMEOBJ\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\FRMELNK] - -[ModelOptions\Conceptual options\ClssNamingOptions\FRMELNK\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\FRMELNK\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\AREA] - -[ModelOptions\Conceptual options\ClssNamingOptions\AREA\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\AREA\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\DefaultClass] - -[ModelOptions\Conceptual options\ClssNamingOptions\DefaultClass\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\DefaultClass\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMPCKG] - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMPCKG\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMPCKG\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMDOMN] - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMDOMN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMDOMN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\INFO] - -[ModelOptions\Conceptual options\ClssNamingOptions\INFO\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\INFO\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\ENTT] - -[ModelOptions\Conceptual options\ClssNamingOptions\ENTT\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\ENTT\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\IDTF] - -[ModelOptions\Conceptual options\ClssNamingOptions\IDTF\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\IDTF\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\RLSH] - -[ModelOptions\Conceptual options\ClssNamingOptions\RLSH\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\RLSH\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\ASSC] - -[ModelOptions\Conceptual options\ClssNamingOptions\ASSC\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\ASSC\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMINHR] - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMINHR\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMINHR\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Generate] - -[ModelOptions\Generate\Pdm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No -BuildTrgr=No -TablePrefix= -IndxPKName=%TABLE%_PK -IndxAKName=%TABLE%_AK -IndxFKName=%REFR%_FK -IndxThreshold= -ClassPrefix= -ColnFKName=%.3:PARENT%_%COLUMN% -ColnFKNameUse=No - -[ModelOptions\Generate\Oom] -CheckModel=Yes -SaveLinks=Yes -NameToCode=Yes - -[ModelOptions\Generate\Ldm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No -PreserveMode=Yes -D:\小米云盘\桌面\图书管理系统.cdm - - -9F9F0CB5-76D2-434D-BA03-EE5D05CB6F17 -图书管理系统 -图书管理系统 -1694249555 -榨菜 -1694261534 -榨菜 -[DisplayPreferences] - -[DisplayPreferences\CDM] - -[DisplayPreferences\General] -Adjust to text=Yes -Snap Grid=Yes -Constrain Labels=Yes -Display Grid=No -Show Page Delimiter=Yes -Show Links intersections=Yes -Activate automatic link routing=Yes -Grid size=2250 -Graphic unit=2 -Window color=192 192 192 -Background image= -Background mode=8 -Watermark image= -Watermark mode=8 -Show watermark on screen=No -Gradient mode=0 -Gradient end color=255 255 255 -Show Swimlane=No -SwimlaneVert=Yes -TreeVert=No -CompDark=0 - -[DisplayPreferences\Object] -Show Icon=No -Mode=0 -Trunc Length=999 -Word Length=80 -Word Text=!""#$%&'()*+,-./:;<=>?@[\]^_`{|}~ -Shortcut IntIcon=Yes -Shortcut IntLoct=Yes -Shortcut IntFullPath=No -Shortcut IntLastPackage=Yes -Shortcut ExtIcon=Yes -Shortcut ExtLoct=No -Shortcut ExtFullPath=No -Shortcut ExtLastPackage=Yes -Shortcut ExtIncludeModl=Yes -Area.IconPicture=Yes -Area.Stereotype=Yes -Area.Comment=No -Area.TextStyle=No -Area.SubSymbols=Yes -Area_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Architecture Area Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -EObjShowStrn=Yes -ExtendedObject.Comment=No -ExtendedObject.IconPicture=No -ExtendedObject.TextStyle=No -ExtendedObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Object Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -ELnkShowStrn=Yes -ELnkShowName=Yes -ExtendedLink_SymbolLayout=<Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Source" >[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -ExtDpdShowStrn=Yes -ExtendedDependency_SymbolLayout=<Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Source" >[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -FileObject.Stereotype=No -FileObject.DisplayName=Yes -FileObject.LocationOrName=No -FileObject.IconPicture=No -FileObject.TextStyle=No -FileObject.IconMode=Yes -FileObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Location" Attribute="LocationOrName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Package.Stereotype=Yes -Package.Comment=No -Package.IconPicture=No -Package.TextStyle=No -Package_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Display Model Version=Yes -Entity.Stereotype=Yes -Entity.Attributes=Yes -Entity.Attributes._Filter="All attributes" CDMPENTALL -Entity.Attributes._Columns=Stereotype IdentifierIndicator DomainOrDataType NullIndicator -Entity.Attributes._Limit=-5 -Entity.Identifiers=Yes -Entity.Identifiers._Columns=Stereotype IdentifierIndicator -Entity.Comment=No -Entity.IconPicture=No -Entity.TextStyle=No -Entity_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" Filters="&quot;All attributes&quot; CDMPENTALL &quot;&quot;\r\n&quot;Primary attributes&quot; CDMPENTPK &quot;\&quot;PIDTF \&quot;TRUE\&quot; TRUE\&quot;&quot;\r\n&quot;Identifying attributes&quot; CDMPENTIDTF &quot;\&quot;AIDF \&quot;TRUE\&quot; TRUE\&quot;&quot;" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Identifiers" Collection="Identifiers" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Relationship.Entity1ToEntity2Role=Yes -Relationship.Entity2ToEntity1RoleCardinality=No -Relationship.Entity1ToEntity2RoleDominant=Yes -Relationship.Stereotype=Yes -Relationship.DisplayName=Yes -Relationship.Entity2ToEntity1Role=Yes -Relationship.Entity1ToEntity2RoleCardinality=No -Relationship.Entity2ToEntity1RoleDominant=Yes -Relationship_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity1ToEntity2Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity2ToEntity1RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity1ToEntity2RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity2ToEntity1Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity1ToEntity2RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity2ToEntity1RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -Association.Stereotype=Yes -Association.Comment=No -Association.Attributes=Yes -Association.Attributes._Columns=Stereotype DomainOrDataType NullIndicator -Association.Attributes._Limit=-5 -Association.IconPicture=No -Association.TextStyle=No -Association_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -AssociationLink.SymbolCardinality=Yes -AssociationLink.Stereotype=Yes -AssociationLink.Role=Yes -AssociationLink_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Cardinality" Attribute="SymbolCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Role" Attribute="Role" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -Inheritance.Stereotype=Yes -Inheritance.DisplayName=Yes -Inheritance.IconPicture=No -Inheritance.TextStyle=No -Inheritance_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Entity.SubSymbols=Yes - -[DisplayPreferences\Symbol] - -[DisplayPreferences\Symbol\AREA] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=749925 -Height=749925 -Brush color=253 249 234 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=16 -Brush gradient color=245 230 173 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 121 98 6 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FRMEOBJ] -STRNFont=Arial,8,N -STRNFont color=0 0 0 -DISPNAMEFont=Arial,8,N -DISPNAMEFont color=0 0 0 -LABLFont=Arial,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=749925 -Height=749925 -Brush color=255 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=64 -Brush gradient color=192 192 192 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 255 128 128 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FRMELNK] -CENTERFont=Arial,8,N -CENTERFont color=0 0 0 -Line style=2 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 -Source Arrow=24 -Center Arrow=24 -Target Arrow=0 - -[DisplayPreferences\Symbol\USRDEPD] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=2 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=2 0 128 0 64 -Shadow color=192 192 192 -Shadow=0 -Source Arrow=24 -Center Arrow=24 -Target Arrow=0 - -[DisplayPreferences\Symbol\FILO] -OBJSTRNFont=新宋体,8,N -OBJSTRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LCNMFont=新宋体,8,N -LCNMFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=Yes -Keep center=Yes -Keep size=No -Width=749925 -Height=749925 -Brush color=255 255 255 -Fill Color=No -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=-1 - -[DisplayPreferences\Symbol\CDMPCKG] -STRNFont=Arial,8,N -STRNFont color=0 0 0 -DISPNAMEFont=Arial,8,N -DISPNAMEFont color=0 0 0 -LABLFont=Arial,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=749925 -Height=749925 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ENTT] -STRNFont=Arial,8,N -STRNFont color=0 0 0 -DISPNAMEFont=Arial,8,N -DISPNAMEFont color=0 0 0 -AttributesFont=Arial,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=Arial,8,U -EntityPrimaryAttributeFont color=0 0 0 -IdentifiersFont=Arial,8,N -IdentifiersFont color=0 0 0 -LABLFont=Arial,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=749925 -Height=749925 -Brush color=233 202 131 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 64 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\RLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0 0 0 -Line style=2 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 0 64 -Shadow color=192 192 192 -Shadow=0 -Source Arrow=24 -Center Arrow=24 -Target Arrow=0 - -[DisplayPreferences\Symbol\ASSC] -STRNFont=Arial,8,N -STRNFont color=0 0 0 -DISPNAMEFont=Arial,8,N -DISPNAMEFont color=0 0 0 -LABLFont=Arial,8,N -LABLFont color=0 0 0 -AttributesFont=Arial,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=749925 -Height=749925 -Brush color=208 208 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINK] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=2 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 -Source Arrow=24 -Center Arrow=24 -Target Arrow=0 - -[DisplayPreferences\Symbol\CDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=Arial,8,N -DISPNAMEFont color=0 0 0 -AutoAdjustToText=No -Keep aspect=No -Keep center=No -Keep size=Yes -Width=749925 -Height=749925 -Brush color=233 202 131 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 0 0 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINH] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=2 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 0 0 -Shadow color=192 192 192 -Shadow=0 -Source Arrow=24 -Center Arrow=24 -Target Arrow=0 - -[DisplayPreferences\Symbol\Free Symbol] -Free TextFont=Arial,8,N -Free TextFont color=0 0 0 -Line style=2 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 0 0 -Shadow color=192 192 192 -Shadow=0 -Source Arrow=24 -Center Arrow=24 -Target Arrow=0 -(8268, 11693) -((315,354), (433,354)) -1 -15 - - -1694251047 -1694257891 -5151 -((-56734,13086), (-14813,15486)) -((-15213,14286),(-56334,14286)) -2 -4628 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N -3 - - - - - - - - - - - -1694251294 -1694261546 -(-181, 1100) -((-73525,13615), (-64287,16811)) -((-73125,14815),(-65687,14815)) -2 -4628 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694252531 -1694257910 -((-14582,14415), (-12182,26274)) -((-13382,25874),(-13382,14815)) -2 -4628 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N -2 - - - - - - - - - - - -1694253725 -1694258001 -((-59012,17915), (-56612,26274)) -((-57812,25874),(-57812,19315)) -2 -4628 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694254256 -1694257825 -((-73937,-7524), (-63549,18679)) -((-73125,-7124),(-73125,4349),(-64749,4349),(-64749,18279)) -2 -4628 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N -3 - - - - - - - - - - - -1694254417 -1694261546 -((-101650,18115), (-81163,20515)) -((-81563,19315),(-101250,19315)) -2 -4628 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N -1 - - - - - - - - - - - -1694254724 -1694257891 -((-17405,-7522), (-14031,11398)) -((-15718,10998),(-15718,-7122)) -2 -4628 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N -4 - - - - - - - - - - - -1694254898 -1694257891 -((-9714,-6025), (-7314,11611)) -((-8514,-5625),(-8514,11211)) -2 -5138 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N -3 - - - - - - - - - - - -1694255240 -1694257936 -(-58, 583) -((-53975,9915), (-37473,27666)) -((-53163,10315),(-53163,22874),(-38673,22874),(-38673,27266)) -2 -4628 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N -3 - - - - - - - - - - - -1694255244 -1694257936 -(5324, 449) -((-37340,17488), (-14646,27274)) -((-15458,17888),(-15458,22874),(-36140,22874),(-36140,25874)) -2 -4628 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N -3 - - - - - - - - - - - -1694256047 -1694258001 -((-59429,-6732), (-54555,11715)) -((-56992,-6332),(-56992,10315)) -2 -4628 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N -1 - - - - - - - - - - - -1694256279 -1694257825 -(-353, -352) -((-54047,-6025), (-40813,16353)) -((-41625,-5625),(-41625,4349),(-52847,4349),(-52847,15953)) -2 -4628 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N -4 - - - - - - - - - - - -1694261534 -1694261546 -((-84000,18915), (-63850,31574)) -((-81000,19315),(-81000,30374),(-65250,30374)) -2 -4371 -4194432 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694249587 -1694257825 --1 -((-65687,10315), (-49937,19315)) -0 -4227200 -4259584 -12632256 -STRN 0 Arial,8,N -DISPNAME 0 Arial,8,N -Attributes 0 Arial,8,N -EntityPrimaryAttribute 0 Arial,8,U -Identifiers 0 Arial,8,N -LABL 0 Arial,8,N -6 -65 -16777215 -1 - - - - - -1694249588 -1694257891 --1 -((-19125,10315), (-3375,19315)) -0 -4227200 -16711935 -12632256 -STRN 0 Arial,8,N -DISPNAME 0 Arial,8,N -Attributes 0 Arial,8,N -EntityPrimaryAttribute 0 Arial,8,U -Identifiers 0 Arial,8,N -LABL 0 Arial,8,N -6 -65 -16777215 -1 - - - - - -1694251138 -1694261546 --1 -((-88875,10315), (-73125,19315)) -0 -4227200 -255 -12632256 -STRN 0 Arial,8,N -DISPNAME 0 Arial,8,N -Attributes 0 Arial,8,N -EntityPrimaryAttribute 0 Arial,8,U -Identifiers 0 Arial,8,N -LABL 0 Arial,8,N -6 -65 -16777215 -1 - - - - - -1694252233 -1694257910 --1 -((-20250,25874), (-4500,34874)) -0 -4227200 -16744703 -12632256 -STRN 0 Arial,8,N -DISPNAME 0 Arial,8,N -Attributes 0 Arial,8,N -EntityPrimaryAttribute 0 Arial,8,U -Identifiers 0 Arial,8,N -LABL 0 Arial,8,N -6 -65 -16777215 -1 - - - - - -1694253231 -1694258001 --1 -((-65250,25874), (-49500,34874)) -0 -4227200 -4227327 -12632256 -STRN 0 Arial,8,N -DISPNAME 0 Arial,8,N -Attributes 0 Arial,8,N -EntityPrimaryAttribute 0 Arial,8,U -Identifiers 0 Arial,8,N -LABL 0 Arial,8,N -6 -65 -16777215 -1 - - - - - -1694254088 -1694257876 --1 -((-81000,-10125), (-65250,-1125)) -0 -4227200 -33023 -12632256 -STRN 0 Arial,8,N -DISPNAME 0 Arial,8,N -Attributes 0 Arial,8,N -EntityPrimaryAttribute 0 Arial,8,U -Identifiers 0 Arial,8,N -LABL 0 Arial,8,N -6 -65 -16777215 -1 - - - - - -1694254311 -1694261546 --1 -((-109125,10315), (-93375,19315)) -0 -4227200 -8421631 -12632256 -STRN 0 Arial,8,N -DISPNAME 0 Arial,8,N -Attributes 0 Arial,8,N -EntityPrimaryAttribute 0 Arial,8,U -Identifiers 0 Arial,8,N -LABL 0 Arial,8,N -6 -65 -16777215 -1 - - - - - -1694254530 -1694257944 --1 -((-28125,-10125), (-12375,-1125)) -0 -4227200 -16744703 -12632256 -STRN 0 Arial,8,N -DISPNAME 0 Arial,8,N -Attributes 0 Arial,8,N -EntityPrimaryAttribute 0 Arial,8,U -Identifiers 0 Arial,8,N -LABL 0 Arial,8,N -6 -66 -16777215 -1 - - - - - -1694254770 -1694257950 --1 -((-12375,-10125), (3375,-1125)) -0 -4227200 -16744703 -12632256 -STRN 0 Arial,8,N -DISPNAME 0 Arial,8,N -Attributes 0 Arial,8,N -EntityPrimaryAttribute 0 Arial,8,U -Identifiers 0 Arial,8,N -LABL 0 Arial,8,N -6 -130 -16777215 -1 - - - - - -1694255081 -1694257936 --1 -((-45000,25874), (-29250,34874)) -0 -4227200 -16776960 -12632256 -STRN 0 Arial,8,N -DISPNAME 0 Arial,8,N -Attributes 0 Arial,8,N -EntityPrimaryAttribute 0 Arial,8,U -Identifiers 0 Arial,8,N -LABL 0 Arial,8,N -6 -65 -16777215 -1 - - - - - -1694255899 -1694258001 --1 -((-65250,-10125), (-49500,-1125)) -0 -4227200 -33023 -12632256 -STRN 0 Arial,8,N -DISPNAME 0 Arial,8,N -Attributes 0 Arial,8,N -EntityPrimaryAttribute 0 Arial,8,U -Identifiers 0 Arial,8,N -LABL 0 Arial,8,N -6 -65 -16777215 -1 - - - - - -1694256188 -1694257876 --1 -((-49500,-10125), (-33750,-1125)) -0 -4227200 -33023 -12632256 -STRN 0 Arial,8,N -DISPNAME 0 Arial,8,N -Attributes 0 Arial,8,N -EntityPrimaryAttribute 0 Arial,8,U -Identifiers 0 Arial,8,N -LABL 0 Arial,8,N -6 -65 -16777215 -1 - - - - - - - - - -1CF19B1A-EEB8-4A87-AC2B-84F0710DA65E -Package_1 -Package_1 -1694250275 -榨菜 -1694250275 -榨菜 - - -463BEEF3-275D-495A-9B9F-0A16A6E59D12 -Diagram_1 -Diagram_1 -1694250275 -榨菜 -1694250275 -榨菜 -[DisplayPreferences] - -[DisplayPreferences\CDM] - -[DisplayPreferences\General] -Adjust to text=Yes -Snap Grid=No -Constrain Labels=Yes -Display Grid=No -Show Page Delimiter=Yes -Show Links intersections=Yes -Activate automatic link routing=Yes -Grid size=0 -Graphic unit=2 -Window color=255, 255, 255 -Background image= -Background mode=8 -Watermark image= -Watermark mode=8 -Show watermark on screen=No -Gradient mode=0 -Gradient end color=255, 255, 255 -Show Swimlane=No -SwimlaneVert=Yes -TreeVert=No -CompDark=0 - -[DisplayPreferences\Object] -Show Icon=No -Mode=0 -Trunc Length=80 -Word Length=80 -Word Text=!""#$%&'()*+,-./:;<=>?@[\]^_`{|}~ -Shortcut IntIcon=Yes -Shortcut IntLoct=Yes -Shortcut IntFullPath=No -Shortcut IntLastPackage=Yes -Shortcut ExtIcon=Yes -Shortcut ExtLoct=No -Shortcut ExtFullPath=No -Shortcut ExtLastPackage=Yes -Shortcut ExtIncludeModl=Yes -Area.IconPicture=Yes -Area.Stereotype=Yes -Area.Comment=No -Area.TextStyle=No -Area.SubSymbols=Yes -Area_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Architecture Area Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -EObjShowStrn=Yes -ExtendedObject.Comment=No -ExtendedObject.IconPicture=No -ExtendedObject.TextStyle=No -ExtendedObject_SymbolLayout= -ELnkShowStrn=Yes -ELnkShowName=Yes -ExtendedLink_SymbolLayout= -ExtDpdShowStrn=Yes -ExtendedDependency_SymbolLayout=<Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Source" >[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -FileObject.Stereotype=No -FileObject.DisplayName=Yes -FileObject.LocationOrName=No -FileObject.IconPicture=No -FileObject.TextStyle=No -FileObject.IconMode=Yes -FileObject_SymbolLayout= -Package.Stereotype=Yes -Package.Comment=No -Package.IconPicture=No -Package.TextStyle=No -Package_SymbolLayout= -Display Model Version=Yes -Entity.Stereotype=Yes -Entity.Attributes=Yes -Entity.Attributes._Filter="All attributes" CDMPENTALL -Entity.Attributes._Columns=Stereotype DomainOrDataType IdentifierIndicator NullIndicator -Entity.Attributes._Limit=-5 -Entity.Identifiers=Yes -Entity.Identifiers._Columns=Stereotype IdentifierIndicator -Entity.Comment=No -Entity.IconPicture=No -Entity.TextStyle=No -Entity.SubSymbols=Yes -Entity_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" Filters="&quot;All attributes&quot; CDMPENTALL &quot;&quot;\r\n&quot;Primary attributes&quot; CDMPENTPK &quot;\&quot;PIDTF \&quot;TRUE\&quot; TRUE\&quot;&quot;\r\n&quot;Identifying attributes&quot; CDMPENTIDTF &quot;\&quot;AIDF \&quot;TRUE\&quot; TRUE\&quot;&quot;" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Identifiers" Collection="Identifiers" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Relationship.Entity1ToEntity2Role=Yes -Relationship.Entity2ToEntity1RoleCardinality=No -Relationship.Entity1ToEntity2RoleDominant=Yes -Relationship.Stereotype=Yes -Relationship.DisplayName=Yes -Relationship.Entity2ToEntity1Role=Yes -Relationship.Entity1ToEntity2RoleCardinality=No -Relationship.Entity2ToEntity1RoleDominant=Yes -Relationship_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity1ToEntity2Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity2ToEntity1RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity1ToEntity2RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity2ToEntity1Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity1ToEntity2RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity2ToEntity1RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -Association.Stereotype=Yes -Association.Comment=No -Association.Attributes=Yes -Association.Attributes._Columns=Stereotype DomainOrDataType NullIndicator -Association.Attributes._Limit=-5 -Association.IconPicture=No -Association.TextStyle=No -Association_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -AssociationLink.SymbolCardinality=Yes -AssociationLink.Stereotype=Yes -AssociationLink.Role=Yes -AssociationLink_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Cardinality" Attribute="SymbolCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Role" Attribute="Role" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -Inheritance.Stereotype=Yes -Inheritance.DisplayName=Yes -Inheritance.IconPicture=No -Inheritance.TextStyle=No -Inheritance_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> - -[DisplayPreferences\Symbol] - -[DisplayPreferences\Symbol\AREA] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=9600 -Height=8000 -Brush color=253 249 234 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=16 -Brush gradient color=245 230 173 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 121 98 6 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FRMEOBJ] -STRNFont=Arial,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=Arial,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=Arial,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=6000 -Height=2000 -Brush color=255 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=64 -Brush gradient color=192 192 192 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 255 128 128 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FRMELNK] -CENTERFont=Arial,8,N -CENTERFont color=0, 0, 0 -Line style=2 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\USRDEPD] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=2 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=2 0 128 0 64 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FILO] -OBJSTRNFont=新宋体,8,N -OBJSTRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LCNMFont=新宋体,8,N -LCNMFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=Yes -Keep center=Yes -Keep size=No -Width=2400 -Height=2400 -Brush color=255 255 255 -Fill Color=No -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=-1 - -[DisplayPreferences\Symbol\CDMPCKG] -STRNFont=Arial,8,N -STRNFont color=0 0 0 -DISPNAMEFont=Arial,8,N -DISPNAMEFont color=0 0 0 -LABLFont=Arial,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3600 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ENTT] -STRNFont=Arial,8,N -STRNFont color=0 0 0 -DISPNAMEFont=Arial,8,N -DISPNAMEFont color=0 0 0 -AttributesFont=Arial,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=Arial,8,U -EntityPrimaryAttributeFont color=0 0 0 -IdentifiersFont=Arial,8,N -IdentifiersFont color=0 0 0 -LABLFont=Arial,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=233 202 131 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 64 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\RLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0 0 0 -Line style=2 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 0 64 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ASSC] -STRNFont=Arial,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=Arial,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=Arial,8,N -LABLFont color=0, 0, 0 -AttributesFont=Arial,8,N -AttributesFont color=0, 0, 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3000 -Brush color=208 208 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINK] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=2 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=Arial,8,N -DISPNAMEFont color=0 0 0 -AutoAdjustToText=No -Keep aspect=No -Keep center=No -Keep size=Yes -Width=1575 -Height=1000 -Brush color=233 202 131 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 0 0 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINH] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=2 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 0 0 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\Free Symbol] -Free TextFont=Arial,8,N -Free TextFont color=0 0 0 -Line style=2 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 0 0 -Shadow color=192 192 192 -Shadow=0 -(8268, 11693) -((315,354), (433,354)) -1 -15 - - - - - - - - - - - - -247E013E-90DA-455B-9495-6837F3B9CAB2 -图书 -Book -1694249587 -榨菜 -1694256310 -榨菜 - - -20E1DA04-42A8-4AED-BF47-28EBC1C58222 -Identifier_1 -Identifier_1 -1694250477 -榨菜 -1694250630 -榨菜 - - - - - - - - - - -2E2315A4-9F4C-48CE-9B7B-E024E0A50A34 -1694250418 -榨菜 -1694250630 -榨菜 -1 - - - - - -E1167AA8-4516-4CF8-B2AF-10C9E2C8C21E -1694250418 -榨菜 -1694250630 -榨菜 -1 - - - - - -FF89A491-9CA1-437B-A47A-1C67E459ED24 -1694250477 -榨菜 -1694250630 -榨菜 -1 - - - - - -6107656A-B520-454A-9CD0-A713D8D67ED1 -1694250632 -榨菜 -1694250689 -榨菜 -1 - - - - - - - -2AB2C4B3-662C-49DB-A406-05DA41E798DB -借阅者 -borrower -1694249588 -榨菜 -1694261616 -榨菜 - - -43017238-AAAD-4295-9007-27223DFE0202 -Identifier_1 -Identifier_1 -1694250932 -榨菜 -1694250935 -榨菜 - - - - - - - - - - -A68736FF-9778-444F-877D-F7EB0AAEDC04 -1694250738 -榨菜 -1694250935 -榨菜 -1 - - - - - -A6F2A0B2-BDCF-44C9-8805-E6D5D127F08D -1694250738 -榨菜 -1694250873 -榨菜 -1 - - - - - -AD7DE2CF-F096-4D84-967F-A63A1757F808 -1694250738 -榨菜 -1694250873 -榨菜 -1 - - - - - -A2D2A9D6-DD21-40A8-8236-6402285030FC -1694250738 -榨菜 -1694250873 -榨菜 -1 - - - - - - - -1DE74175-021E-4806-B7A7-6E4B03ABB3DB -图书馆 -library -1694251138 -榨菜 -1694261781 -榨菜 - - -5675F4F3-C5F2-45A3-97B8-1D92F013BF7C -Identifier_1 -Identifier_1 -1694251138 -榨菜 -1694251139 -榨菜 - - - - - - - - - - -FF7F6743-6992-4D49-9CC7-AA029A4E35F8 -1694251138 -榨菜 -1694251139 -榨菜 -1 - - - - - -8F52DCFD-F1A0-4A38-B3B0-B6A26308495E -1694261713 -榨菜 -1694261732 -榨菜 -1 - - - - - -9B89F529-6ECF-4D45-8E5E-6267EB955C7F -1694261761 -榨菜 -1694261781 -榨菜 -1 - - - - - - - -50256A6E-DEE9-40C0-AF7B-7E57705DFF22 -借阅记录 -Loan record -1694252233 -榨菜 -1694255510 -榨菜 - - -C38A25DF-8950-4685-8BA6-30823A4B0FDC -Identifier_1 -Identifier_1 -1694252316 -榨菜 -1694252523 -榨菜 - - - - - - - - - - -0080F8FB-61AD-4C3F-9B5E-C660754CB617 -1694252316 -榨菜 -1694252523 -榨菜 -1 - - - - - -13351D4C-09A6-47B0-8F93-1FE3855C5FD7 -1694252316 -榨菜 -1694252523 -榨菜 -1 - - - - - -9B4159B9-8D79-465D-B73F-808E9EB4D0B4 -1694252316 -榨菜 -1694252523 -榨菜 -1 - - - - - - - -DD5C531C-4AE8-4052-BDF5-A58AE9AF3764 -图书副本 -Book Copy -1694253231 -榨菜 -1694261554 -榨菜 - - -718D76DE-A74A-48B5-9BDB-85098CB367C7 -Identifier_1 -Identifier_1 -1694253245 -榨菜 -1694253499 -榨菜 - - - - - - - - - - -85AC54DB-25D5-4B45-8972-A8A99811DA79 -1694253245 -榨菜 -1694253499 -榨菜 -1 - - - - - -CF5E1133-0639-4C3E-A065-B8C10B1CFD4A -1694253245 -榨菜 -1694253499 -榨菜 -1 - - - - - - - -AA42D07E-A784-43D6-A7F3-AAE176DBB5BC -图书分类 -Book_Category -1694254088 -榨菜 -1694255616 -榨菜 - - - - - -FE91395A-9E78-46B2-BB2B-6128856AED67 -Identifier_1 -Identifier_1 -1694254089 -榨菜 -1694254249 -榨菜 - - - - - - - - - - -1F16E908-F5CD-4B8A-93E8-C1DB69B04FE3 -1694254089 -榨菜 -1694254249 -榨菜 -1 - - - - - -CD53A029-3FAE-4E05-A7F6-3AB330682CC4 -1694254089 -榨菜 -1694254249 -榨菜 -1 - - - - - - - -E8E3D8A0-8702-4120-99D3-0D88665A7F48 -员工 -Staff -1694254311 -榨菜 -1694261480 -榨菜 - - -6533C5AF-3548-415E-AC87-3C8DB4474332 -Identifier_1 -Identifier_1 -1694254312 -榨菜 -1694254401 -榨菜 - - - - - - - - - - -D299DB33-DFEB-4ECB-8EED-31B17D365DE2 -1694254312 -榨菜 -1694254401 -榨菜 -1 - - - - - -8BA319A7-2473-4CC1-AAD6-AE97E7269B1B -1694261398 -榨菜 -1694261480 -榨菜 -1 - - - - - -E321654F-8E32-48B2-BA59-2D55B22DA8DA -1694254312 -榨菜 -1694254401 -榨菜 -1 - - - - - - - -3BBF9047-A9A8-469E-9C2F-ED02635732D4 -预约记录 -Reservation Record -1694254530 -榨菜 -1694255319 -榨菜 - - -22925BA6-A919-45B6-8E60-B72D10BC6AE0 -Identifier_1 -Identifier_1 -1694254596 -榨菜 -1694254696 -榨菜 - - - - - - - - - - -94FC084A-C395-4F2E-8692-E8DA03AA5F7E -1694254596 -榨菜 -1694254696 -榨菜 -1 - - - - - -38A883B8-87D6-4FDB-AD6D-9E7B2AF7A59C -1694254596 -榨菜 -1694254744 -榨菜 -1 - - - - - -2206F806-6EF2-4DDE-B681-E363A6BC633C -1694254596 -榨菜 -1694254744 -榨菜 -1 - - - - - - - -6D5F4AB1-93F7-4AF8-AA72-4C8D1813EF7F -罚款记录 -Fine Record -1694254770 -榨菜 -1694254979 -榨菜 - - -400E7AAA-E02E-4881-B8DF-BF346876833F -Identifier_1 -Identifier_1 -1694254774 -榨菜 -1694254877 -榨菜 - - - - - - - - - - -D1A4B87C-992F-4EDA-9E4A-29D52DE10574 -1694254774 -榨菜 -1694254877 -榨菜 -1 - - - - - -C8FA89C7-7F65-48E6-A61A-FC1F71415163 -1694254774 -榨菜 -1694254877 -榨菜 -1 - - - - - -40EEFC26-8C54-4FFB-8570-96AC822F426D -1694254774 -榨菜 -1694254877 -榨菜 -1 - - - - - - - -ABDAE672-D187-4370-BE00-C9DFE30817AE -评价 -Review -1694255081 -榨菜 -1694255367 -榨菜 - - -B846F63F-D31D-48A2-804C-6AF3F5666176 -Identifier_1 -Identifier_1 -1694255082 -榨菜 -1694255190 -榨菜 - - - - - - - - - - -FB2E14AA-E1E4-40F6-AEA6-5D5043BC07FC -1694255082 -榨菜 -1694255190 -榨菜 -1 - - - - - -98062C8F-D7B8-4B2E-A42F-67E887709D4D -1694255082 -榨菜 -1694255190 -榨菜 -1 - - - - - -E8604987-C3D6-47D4-8439-CE53745B2180 -1694255082 -榨菜 -1694255190 -榨菜 -1 - - - - - - - -68F67509-F7BF-403F-8061-359D09E25C57 -作者 -Author -1694255899 -榨菜 -1694261756 -榨菜 -():)、)、属性。 - - -F0E88E59-CFF5-4E43-9F9B-E72BF4566667 -Identifier_1 -Identifier_1 -1694255900 -榨菜 -1694256029 -榨菜 - - - - - - - - - - -CEEE527A-00E7-4428-86CD-D7C28E4E3CD4 -1694255900 -榨菜 -1694256029 -榨菜 -1 - - - - - -641FC226-1328-42C8-A1C1-08786AD9E2B6 -1694255900 -榨菜 -1694256029 -榨菜 -1 - - - - - -3DADCB14-685F-4F17-9DB3-954EEBD86FA4 -1694255900 -榨菜 -1694256029 -榨菜 -1 - - - - - -1A028109-063B-48F5-A43B-292C3210953C -1694255900 -榨菜 -1694256029 -榨菜 -1 - - - - - -92E78439-23C8-44CF-8747-62876C0E0CC6 -1694261735 -榨菜 -1694261756 -榨菜 -1 - - - - - - - -90236EF1-15AF-4425-988A-3FADDDC5FA78 -出版社 -Publisher -1694256188 -榨菜 -1694256310 -榨菜 - - -70A671DA-46EF-4857-BCFF-FDF4D79A2098 -Identifier_1 -Identifier_1 -1694256189 -榨菜 -1694256265 -榨菜 - - - - - - - - - - -6499930F-67F9-41F6-8B6D-FD550140F585 -1694256189 -榨菜 -1694256265 -榨菜 -1 - - - - - -E7555969-81DF-404A-8BAC-E14FD63E3ED0 -1694256189 -榨菜 -1694256265 -榨菜 -1 - - - - - -57C624E9-513D-4902-8B69-C1E23D3F929A -1694256189 -榨菜 -1694256265 -榨菜 -1 - - - - - - - - - -EB3E7A9C-3804-475F-BE51-2876883BCA99 -借阅 -borrowe -1694251047 -榨菜 -1694251089 -榨菜 -1,n -1,1 - - - - - - - - -DFB6A6B7-FB71-402A-A534-D90B3AB5CE79 -藏书 -collect books -1694251294 -榨菜 -1694251361 -榨菜 -1,n -1,1 - - - - - - - - -6F2F8FE2-6FA5-4D0C-9ED5-EB5A6B7A6BDE -记录 -Record -1694252531 -榨菜 -1694255510 -榨菜 -1,n -1,1 - - - - - - - - -00505C35-9CF2-4C1F-AF26-EC2F5A44C66C -副本 -Copy -1694253725 -榨菜 -1694255558 -榨菜 -1,n -1,1 - - - - - - - - -A8A02990-BDE8-4818-A8E6-7A405ADB28A8 -分类 -book classification -1694254256 -榨菜 -1694255616 -榨菜 -1,n -1,1 - - - - - - - - -E9C7C9C1-30EA-49E3-B950-C18A57851FE4 -员工 -Staff -1694254417 -榨菜 -1694255324 -榨菜 -1,n -1,1 - - - - - - - - -16C1262F-3624-46D8-AEBF-C63D409BE73D -预约记录 -Reservation Record -1694254724 -榨菜 -1694255319 -榨菜 -1,n -1,1 - - - - - - - - -1069D81D-12F5-4BE7-84D4-64162F6C589E -罚款 -Fine -1694254898 -榨菜 -1694254979 -榨菜 -1,1 -1,n - - - - - - - - -36B7255E-175A-4C27-8D97-468FC35CBD9E -评价图书 -Review Book -1694255240 -榨菜 -1694255367 -榨菜 -1,n -1,1 - - - - - - - - -72DAD0A2-795C-45DD-8936-D78A4E3089A2 -借阅者评价 -Review -1694255244 -榨菜 -1694255312 -榨菜 -1,n -1,1 - - - - - - - - -E8B96C75-0D8F-4498-8A81-27635439F165 -作者——图书 -Writer-book -1694256047 -榨菜 -1694256095 -榨菜 -1,n -1,1 - - - - - - - - -C2751BEA-8B19-49EB-A910-F5A7BB234CC5 -出版社——图书 -Publisher-Book -1694256279 -榨菜 -1694256310 -榨菜 -1,n -1,1 - - - - - - - - -1FDCB80C-DF31-4E86-8105-6F097D822BFA -Relationship_13 -Relationship_13 -1694261534 -榨菜 -1694261534 -榨菜 -0,n -0,1 - - - - - - - - - - -358599B6-0CEC-4C49-8E75-218C5E55AFF0 -图书馆编号 -Lib_ID -1694251138 -榨菜 -1694251288 -榨菜 -NO - - -5C019F2E-9508-4CA5-811B-FC211321489D -图书编号 -ISBN -1694250418 -榨菜 -1694250630 -榨菜 -NO - - -E528B05B-49EC-418B-B70C-927836404A06 -地址 -address -1694250418 -榨菜 -1694261586 -榨菜 -A20 -20 - - -7E68C25D-AA0E-4412-BB2E-D29515138649 -图书名称 -Book_name -1694250477 -榨菜 -1694261309 -榨菜 -A10 -10 - - -9393AEBB-60A6-44C6-936F-DB5919CB2701 -出版日期 -publication_date2 -1694250477 -榨菜 -1694253505 -榨菜 -D - - -47D874F8-8AB4-476B-9AF7-CBD521E5622A -借阅者编号 -B_ID -1694250738 -榨菜 -1694250873 -榨菜 -N10 -10 - - -50D1C60A-F0FD-41A6-9F1B-A5AB2054C16E -姓名 -B_Name -1694250738 -榨菜 -1694250873 -榨菜 -A5 -5 - - -8649AC9B-03DA-4E28-ACF7-F38D0D9A23E3 -性别 -B_Gender -1694250738 -榨菜 -1694250873 -榨菜 -A1 -1 - - -ADE5FC48-58C6-4C14-BAD5-D432427B8B5F -联系方式 -B_contact_way -1694250738 -榨菜 -1694261616 -榨菜 -N11 -11 - - -57CD13F4-00FC-44B7-9479-E246A0AD86A5 -记录编号 -Record_ID -1694252316 -榨菜 -1694252523 -榨菜 -NO - - -B015C364-B71B-4F21-A9CB-C3B56FC30770 -借阅日期 -loan_date -1694252316 -榨菜 -1694256518 -榨菜 -DT - - -00B8308C-253D-4083-A52E-8F93F3BD7279 -归还日期 -return_date -1694252316 -榨菜 -1694256518 -榨菜 -DT - - -5DA556C8-6DD4-4604-AC29-3FD2063D4482 -副本编号 -Copy_ID -1694253245 -榨菜 -1694253499 -榨菜 -NO - - -6C68328D-BE45-4216-806D-80FD556DE4E2 -状态 -status -1694253245 -榨菜 -1694253499 -榨菜 -A2 -2 - - -1AE5DB02-2CFA-40D5-A874-CDC1B955E1B1 -所在图书馆 -Local library -1694253245 -榨菜 -1694261554 -榨菜 -N - - -1A9708B8-C7AB-403D-8244-5449A16667DE -分类编号 -Category_ID -1694254089 -榨菜 -1694254249 -榨菜 -NO - - -8E4F9922-83E0-4CD9-A50C-1D31F1BE57F1 -分类名称 -Category Name -1694254089 -榨菜 -1694254249 -榨菜 -A10 -10 - - -CD290D44-F2D5-4C86-8AA5-5A183682DBCD -员工编号 -Staff ID -1694254312 -榨菜 -1694254401 -榨菜 -NO - - -EE620F12-08D9-4E5B-8D59-26E56C2CE2B7 -姓名 -Writterf_Name -1694254312 -榨菜 -1694261480 -榨菜 -A5 -5 - - -7347E872-A09E-4B6F-9537-2C60C7A11952 -职位 -Position -1694254312 -榨菜 -1694254401 -榨菜 -A5 -5 - - -4AE1B2CD-286B-489E-88D6-3EFC7529FB8E -预约记录编号 -Reservation_ID -1694254596 -榨菜 -1694254696 -榨菜 -NO - - -843932AD-BEB9-43B8-85BB-DD5C9DB616CF -预约时间 -Reservation_Time -1694254596 -榨菜 -1694254696 -榨菜 -D - - -2F257C94-8EDF-4C95-A7DA-B6D93FF76A9A -预约状态 -Reservation_Status -1694254596 -榨菜 -1694254696 -榨菜 -A2 -2 - - -4FA30D99-A28E-4697-BBEE-CBDA6E1E6882 -罚款记录编号 -Fine_ID -1694254774 -榨菜 -1694254877 -榨菜 -NO - - -32D64BFD-1AE7-4504-B56C-D498125BB726 -罚款金额 -Fine_Amount -1694254774 -榨菜 -1694254877 -榨菜 -N10 -10 - - -E3E2DC31-A5B9-43CF-A474-A394F0A5CBD1 -罚款日期 -Fine_Date -1694254774 -榨菜 -1694254877 -榨菜 -D - - -4C624531-2E48-4478-A01A-9D2120857049 -评价编号 -Review ID -1694255082 -榨菜 -1694255190 -榨菜 -NO - - -B1876101-E9ED-407A-8D6A-13577B551A68 -评分 -Rating -1694255082 -榨菜 -1694255190 -榨菜 -DC2,1 -2 -1 - - -F43AF0E7-4EEF-4CC2-BEC8-E5B79695BC8A -评论内容 -Review Content -1694255082 -榨菜 -1694255190 -榨菜 -VA255 -255 - - -ACE9D91D-BB89-47B0-996C-13E9F7C6BDFA -作者编号 -Author ID -1694255900 -榨菜 -1694256029 -榨菜 -NO - - -2C8BB5B8-75DE-47BA-959F-F0F0932833C8 -国籍 -Nationality -1694255900 -榨菜 -1694256029 -榨菜 -A5 -5 - - -45215C83-9E13-414A-8FB7-C439DF312CE4 -性别 -Gender -1694255900 -榨菜 -1694256029 -榨菜 -A1 -1 - - -155AC359-A095-4F97-81C6-402EEDD8D730 -出版社编号 -Publisher_ID -1694256189 -榨菜 -1694256265 -榨菜 -NO - - -26D16EC6-0E76-4972-87B7-A1BA9017E996 -出版社名称 -Publisher Name -1694256189 -榨菜 -1694256265 -榨菜 -A10 -10 - - -4E56329C-4573-4B7D-9A03-F855F1A5C7D1 -所在地 -Location -1694256189 -榨菜 -1694256265 -榨菜 -VA20 -20 - - -BBFE022F-7E2D-41BD-BD92-F1CFE43926B7 -姓名 -Staff_name -1694261398 -榨菜 -1694261480 -榨菜 -A5 -5 - - -FBBB9716-16E9-42AC-BDFF-4A16FBFD3568 -图书馆名称 -Lib_name -1694261713 -榨菜 -1694261732 -榨菜 -A10 -10 - - -1E8B5643-023F-4CFA-A58A-0793F0C0F427 -联系方式 -Writter_contact_way -1694261735 -榨菜 -1694261756 -榨菜 -N11 -11 - - -D4451A07-2E96-453F-8D5E-F9C329A91845 -地址 -Lib_address -1694261761 -榨菜 -1694261781 -榨菜 -VA50 -50 - - - - - - - \ No newline at end of file diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230908 \347\254\254\345\233\233\346\254\241\344\275\234\344\270\232 \344\275\277\347\224\250PowerDesigner \350\256\276\350\256\241\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" "b/53 \345\221\250\345\216\232\350\276\260/20230908 \347\254\254\345\233\233\346\254\241\344\275\234\344\270\232 \344\275\277\347\224\250PowerDesigner \350\256\276\350\256\241\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" deleted file mode 100644 index 60b32197ce5e2da823aaea61f9114eaa84e186ec..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230908 \347\254\254\345\233\233\346\254\241\344\275\234\344\270\232 \344\275\277\347\224\250PowerDesigner \350\256\276\350\256\241\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.md" +++ /dev/null @@ -1,258 +0,0 @@ -# 2023年9月11日 图书管理系统 - -软件:PowerDesigner - -## 笔记: - -软件操作步骤: - -1.创建概念模型(CDM)类似于E-R图; - -2.转换成逻辑模型(LDM); - -3.转换成物理模型(PDM); - -4.生成MySQL代码。 - - - -## 我的代码 - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/9 22:22:09 */ -/*==============================================================*/ - - -drop table if exists Author; - -drop table if exists Book; - -drop table if exists "Book Copy"; - -drop table if exists Book_Category; - -drop table if exists "Fine Record"; - -drop table if exists "Loan record"; - -drop table if exists Publisher; - -drop table if exists "Reservation Record"; - -drop table if exists Review; - -drop table if exists Staff; - -drop table if exists borrower; - -drop table if exists library; - -/*==============================================================*/ -/* Table: Author */ -/*==============================================================*/ -create table Author -( - "Author ID" int not null auto_increment, - Writterf_Name char(5) not null, - Nationality char(5) not null, - Gender char(1) not null, - Writter_contact_way numeric(11,0) not null, - primary key ("Author ID") -); - -alter table Author comment ' ԡ '; - -/*==============================================================*/ -/* Table: Book */ -/*==============================================================*/ -create table Book -( - ISBN int not null auto_increment, - B_ID numeric(10,0) not null, - Lib_ID int not null, - Copy_ID int not null, - Category_ID int not null, - "Author ID" int not null, - Publisher_ID int not null, - address char(20) not null, - Book_name char(10) not null, - publication_date2 date not null, - primary key (ISBN) -); - -/*==============================================================*/ -/* Table: "Book Copy" */ -/*==============================================================*/ -create table "Book Copy" -( - Copy_ID int not null auto_increment, - Lib_ID int, - status char(2) not null, - primary key (Copy_ID) -); - -/*==============================================================*/ -/* Table: Book_Category */ -/*==============================================================*/ -create table Book_Category -( - Category_ID int not null auto_increment, - "Category Name" char(10) not null, - primary key (Category_ID) -); - -alter table Book_Category comment ' - -'; - -/*==============================================================*/ -/* Table: "Fine Record" */ -/*==============================================================*/ -create table "Fine Record" -( - Fine_ID int not null auto_increment, - B_ID numeric(10,0) not null, - Fine_Amount numeric(10,0) not null, - Fine_Date date not null, - primary key (Fine_ID) -); - -/*==============================================================*/ -/* Table: "Loan record" */ -/*==============================================================*/ -create table "Loan record" -( - Record_ID int not null auto_increment, - loan_date datetime not null, - return_date datetime not null, - primary key (Record_ID) -); - -/*==============================================================*/ -/* Table: Publisher */ -/*==============================================================*/ -create table Publisher -( - Publisher_ID int not null auto_increment, - "Publisher Name" char(10) not null, - Location varchar(20) not null, - primary key (Publisher_ID) -); - -/*==============================================================*/ -/* Table: "Reservation Record" */ -/*==============================================================*/ -create table "Reservation Record" -( - Reservation_ID int not null auto_increment, - B_ID numeric(10,0) not null, - Reservation_Time date not null, - Reservation_Status char(2) not null, - primary key (Reservation_ID) -); - -/*==============================================================*/ -/* Table: Review */ -/*==============================================================*/ -create table Review -( - "Review ID" int not null auto_increment, - ISBN int not null, - B_ID numeric(10,0) not null, - Rating decimal(2,1) not null, - "Review Content" varchar(255) not null, - primary key ("Review ID") -); - -/*==============================================================*/ -/* Table: Staff */ -/*==============================================================*/ -create table Staff -( - "Staff ID" int not null auto_increment, - Lib_ID int not null, - Staff_name char(5) not null, - Position char(5) not null, - primary key ("Staff ID") -); - -/*==============================================================*/ -/* Table: borrower */ -/*==============================================================*/ -create table borrower -( - B_ID numeric(10,0) not null, - Record_ID int not null, - B_Name char(5) not null, - B_Gender char(1) not null, - B_contact_way numeric(11,0) not null, - primary key (B_ID) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - Lib_ID int not null auto_increment, - Lib_name char(10) not null, - Lib_address varchar(50) not null, - primary key (Lib_ID) -); - -alter table Book add constraint FK_Copy foreign key (Copy_ID) - references "Book Copy" (Copy_ID) on delete restrict on update restrict; - -alter table Book add constraint "FK_Publisher-Book" foreign key (Publisher_ID) - references Publisher (Publisher_ID) on delete restrict on update restrict; - -alter table Book add constraint "FK_Writer-book" foreign key ("Author ID") - references Author ("Author ID") on delete restrict on update restrict; - -alter table Book add constraint "FK_book classification" foreign key (Category_ID) - references Book_Category (Category_ID) on delete restrict on update restrict; - -alter table Book add constraint FK_borrowe foreign key (B_ID) - references borrower (B_ID) on delete restrict on update restrict; - -alter table Book add constraint "FK_collect books" foreign key (Lib_ID) - references library (Lib_ID) on delete restrict on update restrict; - -alter table "Book Copy" add constraint FK_Relationship_13 foreign key (Lib_ID) - references library (Lib_ID) on delete restrict on update restrict; - -alter table "Fine Record" add constraint FK_Fine foreign key (B_ID) - references borrower (B_ID) on delete restrict on update restrict; - -alter table "Reservation Record" add constraint "FK_Reservation Record" foreign key (B_ID) - references borrower (B_ID) on delete restrict on update restrict; - -alter table Review add constraint FK_Review foreign key (B_ID) - references borrower (B_ID) on delete restrict on update restrict; - -alter table Review add constraint "FK_Review Book" foreign key (ISBN) - references Book (ISBN) on delete restrict on update restrict; - -alter table Staff add constraint FK_Staff foreign key (Lib_ID) - references library (Lib_ID) on delete restrict on update restrict; - -alter table borrower add constraint FK_Record foreign key (Record_ID) - references "Loan record" (Record_ID) on delete restrict on update restrict; - - -``` - - - - - - - - - - - - - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230908 \347\254\254\345\233\233\346\254\241\344\275\234\344\270\232 \344\275\277\347\224\250PowerDesigner \350\256\276\350\256\241\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.pdf" "b/53 \345\221\250\345\216\232\350\276\260/20230908 \347\254\254\345\233\233\346\254\241\344\275\234\344\270\232 \344\275\277\347\224\250PowerDesigner \350\256\276\350\256\241\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.pdf" deleted file mode 100644 index 95e9d0b220fbd0d61d6931884867e4d15c6c6034..0000000000000000000000000000000000000000 Binary files "a/53 \345\221\250\345\216\232\350\276\260/20230908 \347\254\254\345\233\233\346\254\241\344\275\234\344\270\232 \344\275\277\347\224\250PowerDesigner \350\256\276\350\256\241\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237.pdf" and /dev/null differ diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230912 \347\254\254\344\272\224\346\254\241\344\275\234\344\270\232 \350\261\206\347\223\243\347\224\265\345\275\261_DB/\350\261\206\347\223\243\347\224\265\345\275\261.md" "b/53 \345\221\250\345\216\232\350\276\260/20230912 \347\254\254\344\272\224\346\254\241\344\275\234\344\270\232 \350\261\206\347\223\243\347\224\265\345\275\261_DB/\350\261\206\347\223\243\347\224\265\345\275\261.md" deleted file mode 100644 index 78fa6c16af886878bc11bbb6c9922e7a04b4623b..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230912 \347\254\254\344\272\224\346\254\241\344\275\234\344\270\232 \350\261\206\347\223\243\347\224\265\345\275\261_DB/\350\261\206\347\223\243\347\224\265\345\275\261.md" +++ /dev/null @@ -1,161 +0,0 @@ -2023年9月12日 豆瓣电影 数据库 - -ER图: - -[![pP2ELwQ.md.png](https://s1.ax1x.com/2023/09/12/pP2ELwQ.md.png)](https://imgse.com/i/pP2ELwQ) - -代码: - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 17:57:48 */ -/*==============================================================*/ -drop database if exists movie_db; -create database if not exists movie_db charset utf8; -use movie_db; - -drop table if exists actor; - -drop table if exists director_list; - -drop table if exists movie; - -drop table if exists movie_list; - -drop table if exists people_info; - -drop table if exists screenwriter; - -drop table if exists short_comments; - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - actor_No int(10) not null auto_increment, - ID int not null, - movie_No int not null, - actor char(10) not null, - primary key (actor_No) -); - -/*==============================================================*/ -/* Table: director_list */ -/*==============================================================*/ -create table director_list -( - director_No int not null auto_increment, - ID int not null, - director char(10) not null, - primary key (director_No) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_No int not null auto_increment, - screenwriter_No int not null, - director_No int not null, - movie_name varchar(20) not null, - lauguage varchar(10) not null, - movie_type varchar(10) not null, - movie_native varchar(10) not null, - movie_time int not null, - nickname varchar(10) not null, - release_date date not null, - IMDb numeric(15,0) not null, - Score decimal(2,1) not null, - synopsis varchar(100) not null, - primary key (movie_No) -); - -/*==============================================================*/ -/* Table: movie_list */ -/*==============================================================*/ -create table movie_list -( - movie_list_No int not null auto_increment, - movie_No int not null, - movie_list varchar(10) not null, - dou_col char(5) not null, - recommend varchar(255), - primary key (movie_list_No) -); - -/*==============================================================*/ -/* Table: people_info */ -/*==============================================================*/ -create table people_info -( - ID int not null auto_increment, - name varchar(10) not null, - gender char(1) not null, - age int not null, - constellation char(3) not null, - birthday date not null, - birth_location varchar(20) not null, - career char(10) not null, - more_chinese_name char(10) not null, - more_foreign_name char(10) not null, - family_members varchar(20) not null, - imdb_No numeric(20,0) not null, - Personnel_Introduction varchar(100) not null, - primary key (ID) -); - -/*==============================================================*/ -/* Table: screenwriter */ -/*==============================================================*/ -create table screenwriter -( - screenwriter_No int not null auto_increment, - ID int not null, - screenwriter char(10) not null, - primary key (screenwriter_No) -); - -/*==============================================================*/ -/* Table: short_comments */ -/*==============================================================*/ -create table short_comments -( - short_comments_No int not null auto_increment, - movie_No int not null, - want_watch numeric(1,0) not null, - watched numeric(1,0) not null, - tag char(10) not null, - comment varchar(350) not null, - primary key (short_comments_No) -); - -alter table actor add constraint FK_actor_info foreign key (ID) - references people_info (ID) on delete restrict on update restrict; - -alter table actor add constraint FK_actor_movie foreign key (movie_No) - references movie (movie_No) on delete restrict on update restrict; - -alter table director_list add constraint FK_director_info foreign key (ID) - references people_info (ID) on delete restrict on update restrict; - -alter table movie add constraint FK_director_movie foreign key (director_No) - references director_list (director_No) on delete restrict on update restrict; - -alter table movie add constraint FK_screen_movie foreign key (screenwriter_No) - references screenwriter (screenwriter_No) on delete restrict on update restrict; - -alter table movie_list add constraint FK_movie_list foreign key (movie_No) - references movie (movie_No) on delete restrict on update restrict; - -alter table screenwriter add constraint FK_screen_info foreign key (ID) - references people_info (ID) on delete restrict on update restrict; - -alter table short_comments add constraint FK_short_movie foreign key (movie_No) - references movie (movie_No) on delete restrict on update restrict; - - -``` - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230912 \347\254\254\344\272\224\346\254\241\344\275\234\344\270\232 \350\261\206\347\223\243\347\224\265\345\275\261_DB/\350\261\206\347\223\243\347\224\265\345\275\261.pdf" "b/53 \345\221\250\345\216\232\350\276\260/20230912 \347\254\254\344\272\224\346\254\241\344\275\234\344\270\232 \350\261\206\347\223\243\347\224\265\345\275\261_DB/\350\261\206\347\223\243\347\224\265\345\275\261.pdf" deleted file mode 100644 index 211330676509cc59bd47041f870dc0ae7ef5f1e2..0000000000000000000000000000000000000000 Binary files "a/53 \345\221\250\345\216\232\350\276\260/20230912 \347\254\254\344\272\224\346\254\241\344\275\234\344\270\232 \350\261\206\347\223\243\347\224\265\345\275\261_DB/\350\261\206\347\223\243\347\224\265\345\275\261.pdf" and /dev/null differ diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230912 \347\254\254\344\272\224\346\254\241\344\275\234\344\270\232 \350\261\206\347\223\243\347\224\265\345\275\261_DB/\350\261\206\347\223\243\347\224\265\345\275\261.png" "b/53 \345\221\250\345\216\232\350\276\260/20230912 \347\254\254\344\272\224\346\254\241\344\275\234\344\270\232 \350\261\206\347\223\243\347\224\265\345\275\261_DB/\350\261\206\347\223\243\347\224\265\345\275\261.png" deleted file mode 100644 index 1daa19e46219e8bf08d8f9ab6e6795c8c8d053f8..0000000000000000000000000000000000000000 Binary files "a/53 \345\221\250\345\216\232\350\276\260/20230912 \347\254\254\344\272\224\346\254\241\344\275\234\344\270\232 \350\261\206\347\223\243\347\224\265\345\275\261_DB/\350\261\206\347\223\243\347\224\265\345\275\261.png" and /dev/null differ diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230912 \347\254\254\344\272\224\346\254\241\344\275\234\344\270\232 \350\261\206\347\223\243\347\224\265\345\275\261_DB/\350\261\206\347\223\243\347\224\265\345\275\261.sql" "b/53 \345\221\250\345\216\232\350\276\260/20230912 \347\254\254\344\272\224\346\254\241\344\275\234\344\270\232 \350\261\206\347\223\243\347\224\265\345\275\261_DB/\350\261\206\347\223\243\347\224\265\345\275\261.sql" deleted file mode 100644 index 6033b76da5069dde8fdefb028b6a9192d271c615..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230912 \347\254\254\344\272\224\346\254\241\344\275\234\344\270\232 \350\261\206\347\223\243\347\224\265\345\275\261_DB/\350\261\206\347\223\243\347\224\265\345\275\261.sql" +++ /dev/null @@ -1,149 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 17:57:48 */ -/*==============================================================*/ -drop database if exists movie_db; -create database if not exists movie_db charset utf8; -use movie_db; - -drop table if exists actor; - -drop table if exists director_list; - -drop table if exists movie; - -drop table if exists movie_list; - -drop table if exists people_info; - -drop table if exists screenwriter; - -drop table if exists short_comments; - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - actor_No int(10) not null auto_increment, - ID int not null, - movie_No int not null, - actor char(10) not null, - primary key (actor_No) -); - -/*==============================================================*/ -/* Table: director_list */ -/*==============================================================*/ -create table director_list -( - director_No int not null auto_increment, - ID int not null, - director char(10) not null, - primary key (director_No) -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - movie_No int not null auto_increment, - screenwriter_No int not null, - director_No int not null, - movie_name varchar(20) not null, - lauguage varchar(10) not null, - movie_type varchar(10) not null, - movie_native varchar(10) not null, - movie_time int not null, - nickname varchar(10) not null, - release_date date not null, - IMDb numeric(15,0) not null, - Score decimal(2,1) not null, - synopsis varchar(100) not null, - primary key (movie_No) -); - -/*==============================================================*/ -/* Table: movie_list */ -/*==============================================================*/ -create table movie_list -( - movie_list_No int not null auto_increment, - movie_No int not null, - movie_list varchar(10) not null, - dou_col char(5) not null, - recommend varchar(255), - primary key (movie_list_No) -); - -/*==============================================================*/ -/* Table: people_info */ -/*==============================================================*/ -create table people_info -( - ID int not null auto_increment, - name varchar(10) not null, - gender char(1) not null, - age int not null, - constellation char(3) not null, - birthday date not null, - birth_location varchar(20) not null, - career char(10) not null, - more_chinese_name char(10) not null, - more_foreign_name char(10) not null, - family_members varchar(20) not null, - imdb_No numeric(20,0) not null, - Personnel_Introduction varchar(100) not null, - primary key (ID) -); - -/*==============================================================*/ -/* Table: screenwriter */ -/*==============================================================*/ -create table screenwriter -( - screenwriter_No int not null auto_increment, - ID int not null, - screenwriter char(10) not null, - primary key (screenwriter_No) -); - -/*==============================================================*/ -/* Table: short_comments */ -/*==============================================================*/ -create table short_comments -( - short_comments_No int not null auto_increment, - movie_No int not null, - want_watch numeric(1,0) not null, - watched numeric(1,0) not null, - tag char(10) not null, - comment varchar(350) not null, - primary key (short_comments_No) -); - -alter table actor add constraint FK_actor_info foreign key (ID) - references people_info (ID) on delete restrict on update restrict; - -alter table actor add constraint FK_actor_movie foreign key (movie_No) - references movie (movie_No) on delete restrict on update restrict; - -alter table director_list add constraint FK_director_info foreign key (ID) - references people_info (ID) on delete restrict on update restrict; - -alter table movie add constraint FK_director_movie foreign key (director_No) - references director_list (director_No) on delete restrict on update restrict; - -alter table movie add constraint FK_screen_movie foreign key (screenwriter_No) - references screenwriter (screenwriter_No) on delete restrict on update restrict; - -alter table movie_list add constraint FK_movie_list foreign key (movie_No) - references movie (movie_No) on delete restrict on update restrict; - -alter table screenwriter add constraint FK_screen_info foreign key (ID) - references people_info (ID) on delete restrict on update restrict; - -alter table short_comments add constraint FK_short_movie foreign key (movie_No) - references movie (movie_No) on delete restrict on update restrict; - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230913 \347\254\254\345\205\255\346\254\241\344\275\234\344\270\232 \345\214\273\347\224\237\346\225\260\346\215\256\345\272\223/Doctor.png" "b/53 \345\221\250\345\216\232\350\276\260/20230913 \347\254\254\345\205\255\346\254\241\344\275\234\344\270\232 \345\214\273\347\224\237\346\225\260\346\215\256\345\272\223/Doctor.png" deleted file mode 100644 index 223af1235dfa9c01492c46176e7efb040ec259f3..0000000000000000000000000000000000000000 Binary files "a/53 \345\221\250\345\216\232\350\276\260/20230913 \347\254\254\345\205\255\346\254\241\344\275\234\344\270\232 \345\214\273\347\224\237\346\225\260\346\215\256\345\272\223/Doctor.png" and /dev/null differ diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230913 \347\254\254\345\205\255\346\254\241\344\275\234\344\270\232 \345\214\273\347\224\237\346\225\260\346\215\256\345\272\223/\345\214\273\347\224\237.sql" "b/53 \345\221\250\345\216\232\350\276\260/20230913 \347\254\254\345\205\255\346\254\241\344\275\234\344\270\232 \345\214\273\347\224\237\346\225\260\346\215\256\345\272\223/\345\214\273\347\224\237.sql" deleted file mode 100644 index 1e9d61fc92e05009aa1be4ad8cdaae2e91fee209..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230913 \347\254\254\345\205\255\346\254\241\344\275\234\344\270\232 \345\214\273\347\224\237\346\225\260\346\215\256\345\272\223/\345\214\273\347\224\237.sql" +++ /dev/null @@ -1,169 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 20:31:06 */ -/*==============================================================*/ -drop database if exists doctor; -create database if not exists doctor charset utf8; -use doctor; - -drop table if exists chu_fang; - -drop table if exists dep; - -drop table if exists doctor; - -drop table if exists fee_record; - -drop table if exists guahao; - -drop table if exists medicine; - -drop table if exists patient; - -drop table if exists registration_fee; - -drop table if exists yi_zhu; - -/*==============================================================*/ -/* Table: chu_fang */ -/*==============================================================*/ -create table chu_fang -( - chu_fang_No int not null auto_increment, - doctor_No char(10), - yao_pin_No int not null, - count int not null, - primary key (chu_fang_No) -); - -/*==============================================================*/ -/* Table: dep */ -/*==============================================================*/ -create table dep -( - dep_No int not null auto_increment, - dep_name varchar(10) not null, - dep_tel numeric(11,0) not null, - kezhang_No int not null, - primary key (dep_No) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_No char(10) not null, - doctor_job2 varchar(10), - dep_No int, - dep_name varchar(10) not null, - dep_tel numeric(11,0) not null, - kezhang_No int not null, - doctor_job char(10) not null, - primary key (doctor_No) -); - -/*==============================================================*/ -/* Table: fee_record */ -/*==============================================================*/ -create table fee_record -( - record_No int not null auto_increment, - patient_No int, - patinent_No numeric(9,0) not null, - deal_fee decimal(9,2) not null, - record_time datetime not null, - primary key (record_No) -); - -/*==============================================================*/ -/* Table: guahao */ -/*==============================================================*/ -create table guahao -( - doctor_No char(10) not null, - patient_No int not null, - guahao_No char(10) not null, - primary key (doctor_No, patient_No, guahao_No) -); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - medicine_No int not null auto_increment, - medicine_name char(10) not null, - medicine_type char(10) not null, - medicine_specification varchar(10) not null, - medicine_price decimal(9,2) not null, - medicine_repertory int not null, - primary key (medicine_No) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_No int not null auto_increment, - patient_name char(10) not null, - patient_gender char(1) not null, - patient_ID numeric(18,0) not null, - patient_tel numeric(11,0) not null, - patient_balance decimal(9,2) not null, - primary key (patient_No) -); - -/*==============================================================*/ -/* Table: registration_fee */ -/*==============================================================*/ -create table registration_fee -( - doctor_job2 varchar(10) not null, - registration_fee decimal(9,2) not null, - primary key (doctor_job2) -); - -/*==============================================================*/ -/* Table: yi_zhu */ -/*==============================================================*/ -create table yi_zhu -( - yi_zhu_No int not null auto_increment, - chu_fang_No int, - medicine_No int, - yao_pin_No int not null, - count int not null, - danciyongliang int not null, - pinci int not null, - geiyaofangfa varchar(10) not null, - doctor_No2 int not null, - chufang_No int not null, - primary key (yi_zhu_No) -); - -alter table chu_fang add constraint FK_kaichufang foreign key (doctor_No) - references doctor (doctor_No) on delete restrict on update restrict; - -alter table doctor add constraint FK_have2 foreign key (doctor_job2) - references registration_fee (doctor_job2) on delete restrict on update restrict; - -alter table doctor add constraint FK_pin_yonng foreign key (dep_No) - references dep (dep_No) on delete restrict on update restrict; - -alter table fee_record add constraint FK_have foreign key (patient_No) - references patient (patient_No) on delete restrict on update restrict; - -alter table guahao add constraint FK_Relationship_2 foreign key (doctor_No) - references doctor (doctor_No) on delete restrict on update restrict; - -alter table guahao add constraint FK_Relationship_3 foreign key (patient_No) - references patient (patient_No) on delete restrict on update restrict; - -alter table yi_zhu add constraint FK_kaiyao foreign key (medicine_No) - references medicine (medicine_No) on delete restrict on update restrict; - -alter table yi_zhu add constraint FK_shuyu foreign key (chu_fang_No) - references chu_fang (chu_fang_No) on delete restrict on update restrict; - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230913 \347\254\254\345\205\255\346\254\241\344\275\234\344\270\232 \345\214\273\347\224\237\346\225\260\346\215\256\345\272\223/\345\214\273\347\224\237\346\225\260\346\215\256\345\272\223.md" "b/53 \345\221\250\345\216\232\350\276\260/20230913 \347\254\254\345\205\255\346\254\241\344\275\234\344\270\232 \345\214\273\347\224\237\346\225\260\346\215\256\345\272\223/\345\214\273\347\224\237\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index 97d1ea6d8950f80f03a5ed14d2f2c6e5a6161fd5..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230913 \347\254\254\345\205\255\346\254\241\344\275\234\344\270\232 \345\214\273\347\224\237\346\225\260\346\215\256\345\272\223/\345\214\273\347\224\237\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,178 +0,0 @@ -# 2023年9月13日 医生数据库 - -[![pPRF7uD.md.png](https://z1.ax1x.com/2023/09/13/pPRF7uD.md.png)](https://imgse.com/i/pPRF7uD) - -```mysql - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 20:31:06 */ -/*==============================================================*/ -drop database if exists doctor; -create database if not exists doctor charset utf8; -use doctor; - -drop table if exists chu_fang; - -drop table if exists dep; - -drop table if exists doctor; - -drop table if exists fee_record; - -drop table if exists guahao; - -drop table if exists medicine; - -drop table if exists patient; - -drop table if exists registration_fee; - -drop table if exists yi_zhu; - -/*==============================================================*/ -/* Table: chu_fang */ -/*==============================================================*/ -create table chu_fang -( - chu_fang_No int not null auto_increment, - doctor_No char(10), - yao_pin_No int not null, - count int not null, - primary key (chu_fang_No) -); - -/*==============================================================*/ -/* Table: dep */ -/*==============================================================*/ -create table dep -( - dep_No int not null auto_increment, - dep_name varchar(10) not null, - dep_tel numeric(11,0) not null, - kezhang_No int not null, - primary key (dep_No) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_No char(10) not null, - doctor_job2 varchar(10), - dep_No int, - dep_name varchar(10) not null, - dep_tel numeric(11,0) not null, - kezhang_No int not null, - doctor_job char(10) not null, - primary key (doctor_No) -); - -/*==============================================================*/ -/* Table: fee_record */ -/*==============================================================*/ -create table fee_record -( - record_No int not null auto_increment, - patient_No int, - patinent_No numeric(9,0) not null, - deal_fee decimal(9,2) not null, - record_time datetime not null, - primary key (record_No) -); - -/*==============================================================*/ -/* Table: guahao */ -/*==============================================================*/ -create table guahao -( - doctor_No char(10) not null, - patient_No int not null, - guahao_No char(10) not null, - primary key (doctor_No, patient_No, guahao_No) -); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - medicine_No int not null auto_increment, - medicine_name char(10) not null, - medicine_type char(10) not null, - medicine_specification varchar(10) not null, - medicine_price decimal(9,2) not null, - medicine_repertory int not null, - primary key (medicine_No) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_No int not null auto_increment, - patient_name char(10) not null, - patient_gender char(1) not null, - patient_ID numeric(18,0) not null, - patient_tel numeric(11,0) not null, - patient_balance decimal(9,2) not null, - primary key (patient_No) -); - -/*==============================================================*/ -/* Table: registration_fee */ -/*==============================================================*/ -create table registration_fee -( - doctor_job2 varchar(10) not null, - registration_fee decimal(9,2) not null, - primary key (doctor_job2) -); - -/*==============================================================*/ -/* Table: yi_zhu */ -/*==============================================================*/ -create table yi_zhu -( - yi_zhu_No int not null auto_increment, - chu_fang_No int, - medicine_No int, - yao_pin_No int not null, - count int not null, - danciyongliang int not null, - pinci int not null, - geiyaofangfa varchar(10) not null, - doctor_No2 int not null, - chufang_No int not null, - primary key (yi_zhu_No) -); - -alter table chu_fang add constraint FK_kaichufang foreign key (doctor_No) - references doctor (doctor_No) on delete restrict on update restrict; - -alter table doctor add constraint FK_have2 foreign key (doctor_job2) - references registration_fee (doctor_job2) on delete restrict on update restrict; - -alter table doctor add constraint FK_pin_yonng foreign key (dep_No) - references dep (dep_No) on delete restrict on update restrict; - -alter table fee_record add constraint FK_have foreign key (patient_No) - references patient (patient_No) on delete restrict on update restrict; - -alter table guahao add constraint FK_Relationship_2 foreign key (doctor_No) - references doctor (doctor_No) on delete restrict on update restrict; - -alter table guahao add constraint FK_Relationship_3 foreign key (patient_No) - references patient (patient_No) on delete restrict on update restrict; - -alter table yi_zhu add constraint FK_kaiyao foreign key (medicine_No) - references medicine (medicine_No) on delete restrict on update restrict; - -alter table yi_zhu add constraint FK_shuyu foreign key (chu_fang_No) - references chu_fang (chu_fang_No) on delete restrict on update restrict; - - -``` - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/1.png" "b/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/1.png" deleted file mode 100644 index 215c09d77849bdf108943631c906b76c14a2f369..0000000000000000000000000000000000000000 Binary files "a/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/1.png" and /dev/null differ diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/ConceptualDataModel_1.cdm" "b/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/ConceptualDataModel_1.cdm" deleted file mode 100644 index 0b753a0a34cb237d283d7d5adcb9704406c11f91..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/ConceptualDataModel_1.cdm" +++ /dev/null @@ -1,2376 +0,0 @@ - - - - - - - - - -67160797-B252-4D7E-BA42-060BBF163650 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694736710 -Administrator -1694738296 -Administrator -[FolderOptions] - -[FolderOptions\Conceptual Data Objects] -GenerationCheckModel=Yes -GenerationPath= -GenerationOptions= -GenerationTasks= -GenerationTargets= -GenerationSelections= - -[FolderOptions\CheckModel] - -[FolderOptions\CheckModel\Package] - -[FolderOptions\CheckModel\Package\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\GenrCircularityYes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\GenrCircularityNo] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\ShortcutUniqCode] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Package\ChildShortcut] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain] - -[FolderOptions\CheckModel\Domain\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckOtherDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item] - -[FolderOptions\CheckModel\Data Item\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\InfoNotUsed] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\InfoUsedSevTime] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\InfoDiffDomn] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\CheckOtherDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Item\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity] - -[FolderOptions\CheckModel\Entity\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\MaxLen - NAME] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttNoAttrNo] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttNbSerials] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttNoAttrYes] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EmptyCollYesYes] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttSamePrnt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttMultInhr] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttSevInhr] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\PidtfInhrAtt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute] - -[FolderOptions\CheckModel\Entity.Entity Attribute\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier] - -[FolderOptions\CheckModel\Entity.Identifier\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\EmptyColl - PENTCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckIncludeColl - Entt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\IdtfChildPIdtf] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship] - -[FolderOptions\CheckModel\Relationship\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshReflexiveDeptYes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshReflexiveDeptNo] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshBject] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshMnyMny] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshDepdChild] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association] - -[FolderOptions\CheckModel\Association\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscNbLink] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscNbIdLink1] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscNbIdLink2] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscIdPass] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscBject] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscMaxCard] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscReflex] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\AsscMnyMny] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance] - -[FolderOptions\CheckModel\Inheritance\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\EmptyColl - CHILDCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Replication] - -[FolderOptions\CheckModel\Replication\PartialReplication] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule] - -[FolderOptions\CheckModel\Business Rule\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\EmptyColl - OBJCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object] - -[FolderOptions\CheckModel\Extended Object\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link] - -[FolderOptions\CheckModel\Extended Link\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File] - -[FolderOptions\CheckModel\File\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckPathExists] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format] - -[FolderOptions\CheckModel\Data Format\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckDataFormatNullExpression] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes -[ModelOptions] - -[ModelOptions\Conceptual options] -CaseSensitive=No -DisplayName=Yes -EnableTrans=No -UseTerm=No -EnableRequirements=No -EnableFullShortcut=Yes -InfoUnique=Yes -AllowReuse=Yes -InfoAllowReuse=Yes -Notation=2 -RlshUnique=Yes -DefaultDttp= -DomnCopyDttp=Yes -DomnCopyChck=No -DomnCopyRule=No -DomnCopyExat=No -DomnCopyMand=No -DttpFullName=Yes -RlshAsstTmpl=Each %Entity1.Name%[CRLF].if %Entity1ToEntity2RoleMandatory%[CRLF] must[CRLF].else[CRLF] may[CRLF].endif[CRLF].if %Entity1ToEntity2Role%[CRLF] %.L:Entity1ToEntity2Role%[CRLF].else[CRLF] have[CRLF].endif[CRLF].if %Entity1ToEntity2RoleMaximumCardinality%==1[CRLF].if %Entity1ToEntity2RoleMandatory%[CRLF] one and only one[CRLF].else[CRLF] at most one[CRLF].endif[CRLF].else[CRLF] one or more[CRLF].endif[CRLF].if %Entity1%==%Entity2%[CRLF] other[CRLF].endif[CRLF] %Entity2.Name%.[CRLF]Each %Entity2.Name%[CRLF].if %Entity2ToEntity1RoleMandatory%[CRLF] must[CRLF].else[CRLF] may[CRLF].endif[CRLF].if %Entity2ToEntity1Role%[CRLF] %.L:Entity2ToEntity1Role%[CRLF].else[CRLF] have[CRLF].endif[CRLF].if %Entity2ToEntity1RoleMaximumCardinality%==1[CRLF].if %Entity2ToEntity1RoleMandatory%[CRLF] one and only one[CRLF].else[CRLF] at most one[CRLF].endif[CRLF].else[CRLF] one or more[CRLF].endif[CRLF].if %Entity1%==%Entity2%[CRLF] other[CRLF].endif[CRLF] %Entity1.Name%. -RlshAsstExt= - -[ModelOptions\Conceptual options\NamingOptionsTemplates] - -[ModelOptions\Conceptual options\ClssNamingOptions] - -[ModelOptions\Conceptual options\ClssNamingOptions\FILO] - -[ModelOptions\Conceptual options\ClssNamingOptions\FILO\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\FILO\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\FRMEOBJ] - -[ModelOptions\Conceptual options\ClssNamingOptions\FRMEOBJ\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\FRMEOBJ\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\FRMELNK] - -[ModelOptions\Conceptual options\ClssNamingOptions\FRMELNK\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\FRMELNK\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\DefaultClass] - -[ModelOptions\Conceptual options\ClssNamingOptions\DefaultClass\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\DefaultClass\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMPCKG] - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMPCKG\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMPCKG\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMDOMN] - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMDOMN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMDOMN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\INFO] - -[ModelOptions\Conceptual options\ClssNamingOptions\INFO\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\INFO\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\ENTT] - -[ModelOptions\Conceptual options\ClssNamingOptions\ENTT\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\ENTT\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\IDTF] - -[ModelOptions\Conceptual options\ClssNamingOptions\IDTF\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\IDTF\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\RLSH] - -[ModelOptions\Conceptual options\ClssNamingOptions\RLSH\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\RLSH\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\ASSC] - -[ModelOptions\Conceptual options\ClssNamingOptions\ASSC\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\ASSC\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMINHR] - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMINHR\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Conceptual options\ClssNamingOptions\CDMINHR\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Generate] - -[ModelOptions\Generate\Pdm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No -BuildTrgr=No -TablePrefix= -IndxPKName=%TABLE%_PK -IndxAKName=%TABLE%_AK -IndxFKName=%REFR%_FK -IndxThreshold= -ClassPrefix= -ColnFKName=%.3:PARENT%_%COLUMN% -ColnFKNameUse=No - -[ModelOptions\Generate\Oom] -CheckModel=Yes -SaveLinks=Yes -NameToCode=Yes - -[ModelOptions\Generate\Ldm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No -PreserveMode=Yes - - -4B35CBA1-A514-45E6-BDBC-58CCF6AE203F -ConceptualDataModel_1 -ConceptualDataModel_1 -1694738296 -Administrator -1694738296 -Administrator - -70136198-6D9C-4E51-8FB5-AED752B89C46 -5F45F978-C4F3-4E35-A3FC-AF3318663A0F - - - - -E2940590-3301-43ED-9D9E-BED6B151B5A0 -Diagram_1 -Diagram_1 -1694736710 -Administrator -1694737913 -Administrator -[DisplayPreferences] - -[DisplayPreferences\CDM] - -[DisplayPreferences\General] -Adjust to text=Yes -Snap Grid=No -Constrain Labels=Yes -Display Grid=No -Show Page Delimiter=No -Show Links intersections=Yes -Activate automatic link routing=Yes -Grid size=800 -Graphic unit=2 -Window color=192 192 192 -Background image= -Background mode=8 -Watermark image= -Watermark mode=8 -Show watermark on screen=No -Gradient mode=0 -Gradient end color=255 255 255 -Show Swimlane=No -SwimlaneVert=Yes -TreeVert=No -CompDark=0 - -[DisplayPreferences\Object] -Show Icon=No -Mode=2 -Trunc Length=40 -Word Length=40 -Word Text=!"#$%&')*+,-./:;=>?@\]^_`|}~ -Shortcut IntIcon=Yes -Shortcut IntLoct=Yes -Shortcut IntFullPath=No -Shortcut IntLastPackage=Yes -Shortcut ExtIcon=Yes -Shortcut ExtLoct=No -Shortcut ExtFullPath=No -Shortcut ExtLastPackage=Yes -Shortcut ExtIncludeModl=Yes -EObjShowStrn=Yes -ExtendedObject.Comment=No -ExtendedObject.IconPicture=No -ExtendedObject.TextStyle=No -ExtendedObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Object Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -ELnkShowStrn=Yes -ELnkShowName=Yes -ExtendedLink_SymbolLayout=<Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Source" >[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -FileObject.Stereotype=No -FileObject.DisplayName=Yes -FileObject.LocationOrName=No -FileObject.IconPicture=No -FileObject.TextStyle=No -FileObject.IconMode=Yes -FileObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Location" Attribute="LocationOrName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Package.Stereotype=Yes -Package.Comment=No -Package.IconPicture=No -Package.TextStyle=No -Package_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Display Model Version=Yes -Entity.Stereotype=Yes -Entity.Attributes=Yes -Entity.Attributes._Filter="All attributes" CDMPENTALL -Entity.Attributes._Columns=Stereotype IdentifierIndicator DomainOrDataType NullIndicator -Entity.Attributes._Limit=-5 -Entity.Identifiers=Yes -Entity.Identifiers._Columns=Stereotype IdentifierIndicator -Entity.Comment=No -Entity.IconPicture=No -Entity.TextStyle=No -Entity_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" Filters="&quot;All attributes&quot; CDMPENTALL &quot;&quot;\r\n&quot;Primary attributes&quot; CDMPENTPK &quot;\&quot;PIDTF \&quot;TRUE\&quot; TRUE\&quot;&quot;\r\n&quot;Identifying attributes&quot; CDMPENTIDTF &quot;\&quot;AIDF \&quot;TRUE\&quot; TRUE\&quot;&quot;" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Identifiers" Collection="Identifiers" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Relationship.Entity1ToEntity2Role=Yes -Relationship.Entity2ToEntity1RoleCardinality=No -Relationship.Entity1ToEntity2RoleDominant=Yes -Relationship.Stereotype=Yes -Relationship.DisplayName=Yes -Relationship.Entity2ToEntity1Role=Yes -Relationship.Entity1ToEntity2RoleCardinality=No -Relationship.Entity2ToEntity1RoleDominant=Yes -Relationship_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity1ToEntity2Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity2ToEntity1RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity1ToEntity2RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity2ToEntity1Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity1ToEntity2RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity2ToEntity1RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -Association.Stereotype=Yes -Association.Comment=No -Association.Attributes=Yes -Association.Attributes._Columns=Stereotype DataType NullIndicator -Association.Attributes._Limit=-5 -Association.IconPicture=No -Association.TextStyle=No -Association_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -AssociationLink.SymbolCardinality=Yes -AssociationLink.Stereotype=Yes -AssociationLink.Role=Yes -AssociationLink_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Cardinality" Attribute="SymbolCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Role" Attribute="Role" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -Inheritance.Stereotype=Yes -Inheritance.DisplayName=Yes -Inheritance.IconPicture=No -Inheritance.TextStyle=No -Inheritance_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> - -[DisplayPreferences\Symbol] - -[DisplayPreferences\Symbol\FRMEOBJ] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=6000 -Height=2000 -Brush color=255 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=64 -Brush gradient color=192 192 192 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 255 128 128 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FRMELNK] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FILO] -OBJSTRNFont=新宋体,8,N -OBJSTRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LCNMFont=新宋体,8,N -LCNMFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3600 -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ENTT] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0 0 0 -IdentifiersFont=新宋体,8,N -IdentifiersFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=176 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 170 170 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\RLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 170 170 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ASSC] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3000 -Brush color=208 208 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINK] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=Yes -Width=1600 -Height=1000 -Brush color=176 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINH] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\USRDEPD] -OBJXSTRFont=新宋体,8,N -OBJXSTRFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=2 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\Free Symbol] -Free TextFont=新宋体,8,N -Free TextFont color=0 0 0 -Line style=0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 -(8500, 11000) -((315,354), (433,354)) --29257 --29257 - - -1694737557 -1694738275 -((-24887,6220), (-22487,14555)) -((-23687,14155),(-23687,7620)) -1 -4371 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694737876 -1694738274 -((-1207,6220), (1193,13318)) -((-7,12918),(-7,7620)) -1 -4371 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694737877 -1694738273 -((-1207,-2373), (1193,3998)) -((-7,-1973),(-7,2598)) -1 -4371 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694737913 -1694738269 -((-23112,3798), (-5919,6198)) -((-22712,4998),(-6344,4998)) -1 -4371 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N -3 - - - - - - - - - - - -1694736839 -1694738296 --1 -((-33123,2598), (-14251,7620)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694736840 -1694738296 --1 -((-7319,12918), (7305,19590)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694737174 -1694738296 --1 -((-7319,-8645), (7305,-1973)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694737500 -1694738296 --1 -((-30613,14155), (-16761,18353)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694737695 -1694738296 --1 -((-7319,2598), (7305,7620)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - - - - - - - - -B3E491E8-925D-475B-9EB8-BA0AD948D351 -汽车型号 -car_type -1694736839 -Administrator -1694738485 -Administrator - - -3CB9BAE6-1EDA-4AF6-904B-AB486F9132B9 -Identifier_1 -Identifier_1 -1694736860 -Administrator -1694736989 -Administrator - - - - - - - - - - -E92D1D55-1085-4B59-B476-C21D6ABDE10D -1694736860 -Administrator -1694736989 -Administrator -1 - - - - - -8E7D8415-B3D3-4B26-BD4A-FDB6FCA0A6CB -1694736860 -Administrator -1694736989 -Administrator -1 - - - - - -4356909A-762A-4A5F-9A85-BEA8E676752F -1694736860 -Administrator -1694736989 -Administrator - - - - - - - -FAA32ABD-9DE4-4D30-A520-F59CDD41D524 -顾客 -customer -1694736840 -Administrator -1694738200 -Administrator - - -BBD7A7D4-3C2C-4A09-A4ED-9584163F9DD2 -Identifier_1 -Identifier_1 -1694736999 -Administrator -1694737160 -Administrator - - - - - - - - - - -4ED84CAD-5607-47B5-A404-B3E3F8CF4407 -1694736999 -Administrator -1694737160 -Administrator -1 - - - - - -1C5E1501-20A1-4A14-A1A7-CE6E48A150EB -1694736999 -Administrator -1694737160 -Administrator -1 - - - - - -FD7CAD95-E8A8-4A3E-A514-27E96F434C2C -1694736999 -Administrator -1694737160 -Administrator - - - - - -FEA6B69A-BD73-447F-9E7C-EBE4D4C76DEC -1694736999 -Administrator -1694737160 -Administrator - - - - - -D69C3C7B-C536-4691-BF93-0F0DFA78A80A -1694736999 -Administrator -1694737160 -Administrator -1 - - - - - - - -BEC62234-1771-4B7A-87F4-1350428C776E -销售员 -salesman -1694736840 -Administrator -1694738129 -Administrator - - -659FF838-E7B3-4209-996D-5F7BA41EA2EF -Identifier_1 -Identifier_1 -1694736999 -Administrator -1694737174 -Administrator - - - - - - - - - - -7884401C-690E-4A39-9E14-9710AF76F3D3 -1694736999 -Administrator -1694737174 -Administrator -1 - - - - - -CEF61124-8A54-4297-BC59-D84EBD8C3C82 -1694736999 -Administrator -1694737174 -Administrator -1 - - - - - -9251E97E-B2B8-4338-935A-EF7F744069FB -1694736999 -Administrator -1694737174 -Administrator - - - - - -57A9F5C2-285F-4EB2-B0AA-52EBE80295EC -1694736999 -Administrator -1694737174 -Administrator - - - - - -0A46F993-A8C8-4468-BDF4-FE4D86C1814A -1694736999 -Administrator -1694737174 -Administrator -1 - - - - - - - -F554247B-14B2-4A91-94EE-140843055E82 -汽车品牌 -car_brand -1694736839 -Administrator -1694737679 -Administrator - - -87EB373C-3C24-48BD-B0B9-ED6570698DFD -Identifier_1 -Identifier_1 -1694736860 -Administrator -1694737500 -Administrator - - - - - - - - - - -E995D1E7-A9E0-4AA7-A356-AC1674A41B01 -1694736860 -Administrator -1694737500 -Administrator -1 - - - - - -E4371271-58FD-4865-935C-B38078CD4855 -1694737648 -Administrator -1694737679 -Administrator -1 - - - - - - - -B99A4277-7110-4F8C-99B0-6055F777D077 -销售记录 -sale_record -1694737695 -Administrator -1694738485 -Administrator - - -9C6DC214-9326-4833-924D-8F6B570107DB -Identifier_1 -Identifier_1 -1694737696 -Administrator -1694737838 -Administrator - - - - - - - - - - -7F456E26-A6A1-4AB3-BD90-F540C4AD9E7E -1694737696 -Administrator -1694737838 -Administrator -1 - - - - - -E7B98BCF-9362-4B17-BBA3-AC12CAF6B5E5 -1694737696 -Administrator -1694737838 -Administrator -1 - - - - - -CC9E3C89-1076-4D55-B0DA-D9F7E63909DE -1694737994 -Administrator -1694738024 -Administrator -1 - - - - - - - - - -3100E5CE-9CA2-4850-82CF-E5000C2FB274 -属于 -belong -1694737557 -Administrator -1694737599 -Administrator -0,n -0,1 - - - - - - - - -EB0943BD-564E-4149-A731-B13653456998 -购买 -buy -1694737876 -Administrator -1694738200 -Administrator -0,n -0,1 - - - - - - - - -AD185B53-3D5C-4568-BE78-082778EB8321 -销售 -sale -1694737877 -Administrator -1694738129 -Administrator -0,n -0,1 - - - - - - - - -E0F65193-29F4-4EE5-BFAD-93608104A198 -售出 -work_off -1694737913 -Administrator -1694738485 -Administrator -0,n -0,1 - - - - - - - - - - -AAB13B2D-B453-422F-A0B2-C2C2D79BD61B -品牌编号 -car_brand_No -1694736860 -Administrator -1694738710 -Administrator -NO - - -1EB3552D-EAA1-4655-B128-B7695F966065 -销售员编号 -salesman_No2 -1694736999 -Administrator -1694737239 -Administrator -NO - - -12DACA4E-03F7-4ECA-AB11-F90A9F0B5839 -汽车型号编号 -car_No -1694736860 -Administrator -1694738064 -Administrator -NO - - -C9F8C315-73A6-4719-8436-129C7D10E241 -汽车型号名称 -car_name -1694736860 -Administrator -1694741355 -Administrator -VA30 -30 - - -5CF06EA2-DE89-43D6-962B-9397EBDD24B4 -汽车型号颜色 -car_color -1694736860 -Administrator -1694738064 -Administrator -A2 -2 - - -4856A83F-56F7-4B4C-A75D-2E011E5848A5 -顾客编号 -customer_No -1694736999 -Administrator -1694737160 -Administrator -NO - - -9F07B3E0-A03F-44B3-A916-48EB55E1633E -销售员姓名 -salesman_name -1694736999 -Administrator -1694737239 -Administrator -A10 -10 - - -8A6A866A-884B-4723-82DE-7BD1A46FF612 -销售员性别 -salesman_gender -1694736999 -Administrator -1694737239 -Administrator -A1 -1 - - -49D5927A-73F6-49CA-99FE-566790B7C506 -销售员年龄 -salesman_age -1694736999 -Administrator -1694737239 -Administrator -I - - -CAF76500-06BE-46FF-BD03-2CC0628A3CFE -销售员电话 -salesman_tel -1694736999 -Administrator -1694737239 -Administrator -N11 -11 - - -F2887CD5-D8EC-49B0-9545-C2A5C2BAB339 -品牌名称 -car_brand_name -1694737648 -Administrator -1694737679 -Administrator -A10 -10 - - -1C9BBE4D-DF44-4FB1-8C57-F4B19207DD5F -销售记录编号 -sale_record_No -1694737696 -Administrator -1694737838 -Administrator -NO - - -1FAE99E3-256F-4FD3-BC99-6B8A46017ACC -销售金额 -sale_fee -1694737696 -Administrator -1694737838 -Administrator -DC9,2 -9 -2 - - -082C4402-8D16-493E-9661-985DD9CBBB53 -销售日期 -sale_date -1694737994 -Administrator -1694738024 -Administrator -D - - - - -9F885925-3503-482F-A828-F32F6E47EF49 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694738296 -Administrator -1694749259 -Administrator -file:///F|/ConceptualDataModel_1.ldm -70136198-6D9C-4E51-8FB5-AED752B89C46 -5F45F978-C4F3-4E35-A3FC-AF3318663A0F -1694749266 - - - - - - - - - - \ No newline at end of file diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/ConceptualDataModel_1.ldm" "b/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/ConceptualDataModel_1.ldm" deleted file mode 100644 index 1791c1cccef98e693829c4b3c3722060d0f3ab30..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/ConceptualDataModel_1.ldm" +++ /dev/null @@ -1,2422 +0,0 @@ - - - - - - - - - -70136198-6D9C-4E51-8FB5-AED752B89C46 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694738292 -Administrator -1694741360 -Administrator -ORG {67160797-B252-4D7E-BA42-060BBF163650} -[FolderOptions] - -[FolderOptions\Common] -GenerationCheckModel=Yes -GenerationPath= -GenerationOptions= -GenerationTasks= -GenerationTargets= -GenerationSelections= - -[FolderOptions\CheckModel] - -[FolderOptions\CheckModel\Package] - -[FolderOptions\CheckModel\Package\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\GenrCircularityYes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\GenrCircularityNo] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\ShortcutUniqCode] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Package\ChildShortcut] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain] - -[FolderOptions\CheckModel\Domain\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckOtherDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity] - -[FolderOptions\CheckModel\Entity\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\MaxLen - NAME] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EmptyColl - PENTCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttNbSerials] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EmptyColl - IDTFCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EmptyCollYesYes] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttSamePrnt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttMultInhr] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttSevInhr] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\PidtfInhrAtt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute] - -[FolderOptions\CheckModel\Entity.Entity Attribute\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\AttrDiffDomn] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckOtherDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier] - -[FolderOptions\CheckModel\Entity.Identifier\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\EmptyColl - PENTCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckIncludeColl - Entt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\IdtfChildPIdtf] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship] - -[FolderOptions\CheckModel\Relationship\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshReflexiveDeptYes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshReflexiveDeptNo] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshBject] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshMany] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance] - -[FolderOptions\CheckModel\Inheritance\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\EmptyColl - CHILDCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\InhrComplete] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Replication] - -[FolderOptions\CheckModel\Replication\PartialReplication] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule] - -[FolderOptions\CheckModel\Business Rule\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\EmptyColl - OBJCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object] - -[FolderOptions\CheckModel\Extended Object\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link] - -[FolderOptions\CheckModel\Extended Link\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File] - -[FolderOptions\CheckModel\File\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckPathExists] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format] - -[FolderOptions\CheckModel\Data Format\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckDataFormatNullExpression] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes -[ModelOptions] - -[ModelOptions\Logical options] -CaseSensitive=No -DisplayName=Yes -EnableTrans=No -UseTerm=No -EnableRequirements=No -EnableFullShortcut=Yes -Notation=0 -RlshUnique=Yes -DefaultDttp= -DomnCopyDttp=Yes -DomnCopyChck=No -DomnCopyRule=No -DomnCopyExat=No -DomnCopyMand=No -DttpFullName=Yes -RlshMigrateDomain=Yes -RlshMigrateCheck=Yes -RlshMigrateRule=Yes -RlshMigrateExtd=Yes -RlshAllowNN=No -RlshGenNN=No -FKNameTemplate=%.3:PARENT%_%ATTRIBUTE% -FKNameTemplateUsage=No -RlshAsstTmpl=Each %Entity1.Name%[CRLF].if %Entity1ToEntity2RoleMandatory%[CRLF] must[CRLF].else[CRLF] may[CRLF].endif[CRLF].if %Entity1ToEntity2Role%[CRLF] %.L:Entity1ToEntity2Role%[CRLF].else[CRLF] have[CRLF].endif[CRLF].if %Entity1ToEntity2RoleMaximumCardinality%==1[CRLF].if %Entity1ToEntity2RoleMandatory%[CRLF] one and only one[CRLF].else[CRLF] at most one[CRLF].endif[CRLF].else[CRLF] one or more[CRLF].endif[CRLF].if %Entity1%==%Entity2%[CRLF] other[CRLF].endif[CRLF] %Entity2.Name%.[CRLF]Each %Entity2.Name%[CRLF].if %Entity2ToEntity1RoleMandatory%[CRLF] must[CRLF].else[CRLF] may[CRLF].endif[CRLF].if %Entity2ToEntity1Role%[CRLF] %.L:Entity2ToEntity1Role%[CRLF].else[CRLF] have[CRLF].endif[CRLF].if %Entity2ToEntity1RoleMaximumCardinality%==1[CRLF].if %Entity2ToEntity1RoleMandatory%[CRLF] one and only one[CRLF].else[CRLF] at most one[CRLF].endif[CRLF].else[CRLF] one or more[CRLF].endif[CRLF].if %Entity1%==%Entity2%[CRLF] other[CRLF].endif[CRLF] %Entity1.Name%. -RlshAsstExt= - -[ModelOptions\Logical options\NamingOptionsTemplates] - -[ModelOptions\Logical options\ClssNamingOptions] - -[ModelOptions\Logical options\ClssNamingOptions\FILO] - -[ModelOptions\Logical options\ClssNamingOptions\FILO\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FILO\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FRMEOBJ] - -[ModelOptions\Logical options\ClssNamingOptions\FRMEOBJ\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FRMEOBJ\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FRMELNK] - -[ModelOptions\Logical options\ClssNamingOptions\FRMELNK\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FRMELNK\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\DefaultClass] - -[ModelOptions\Logical options\ClssNamingOptions\DefaultClass\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\DefaultClass\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMPCKG] - -[ModelOptions\Logical options\ClssNamingOptions\LDMPCKG\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMPCKG\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMDOMN] - -[ModelOptions\Logical options\ClssNamingOptions\LDMDOMN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMDOMN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMENTT] - -[ModelOptions\Logical options\ClssNamingOptions\LDMENTT\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMENTT\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMPROP] - -[ModelOptions\Logical options\ClssNamingOptions\LDMPROP\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMPROP\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMIDTF] - -[ModelOptions\Logical options\ClssNamingOptions\LDMIDTF\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMIDTF\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMRLSH] - -[ModelOptions\Logical options\ClssNamingOptions\LDMRLSH\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMRLSH\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMINHR] - -[ModelOptions\Logical options\ClssNamingOptions\LDMINHR\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMINHR\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Generate] - -[ModelOptions\Generate\Cdm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No - -[ModelOptions\Generate\Pdm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No -BuildTrgr=No -TablePrefix= -IndxPKName=%TABLE%_PK -IndxAKName=%TABLE%_AK -IndxFKName=%REFR%_FK -IndxThreshold= -PreserveMode=Yes - - -C1FAFE38-2640-4B44-9EEF-3E65D65DCE99 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694738347 -Administrator -1694738347 -Administrator - -471B7DF8-8A02-4195-A47D-085F4495D653 -CDE44E21-9669-11D1-9914-006097355D9B - - - - -4443E36A-D2DB-4CFA-B8F5-6832AF98A475 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694741360 -Administrator -1694741360 -Administrator - -67160797-B252-4D7E-BA42-060BBF163650 -1E597170-9350-11D1-AB3C-0020AF71E433 - - - - -41D0280B-438B-4F7C-9AB2-339354200D4F -Diagram_1 -Diagram_1 -1694738296 -Administrator -1694738296 -Administrator -ORG {E2940590-3301-43ED-9D9E-BED6B151B5A0} -DAT 1694738296 -[DisplayPreferences] - -[DisplayPreferences\LDM] - -[DisplayPreferences\General] -Adjust to text=Yes -Snap Grid=No -Constrain Labels=Yes -Display Grid=No -Show Page Delimiter=No -Show Links intersections=Yes -Activate automatic link routing=Yes -Grid size=800 -Graphic unit=2 -Window color=192 192 192 -Background image= -Background mode=8 -Watermark image= -Watermark mode=8 -Show watermark on screen=No -Gradient mode=0 -Gradient end color=255 255 255 -Show Swimlane=No -SwimlaneVert=Yes -TreeVert=No -CompDark=0 - -[DisplayPreferences\Object] -Show Icon=No -Mode=2 -Trunc Length=40 -Word Length=40 -Word Text=!"#$%&')*+,-./:;=>?@\]^_`|}~ -Shortcut IntIcon=Yes -Shortcut IntLoct=Yes -Shortcut IntFullPath=No -Shortcut IntLastPackage=Yes -Shortcut ExtIcon=Yes -Shortcut ExtLoct=No -Shortcut ExtFullPath=No -Shortcut ExtLastPackage=Yes -Shortcut ExtIncludeModl=Yes -EObjShowStrn=Yes -ExtendedObject.Comment=No -ExtendedObject.IconPicture=No -ExtendedObject.TextStyle=No -ExtendedObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Object Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -ELnkShowStrn=Yes -ELnkShowName=Yes -ExtendedLink_SymbolLayout=<Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Source" >[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -FileObject.Stereotype=No -FileObject.DisplayName=Yes -FileObject.LocationOrName=No -FileObject.IconPicture=No -FileObject.TextStyle=No -FileObject.IconMode=Yes -FileObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Location" Attribute="LocationOrName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Package.Stereotype=Yes -Package.Comment=No -Package.IconPicture=No -Package.TextStyle=No -Package_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Display Model Version=Yes -Entity.Stereotype=Yes -Entity.Attributes=Yes -Entity.Attributes._Filter="All attributes" CDMPENTALL -Entity.Attributes._Columns=Stereotype IdentifierIndicator DomainOrDataType NullIndicator -Entity.Attributes._Limit=-5 -Entity.Identifiers=Yes -Entity.Identifiers._Columns=Stereotype IdentifierIndicator -Entity.Comment=No -Entity.IconPicture=No -Entity.TextStyle=No -Entity_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" Filters="&quot;All attributes&quot; CDMPENTALL &quot;&quot;\r\n&quot;Primary attributes&quot; CDMPENTPK &quot;\&quot;PIDTF \&quot;TRUE\&quot; TRUE\&quot;&quot;\r\n&quot;Identifying attributes&quot; CDMPENTIDTF &quot;\&quot;AIDF \&quot;TRUE\&quot; TRUE\&quot;&quot;" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Identifiers" Collection="Identifiers" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Relationship.Entity1ToEntity2Role=Yes -Relationship.Entity2ToEntity1RoleCardinality=No -Relationship.Entity1ToEntity2RoleDominant=Yes -Relationship.Stereotype=Yes -Relationship.DisplayName=Yes -Relationship.JoinExpression=No -Relationship.Entity2ToEntity1Role=Yes -Relationship.Entity1ToEntity2RoleCardinality=No -Relationship.Entity2ToEntity1RoleDominant=Yes -Relationship_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity1ToEntity2Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity2ToEntity1RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity1ToEntity2RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity2ToEntity1Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity1ToEntity2RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity2ToEntity1RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -Inheritance.Stereotype=Yes -Inheritance.DisplayName=Yes -Inheritance.IconPicture=No -Inheritance.TextStyle=No -Inheritance_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Association.Stereotype=Yes -Association.Comment=No -Association.Attributes=Yes -Association.Attributes._Columns=Stereotype DataType NullIndicator -Association.Attributes._Limit=-5 -Association.IconPicture=No -Association.TextStyle=No -Association_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -AssociationLink.SymbolCardinality=Yes -AssociationLink.Stereotype=Yes -AssociationLink.Role=Yes -AssociationLink_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Cardinality" Attribute="SymbolCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Role" Attribute="Role" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> - -[DisplayPreferences\Symbol] - -[DisplayPreferences\Symbol\FRMEOBJ] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=6000 -Height=2000 -Brush color=255 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=64 -Brush gradient color=192 192 192 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 255 128 128 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FRMELNK] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FILO] -OBJSTRNFont=新宋体,8,N -OBJSTRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LCNMFont=新宋体,8,N -LCNMFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3600 -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMENTT] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0, 0, 0 -EntityForeignAttributeFont=新宋体,8,N -EntityForeignAttributeFont color=0, 0, 0 -IdentifiersFont=新宋体,8,N -IdentifiersFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=176 186 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 88 74 181 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMRLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 88 74 181 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=Yes -Width=1600 -Height=1000 -Brush color=176 186 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMLINH] -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\USRDEPD] -OBJXSTRFont=新宋体,8,N -OBJXSTRFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=2 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\Free Symbol] -Free TextFont=新宋体,8,N -Free TextFont color=0 0 0 -Line style=0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ENTT] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0 0 0 -IdentifiersFont=新宋体,8,N -IdentifiersFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=176 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 170 170 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\RLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 170 170 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ASSC] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3000 -Brush color=208 208 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINK] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=Yes -Width=1600 -Height=1000 -Brush color=176 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINH] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\CDM] -(8500, 11000) -((315,354), (433,354)) --29257 --29257 - - -1694741360 -((-24887,6633), (-22487,14555)) -((-23687,14155),(-23687,7620)) -1 -4371 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694741360 -((-1207,7220), (1193,13318)) -((-7,12918),(-7,7620)) -1 -4371 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694741360 -((-1207,-2373), (1193,2998)) -((-7,-1973),(-7,2598)) -1 -4371 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694741360 -((-23112,3798), (-5944,6198)) -((-22712,4998),(-6344,4998)) -1 -4371 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694741360 --1 -((-33123,2185), (-14251,8033)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694741360 --1 -((-7319,12918), (7305,19590)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694741360 --1 -((-7319,-8645), (7305,-1973)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694741360 --1 -((-30613,14155), (-16761,18353)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694741360 --1 -((-7512,1360), (7498,8858)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - - - - - - - - -109C3E50-D484-47FF-B472-CDCE078B5E9F -汽车型号 -car_type -1694738296 -Administrator -1694738296 -Administrator -ORG {B3E491E8-925D-475B-9EB8-BA0AD948D351} -DAT 1694738296 - - -747BA1F6-F00A-4BFB-8532-6DAAAD9B2C66 -Identifier_1 -Identifier_1 -1694738296 -Administrator -1694738296 -Administrator -ORG {3CB9BAE6-1EDA-4AF6-904B-AB486F9132B9} -DAT 1694738296 - - - - - - - - - - -E083B805-1555-43FB-A245-21FB9DDD904A -汽车型号编号 -car_No -1694738296 -Administrator -1694738296 -Administrator -ORG {E92D1D55-1085-4B59-B476-C21D6ABDE10D} -DAT 1694738296 -NO -1 - - -698533E4-71EB-47B5-97DE-3244289F4966 -品牌编号 -car_brand_No -1694738296 -Administrator -1694738723 -Administrator -ORG {E995D1E7-A9E0-4AA7-A356-AC1674A41B01},{3100E5CE-9CA2-4850-82CF-E5000C2FB274} -DAT 1694738296 -I - - -E2389ED8-A4DC-481B-947B-F2D01D12C2CC -汽车型号名称 -car_name -1694738296 -Administrator -1694741360 -Administrator -ORG {8E7D8415-B3D3-4B26-BD4A-FDB6FCA0A6CB} -DAT 1694738296 -VA30 -30 -1 - - -73151ADC-3C4C-4870-9A9A-260C48501A20 -汽车型号颜色 -car_color -1694738296 -Administrator -1694738296 -Administrator -ORG {4356909A-762A-4A5F-9A85-BEA8E676752F} -DAT 1694738296 -A2 -2 - - - - -19DCC9F9-96A7-4E7C-A7A2-A368CFF05EF0 -顾客 -customer -1694738296 -Administrator -1694738296 -Administrator -ORG {FAA32ABD-9DE4-4D30-A520-F59CDD41D524} -DAT 1694738296 - - -E5B5A3A9-B178-4CFF-85FE-00C74C2B63C6 -Identifier_1 -Identifier_1 -1694738296 -Administrator -1694738296 -Administrator -ORG {BBD7A7D4-3C2C-4A09-A4ED-9584163F9DD2} -DAT 1694738296 - - - - - - - - - - -7891EB10-1362-4D3F-A71E-51B3AFBDA93B -顾客编号 -customer_No -1694738296 -Administrator -1694738296 -Administrator -ORG {4ED84CAD-5607-47B5-A404-B3E3F8CF4407} -DAT 1694738296 -NO -1 - - -CB9CBEE3-145C-46FF-AAAB-4D4C9C60E952 -销售员姓名 -salesman_name -1694738296 -Administrator -1694738296 -Administrator -ORG {1C5E1501-20A1-4A14-A1A7-CE6E48A150EB} -DAT 1694738296 -A10 -10 -1 - - -DEA42EED-B81D-45B7-A87B-D89AE494CC0D -销售员性别 -salesman_gender -1694738296 -Administrator -1694738296 -Administrator -ORG {FD7CAD95-E8A8-4A3E-A514-27E96F434C2C} -DAT 1694738296 -A1 -1 - - -711EF30D-D2CE-4EF7-89D8-020CFBD2354B -销售员年龄 -salesman_age -1694738296 -Administrator -1694738296 -Administrator -ORG {FEA6B69A-BD73-447F-9E7C-EBE4D4C76DEC} -DAT 1694738296 -I - - -40492EE3-D96F-4AF0-BE3B-2264B44D7E33 -销售员电话 -salesman_tel -1694738296 -Administrator -1694738296 -Administrator -ORG {D69C3C7B-C536-4691-BF93-0F0DFA78A80A} -DAT 1694738296 -N11 -11 -1 - - - - -BBBA04D7-A867-40D7-906B-EF637BC1C50F -销售员 -salesman -1694738296 -Administrator -1694738296 -Administrator -ORG {BEC62234-1771-4B7A-87F4-1350428C776E} -DAT 1694738296 - - -C115FB61-01C5-4EED-9987-64860B2A394D -Identifier_1 -Identifier_1 -1694738296 -Administrator -1694738296 -Administrator -ORG {659FF838-E7B3-4209-996D-5F7BA41EA2EF} -DAT 1694738296 - - - - - - - - - - -EBA0F0EB-1E74-435A-83BA-95DA9EB98B4A -销售员编号 -salesman_No2 -1694738296 -Administrator -1694738296 -Administrator -ORG {7884401C-690E-4A39-9E14-9710AF76F3D3} -DAT 1694738296 -NO -1 - - -694D9D1B-B1A0-4E1F-BA74-8F63D896AFD8 -销售员姓名 -salesman_name -1694738296 -Administrator -1694738296 -Administrator -ORG {CEF61124-8A54-4297-BC59-D84EBD8C3C82} -DAT 1694738296 -A10 -10 -1 - - -DEF33F35-3C95-4B37-880A-8DFA2DD306F8 -销售员性别 -salesman_gender -1694738296 -Administrator -1694738296 -Administrator -ORG {9251E97E-B2B8-4338-935A-EF7F744069FB} -DAT 1694738296 -A1 -1 - - -F73FADE0-A6DA-48E8-9752-45561D856A60 -销售员年龄 -salesman_age -1694738296 -Administrator -1694738296 -Administrator -ORG {57A9F5C2-285F-4EB2-B0AA-52EBE80295EC} -DAT 1694738296 -I - - -7072C517-AF02-480F-96A3-E44AF0532864 -销售员电话 -salesman_tel -1694738296 -Administrator -1694738296 -Administrator -ORG {0A46F993-A8C8-4468-BDF4-FE4D86C1814A} -DAT 1694738296 -N11 -11 -1 - - - - -3435C116-1691-490C-AB05-A96B77941291 -汽车品牌 -car_brand -1694738296 -Administrator -1694738296 -Administrator -ORG {F554247B-14B2-4A91-94EE-140843055E82} -DAT 1694738296 - - -CFA76641-932B-4B2D-ABF9-304D75D41A54 -Identifier_1 -Identifier_1 -1694738296 -Administrator -1694738296 -Administrator -ORG {87EB373C-3C24-48BD-B0B9-ED6570698DFD} -DAT 1694738296 - - - - - - - - - - -A395BBCE-31CC-4259-9738-07693A8B7483 -品牌编号 -car_brand_No -1694738296 -Administrator -1694738723 -Administrator -ORG {E995D1E7-A9E0-4AA7-A356-AC1674A41B01} -DAT 1694738296 -NO -1 - - -2C131EDD-F299-4D00-9CD8-8DC9145D8201 -品牌名称 -car_brand_name -1694738296 -Administrator -1694738296 -Administrator -ORG {E4371271-58FD-4865-935C-B38078CD4855} -DAT 1694738296 -A10 -10 -1 - - - - -92F55831-D1D8-439B-AC3B-BB564DD65B80 -销售记录 -sale_record -1694738296 -Administrator -1694738296 -Administrator -ORG {B99A4277-7110-4F8C-99B0-6055F777D077} -DAT 1694738296 - - -36A09260-7220-4A5E-A7C1-A677E336B607 -Identifier_1 -Identifier_1 -1694738296 -Administrator -1694738296 -Administrator -ORG {9C6DC214-9326-4833-924D-8F6B570107DB} -DAT 1694738296 - - - - - - - - - - -300439B3-0ED7-4993-9A85-DE4EB18BF155 -销售记录编号 -sale_record_No -1694738296 -Administrator -1694738296 -Administrator -ORG {7F456E26-A6A1-4AB3-BD90-F540C4AD9E7E} -DAT 1694738296 -NO -1 - - -F7CBA88E-53FD-4754-BF86-410BF467A12C -顾客编号 -customer_No -1694738296 -Administrator -1694738296 -Administrator -ORG {4ED84CAD-5607-47B5-A404-B3E3F8CF4407},{EB0943BD-564E-4149-A731-B13653456998} -DAT 1694738296 -I - - -D70F181E-4362-4E1D-8F46-F54462BEF7D9 -销售员编号 -salesman_No2 -1694738296 -Administrator -1694738296 -Administrator -ORG {7884401C-690E-4A39-9E14-9710AF76F3D3},{AD185B53-3D5C-4568-BE78-082778EB8321} -DAT 1694738296 -I - - -D09B60C0-14CE-4D14-8023-D41E9C7F7384 -汽车型号编号 -car_No -1694738296 -Administrator -1694738296 -Administrator -ORG {E92D1D55-1085-4B59-B476-C21D6ABDE10D},{E0F65193-29F4-4EE5-BFAD-93608104A198} -DAT 1694738296 -I - - -02E669EB-EFC7-43FB-BE01-003DBE0DA251 -销售金额 -sale_fee -1694738296 -Administrator -1694738296 -Administrator -ORG {E7B98BCF-9362-4B17-BBA3-AC12CAF6B5E5} -DAT 1694738296 -DC9,2 -9 -2 -1 - - -89B2BC3E-D610-4C9B-A940-7DF18FAC6835 -销售日期 -sale_date -1694738296 -Administrator -1694738296 -Administrator -ORG {CC9E3C89-1076-4D55-B0DA-D9F7E63909DE} -DAT 1694738296 -D -1 - - - - - - -7588B539-A397-4BF8-A7D7-2330A02EBEAA -属于 -belong -1694738296 -Administrator -1694738296 -Administrator -ORG {3100E5CE-9CA2-4850-82CF-E5000C2FB274} -DAT 1694738296 -0,n -0,1 - - - - - - - - -C820A620-1954-4C67-A1BE-C0BA1659482F -1694738296 -Administrator -1694738296 -Administrator - - - - - - - - - - - - - -D8DAA953-0FAB-4C68-94A8-8F69B09D3A72 -购买 -buy -1694738296 -Administrator -1694738296 -Administrator -ORG {EB0943BD-564E-4149-A731-B13653456998} -DAT 1694738296 -0,n -0,1 - - - - - - - - -182C7397-BF30-4C55-94AB-001C567AC5F2 -1694738296 -Administrator -1694738296 -Administrator - - - - - - - - - - - - - -AFFF1405-D75C-469F-A65F-D4A3782FDE01 -销售 -sale -1694738296 -Administrator -1694738296 -Administrator -ORG {AD185B53-3D5C-4568-BE78-082778EB8321} -DAT 1694738296 -0,n -0,1 - - - - - - - - -11ABE6E9-1D29-47B3-A893-30F4641EB87B -1694738296 -Administrator -1694738296 -Administrator - - - - - - - - - - - - - -62A80048-E7E3-4DA6-8DDA-F17CDBDCB81D -售出 -work_off -1694738296 -Administrator -1694738491 -Administrator -ORG {E0F65193-29F4-4EE5-BFAD-93608104A198} -DAT 1694738296 -0,n -0,1 - - - - - - - - -2632987C-D642-4C89-B024-0F05EEAD3416 -1694738296 -Administrator -1694738296 -Administrator - - - - - - - - - - - - - - - -AAC607D5-759F-46DA-AD65-8B063217A15A -ConceptualDataModel_1 -ConceptualDataModel_1 -1694738296 -Administrator -1694749257 -Administrator -file:///F|/ConceptualDataModel_1.cdm -67160797-B252-4D7E-BA42-060BBF163650 -1E597170-9350-11D1-AB3C-0020AF71E433 -1694749259 - - - - - -262E2CF2-4F4A-400D-BD51-9EC120952384 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694738347 -Administrator -1694749260 -Administrator -file:///F|/ConceptualDataModel_1.pdm -471B7DF8-8A02-4195-A47D-085F4495D653 -CDE44E21-9669-11D1-9914-006097355D9B -1694749264 - - - - - - - - - - \ No newline at end of file diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/ConceptualDataModel_1.pdm" "b/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/ConceptualDataModel_1.pdm" deleted file mode 100644 index 9f85dcd567e6abdc97998b012afc04b519ad36a8..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/ConceptualDataModel_1.pdm" +++ /dev/null @@ -1,5678 +0,0 @@ - - - - - - - - - -471B7DF8-8A02-4195-A47D-085F4495D653 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694738341 -Administrator -1694741364 -Administrator -ORG {70136198-6D9C-4E51-8FB5-AED752B89C46} -[FolderOptions] - -[FolderOptions\Physical Objects] -GenerationCheckModel=Yes -GenerationPath= -GenerationOptions= -GenerationTasks= -GenerationTargets= -GenerationSelections= -RevPkey=Yes -RevFkey=Yes -RevAkey=Yes -RevCheck=Yes -RevIndx=Yes -RevOpts=Yes -RevViewAsTabl=No -RevViewOpts=Yes -RevSystAsTabl=Yes -RevTablPerm=No -RevViewPerm=No -RevProcPerm=No -RevDbpkPerm=No -RevSqncPerm=No -RevAdtPerm=No -RevUserPriv=No -RevUserOpts=No -RevGrpePriv=No -RevRolePriv=No -RevDtbsOpts=Yes -RevDtbsPerm=No -RevViewIndx=Yes -RevJidxOpts=Yes -RevStats=No -RevTspcPerm=No -RevCaseSensitive=No -GenTrgrStdMsg=Yes -GenTrgrMsgTab= -GenTrgrMsgNo= -GenTrgrMsgTxt= -TrgrPreserve=No -TrgrIns=Yes -TrgrUpd=Yes -TrgrDel=Yes -TrgrC2Ins=Yes -TrgrC2Upd=Yes -TrgrC3=Yes -TrgrC4=Yes -TrgrC5=Yes -TrgrC6=Yes -TrgrC7=Yes -TrgrC8=Yes -TrgrC9=Yes -TrgrC10=Yes -TrgrC11=Yes -TrgrC1=Yes -TrgrC12Ins=Yes -TrgrC12Upd=Yes -TrgrC13=Yes -UpdateTableStatistics=Yes -UpdateColumnStatistics=Yes - -[FolderOptions\Physical Objects\Database Generation] -GenScriptName=crebas.sql -GenScriptName0= -GenScriptName1= -GenScriptName2= -GenScriptName3= -GenScriptName4= -GenScriptName5= -GenScriptName6= -GenScriptName7= -GenScriptName8= -GenScriptName9= -GenPathName=C:\Users\Administrator\Desktop\ -GenSingleFile=Yes -GenODBC=No -GenCheckModel=Yes -GenScriptPrev=Yes -GenArchiveModel=No -GenUseSync=No -GenSyncChoice=0 -GenSyncArch= -GenSyncRmg=0 - -[FolderOptions\Physical Objects\Database Generation\Format] -GenScriptTitle=Yes -GenScriptNamLabl=No -GenScriptQDtbs=No -GenScriptQOwnr=Yes -GenScriptCase=0 -GenScriptEncoding=ANSI -GenScriptNAcct=No -IdentifierDelimiter=" - -[FolderOptions\Physical Objects\Database Generation\Database] -Create=Yes -Open=Yes -Close=Yes -Drop=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Database\Create] -Physical Options=Yes -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\Tablespace] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Tablespace\Create] -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\Storage] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\User] -Create=Yes -Drop=Yes -Comment=Yes -Privilege=No - -[FolderOptions\Physical Objects\Database Generation\User\Create] -Physical Options=No - -[FolderOptions\Physical Objects\Database Generation\Group] -Create=Yes -Drop=Yes -Comment=Yes -Privilege=No - -[FolderOptions\Physical Objects\Database Generation\Role] -Create=Yes -Drop=Yes -Privilege=No - -[FolderOptions\Physical Objects\Database Generation\UserDefinedDataType] -Create=Yes -Comment=Yes -Drop=Yes - -[FolderOptions\Physical Objects\Database Generation\UserDefinedDataType\Create] -Default value=Yes -Check=Yes - -[FolderOptions\Physical Objects\Database Generation\AbstractDataType] -Create=Yes -Header=Yes -Footer=Yes -Drop=Yes -Comment=Yes -Install JAVA class=Yes -Remove JAVA class=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Rule] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Default] -Create=Yes -Comment=Yes -Drop=Yes - -[FolderOptions\Physical Objects\Database Generation\Sequence] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Table&&Column] - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Table] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Table\Create] -Check=Yes -Physical Options=Yes -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Table\Create\Check] -Constraint declaration=No - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Column] -User datatype=No -Default value=Yes -Check=Yes -Physical Options=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Column\Check] -Constraint declaration=No - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key] - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key\Primary key] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key\Primary key\Create] -Constraint declaration=No -Physical Options=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key\Alternate key] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key\Alternate key\Create] -Constraint declaration=No -Physical Options=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Foreign key] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Foreign key\Create] -Constraint declaration=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Index] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Index\Create] -Constraint declaration=Yes -Physical Options=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Index\Filter] -Primary key=No -Foreign key=No -Alternate key=No -Cluster=Yes -Other=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Trigger] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Trigger\Filter] -For insert=Yes -For update=Yes -For delete=Yes -For other=Yes - -[FolderOptions\Physical Objects\Database Generation\View] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\View\Create] -Force Column list=No -Physical Options=Yes -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\View\ViewColumn] -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\View\ViewIndex] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\View\ViewIndex\Create] -Physical Options=Yes - -[FolderOptions\Physical Objects\Database Generation\View\ViewIndex\Filter] -Cluster=Yes -Other=Yes - -[FolderOptions\Physical Objects\Database Generation\View\Trigger] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\View\Trigger\Filter] -For insert=Yes -For update=Yes -For delete=Yes -For other=Yes - -[FolderOptions\Physical Objects\Database Generation\DBMSTrigger] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Synonym] -Create=Yes -Drop=Yes - -[FolderOptions\Physical Objects\Database Generation\Synonym\Filter] -Table=Yes -View=Yes -Proc=Yes -Synonym=Yes -Database Package=Yes -Sequence=Yes - -[FolderOptions\Physical Objects\Database Generation\JoinIndex] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\JoinIndex\Create] -Physical Options=Yes -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\Procedure] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Procedure\Create] -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\DatabasePackage] -Create=Yes -Drop=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\WebService] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Dimension] -Create=Yes -Drop=Yes - -[FolderOptions\Physical Objects\Database Generation\Synchronization] -GenBackupTabl=1 -GenKeepBackTabl=1 -GenTmpTablDrop=No -GenKeepTablOpts=No - -[FolderOptions\Physical Objects\Test Data] -GenDataPathName= -GenDataSinglefile=Yes -GenDataScriptName=testdata -GenDataScriptName0= -GenDataScriptName1= -GenDataScriptName2= -GenDataScriptName3= -GenDataScriptName4= -GenDataScriptName5= -GenDataScriptName6= -GenDataScriptName7= -GenDataScriptName8= -GenDataScriptName9= -GenDataOdbc=0 -GenDataDelOld=No -GenDataTitle=No -GenDataDefNumRows=20 -GenDataCommit=0 -GenDataPacket=0 -GenDataOwner=No -GenDataProfNumb= -GenDataProfChar= -GenDataProfDate= -GenDataCSVSeparator=, -GenDataFileFormat=CSV -GenDataUseWizard=No - -[FolderOptions\Pdm] -IndxIQName=%COLUMN%_%INDEXTYPE% -IndxPK=Yes -IndxFK=Yes -IndxAK=Yes -IndxPKName=%TABLE%_PK -IndxFKName=%REFR%_FK -IndxAKName=%TABLE%_AK -IndxPreserve=Yes -IndxThreshold=0 -IndxStats=No -RefrPreserve=No -JidxPreserve=No -RbldMultiFact=Yes -RbldMultiDim=Yes -RbldMultiJidx=Yes -CubePreserve=No -TablStProcPreserve=No -ProcDepPreserve=Yes -TrgrDepPreserve=Yes -CubeScriptPath= -CubeScriptCase=0 -CubeScriptEncoding=ANSI -CubeScriptNacct=No -CubeScriptHeader=No -CubeScriptExt=csv -CubeScriptExt0=txt -CubeScriptExt1= -CubeScriptExt2= -CubeScriptSep=, -CubeScriptDeli=" -EstimationYears=0 -DfltDomnName=D_%.U:VALUE% -DfltColnName=D_%.U:VALUE% -DfltReuse=Yes -DfltDrop=Yes - -[FolderOptions\CheckModel] - -[FolderOptions\CheckModel\Package] - -[FolderOptions\CheckModel\Package\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CircularReference] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\ConstraintName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CnstMaxLen] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CircularDependency] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\ShortcutUniqCode] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Table] - -[FolderOptions\CheckModel\Table\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\UniqIndex] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\MaxLen - NAME] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\EmptyColl - COLNCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\EmptyColl - INDXCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\EmptyColl - KEYCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\SerialColumnNumber] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\EmptyCollYesYes] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\TableIndexes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\Mapping] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\MappingSFMap] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\EmptyColl - PERMCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Table\CheckTablePartitionKey] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckTableStartDate] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckTableRefNoLifecycle] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckTableSourceMapping] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckTablePartialColumnMapping] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckTableKeyColumnMapping] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckTableNotOnLifecycleTablespace] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\MYSQL50_Table_Table_storage_type] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column] - -[FolderOptions\CheckModel\Table.Column\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\DomainDivergence] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\ColumnMandatory] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\FkeyDttpDivergence] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\FkeyCheckDivergence] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\ColnSqncNoKey] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\ColnSqncDttp] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\SerialColumnFK] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\ColumnCompExpr] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckColumnOneToOneMapping] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckColumnDataTypeMapping] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckColumnNoMapping] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\MYSQL50_Column_Auto_increment_key] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\MYSQL50_Column_Datatype_attributes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index] - -[FolderOptions\CheckModel\Table.Index\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\EmptyColl - CIDXCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\UndefIndexType] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\IndexColumnCount] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\IQIndxHNGUniq] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\CheckIncludeColl - Tabl] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\MYSQL50_Index_Fulltext_indexes_validity] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key] - -[FolderOptions\CheckModel\Table.Key\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\EmptyColl - COLNCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\CheckIncludeColl - Tabl] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\MultiKeySqnc] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger] - -[FolderOptions\CheckModel\Table.Trigger\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index] - -[FolderOptions\CheckModel\Join Index\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View] - -[FolderOptions\CheckModel\View\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\EmptyColl - PERMCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\View.View Index] - -[FolderOptions\CheckModel\View.View Index\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\EmptyColl - CIDXCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\IndexColumnCount] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\CheckIncludeColl - Tabl] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference] - -[FolderOptions\CheckModel\Reference\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\Reflexive] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\EmptyColl - RFJNCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\IncompleteJoin] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\JoinOrder] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference] - -[FolderOptions\CheckModel\View Reference\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\EmptyColl - VRFJNCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain] - -[FolderOptions\CheckModel\Domain\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default] - -[FolderOptions\CheckModel\Default\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\DfltValeEmpty] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\DfltSameVale] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User] - -[FolderOptions\CheckModel\User\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\UniquePassword] -CheckSeverity=No -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Group] - -[FolderOptions\CheckModel\Group\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\EmptyColl - USERCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\UniquePassword] -CheckSeverity=No -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Role] - -[FolderOptions\CheckModel\Role\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\EmptyColl - USERCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure] - -[FolderOptions\CheckModel\Procedure\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\ProcBodyEmpty] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\EmptyColl - PERMCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\DBMS Trigger] - -[FolderOptions\CheckModel\DBMS Trigger\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\DbmsTriggerEvent] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source] - -[FolderOptions\CheckModel\Data Source\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\EmptyColl - MODLSRC] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\DtscTargets] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\CheckDataSourceModels] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Horizontal Partitioning] - -[FolderOptions\CheckModel\Horizontal Partitioning\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Horizontal Partitioning\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Horizontal Partitioning\EmptyColl - PARTCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Horizontal Partitioning\TargetTables] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Vertical Partitioning] - -[FolderOptions\CheckModel\Vertical Partitioning\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Vertical Partitioning\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Vertical Partitioning\EmptyColl - PARTCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Vertical Partitioning\TargetTables] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table Collapsing] - -[FolderOptions\CheckModel\Table Collapsing\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table Collapsing\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table Collapsing\EmptyColl - TargetTable] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table Collapsing\TargetTables] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact] - -[FolderOptions\CheckModel\Fact\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\EmptyColl - MEASCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\Mapping] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\MappingSFMap] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\EmptyColl - ALLOLINKCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\CubeDupAssociation] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension] - -[FolderOptions\CheckModel\Dimension\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\EmptyColl - DATTRCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\EmptyColl - HIERCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\DimnDupHierarchy] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\DimnDefHierarchy] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\Mapping] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\MappingSFMap] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\SerialColumnNumber] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association] - -[FolderOptions\CheckModel\Association\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\EmptyColl - Hierarchy] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute] - -[FolderOptions\CheckModel\Dimension.Attribute\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure] - -[FolderOptions\CheckModel\Fact.Measure\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy] - -[FolderOptions\CheckModel\Dimension.Hierarchy\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\EmptyColl - DATTRCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym] - -[FolderOptions\CheckModel\Synonym\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\MaxLen - NAME] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\EmptyColl - BASEOBJ] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type] - -[FolderOptions\CheckModel\Abstract Data Type\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\AdtInstantiable] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\AdtAbstractUsed] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure] - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\AdtProcUniqName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\UniqueDefinition] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\ReturnDataType] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package] - -[FolderOptions\CheckModel\Database Package\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\MaxLen - NAME] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\EmptyColl - PROCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\EmptyColl - CURCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Database Package\EmptyColl - VARCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Database Package\EmptyColl - TYPCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Database Package\EmptyColl - EXCCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Database Package.Database Package Procedure] - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\UniqueDefinition] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\EmptyColl - PARM] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\ReturnDataType] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence] - -[FolderOptions\CheckModel\Sequence\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor] - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\UniqueDefinition] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\ReturnDataType] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\EmptyColl - PARM] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Database Package.Database Package Variable] - -[FolderOptions\CheckModel\Database Package.Database Package Variable\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type] - -[FolderOptions\CheckModel\Database Package.Database Package Type\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\UniqueDefinition] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception] - -[FolderOptions\CheckModel\Database Package.Database Package Exception\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace] - -[FolderOptions\CheckModel\Tablespace\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\IsObjectUsed] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage] - -[FolderOptions\CheckModel\Storage\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\IsObjectUsed] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database] - -[FolderOptions\CheckModel\Database\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\IsObjectUsed] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service] - -[FolderOptions\CheckModel\Web Service\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation] - -[FolderOptions\CheckModel\Web Service.Web Operation\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle] - -[FolderOptions\CheckModel\Lifecycle\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\CheckLifecyclePhase] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\CheckLifecycleRetention] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\CheckPartitionRange] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase] - -[FolderOptions\CheckModel\Lifecycle.Phase\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseTbspace] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseIQTbspace] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseDuplicateTbspace] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseTbspaceCurrency] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseRetention] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseIdlePeriod] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseDataSource] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseExternalOnFirst] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Replication] - -[FolderOptions\CheckModel\Replication\PartialReplication] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule] - -[FolderOptions\CheckModel\Business Rule\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\EmptyColl - OBJCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object] - -[FolderOptions\CheckModel\Extended Object\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link] - -[FolderOptions\CheckModel\Extended Link\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File] - -[FolderOptions\CheckModel\File\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckPathExists] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format] - -[FolderOptions\CheckModel\Data Format\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckDataFormatNullExpression] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes -[ModelOptions] - -[ModelOptions\Physical Objects] -CaseSensitive=No -DisplayName=Yes -EnableTrans=No -UseTerm=No -EnableRequirements=No -EnableFullShortcut=Yes -DefaultDttp= -IgnoreOwner=No -RebuildTrigger=Yes -RefrUnique=Yes -RefrAutoMigrate=Yes -RefrMigrateReuse=Yes -RefrMigrateDomain=Yes -RefrMigrateCheck=Yes -RefrMigrateRule=Yes -RefrMigrateExtd=No -RefrMigrDefaultLink=No -RefrDfltImpl=D -RefrPrgtColn=No -RefrMigrateToEnd=No -RebuildTriggerDep=No -ColnFKName=%.3:PARENT%_%COLUMN% -ColnFKNameUse=No -DomnCopyDttp=Yes -DomnCopyChck=No -DomnCopyRule=No -DomnCopyMand=No -DomnCopyExtd=No -DomnCopyProf=No -Notation=0 -DomnDefaultMandatory=No -ColnDefaultMandatory=No -TablDefaultOwner= -ViewDefaultOwner= -TrgrDefaultOwnerTabl= -TrgrDefaultOwnerView= -IdxDefaultOwnerTabl= -IdxDefaultOwnerView= -JdxDefaultOwner= -DBPackDefaultOwner= -SeqDefaultOwner= -ProcDefaultOwner= -DBMSTrgrDefaultOwner= -Currency=USD -RefrDeleteConstraint=1 -RefrUpdateConstraint=1 -RefrParentMandatory=No -RefrParentChangeAllow=Yes -RefrCheckOnCommit=No - -[ModelOptions\Physical Objects\NamingOptionsTemplates] - -[ModelOptions\Physical Objects\ClssNamingOptions] - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMPCKG] - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMPCKG\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMPCKG\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMDOMN] - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMDOMN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMDOMN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\TABL] - -[ModelOptions\Physical Objects\ClssNamingOptions\TABL\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\TABL\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\COLN] - -[ModelOptions\Physical Objects\ClssNamingOptions\COLN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\COLN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\INDX] - -[ModelOptions\Physical Objects\ClssNamingOptions\INDX\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\INDX\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\REFR] - -[ModelOptions\Physical Objects\ClssNamingOptions\REFR\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\REFR\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VREF] - -[ModelOptions\Physical Objects\ClssNamingOptions\VREF\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VREF\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEW] - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEW\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEW\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEWC] - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEWC\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEWC\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBSERV] - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBSERV\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBSERV\Code] -Template= -MaxLen=254 -Case=M -ValidChar='a'-'z','A'-'Z','0'-'9',"/-_.!~*'()" -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBOP] - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBOP\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBOP\Code] -Template= -MaxLen=254 -Case=M -ValidChar='a'-'z','A'-'Z','0'-'9',"/-_.!~*'()" -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WPARAM] - -[ModelOptions\Physical Objects\ClssNamingOptions\WPARAM\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WPARAM\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FACT] - -[ModelOptions\Physical Objects\ClssNamingOptions\FACT\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FACT\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DIMN] - -[ModelOptions\Physical Objects\ClssNamingOptions\DIMN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DIMN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\MEAS] - -[ModelOptions\Physical Objects\ClssNamingOptions\MEAS\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\MEAS\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DATTR] - -[ModelOptions\Physical Objects\ClssNamingOptions\DATTR\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DATTR\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FILO] - -[ModelOptions\Physical Objects\ClssNamingOptions\FILO\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FILO\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMEOBJ] - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMEOBJ\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMEOBJ\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMELNK] - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMELNK\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMELNK\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DefaultClass] - -[ModelOptions\Physical Objects\ClssNamingOptions\DefaultClass\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DefaultClass\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Connection] - -[ModelOptions\Pdm] - -[ModelOptions\Generate] - -[ModelOptions\Generate\Xsm] -GenRootElement=Yes -GenComplexType=No -GenAttribute=Yes -CheckModel=Yes -SaveLinks=Yes -ORMapping=No -NameToCode=No - -[ModelOptions\Generate\Pdm] -RRMapping=No - -[ModelOptions\Generate\Cdm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No -Notation=2 - -[ModelOptions\Generate\Oom] -CheckModel=Yes -SaveLinks=Yes -ORMapping=No -NameToCode=Yes -ClassPrefix= - -[ModelOptions\Generate\Ldm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No - -[ModelOptions\Default Opts] - -[ModelOptions\Default Opts\TABL] -PhysOpts= - -[ModelOptions\Default Opts\COLN] -PhysOpts= - -[ModelOptions\Default Opts\INDX] -PhysOpts= - -[ModelOptions\Default Opts\AKEY] -PhysOpts= - -[ModelOptions\Default Opts\PKEY] -PhysOpts= - -[ModelOptions\Default Opts\STOR] -PhysOpts= - -[ModelOptions\Default Opts\TSPC] -PhysOpts= - -[ModelOptions\Default Opts\SQNC] -PhysOpts= - -[ModelOptions\Default Opts\DTBS] -PhysOpts= - -[ModelOptions\Default Opts\USER] -PhysOpts= - -[ModelOptions\Default Opts\JIDX] -PhysOpts= - - -ABF9C16C-0D43-4827-AC02-7562122F21DD -ConceptualDataModel_1 -ConceptualDataModel_1 -1694741365 -Administrator -1694741365 -Administrator - -70136198-6D9C-4E51-8FB5-AED752B89C46 -5F45F978-C4F3-4E35-A3FC-AF3318663A0F - - - - -BF26B268-09E7-4400-98AE-A4D2AE434F69 -MySQL 5.0 -MYSQL50 -1694738344 -Administrator -1694738344 -Administrator - -F4F16ECD-F2F1-4006-AF6F-638D5C65F35E -4BA9F647-DAB1-11D1-9944-006097355D9B - - - - -6EAD8B1D-0F1B-4DA4-B955-7409CFBEE84D -Diagram_1 -Diagram_1 -1694738346 -Administrator -1694738346 -Administrator -ORG {41D0280B-438B-4F7C-9AB2-339354200D4F} -DAT 1694738347 -ORG {E2940590-3301-43ED-9D9E-BED6B151B5A0} -DAT 1694738296 -[DisplayPreferences] - -[DisplayPreferences\PDM] - -[DisplayPreferences\General] -Adjust to text=Yes -Snap Grid=No -Constrain Labels=Yes -Display Grid=No -Show Page Delimiter=No -Show Links intersections=Yes -Activate automatic link routing=Yes -Grid size=800 -Graphic unit=2 -Window color=192 192 192 -Background image= -Background mode=8 -Watermark image= -Watermark mode=8 -Show watermark on screen=No -Gradient mode=0 -Gradient end color=255 255 255 -Show Swimlane=No -SwimlaneVert=Yes -TreeVert=No -CompDark=0 - -[DisplayPreferences\Object] -Show Icon=No -Mode=2 -Trunc Length=40 -Word Length=40 -Word Text=!"#$%&')*+,-./:;=>?@\]^_`|}~ -Shortcut IntIcon=Yes -Shortcut IntLoct=Yes -Shortcut IntFullPath=No -Shortcut IntLastPackage=Yes -Shortcut ExtIcon=Yes -Shortcut ExtLoct=No -Shortcut ExtFullPath=No -Shortcut ExtLastPackage=Yes -Shortcut ExtIncludeModl=Yes -EObjShowStrn=Yes -ExtendedObject.Comment=No -ExtendedObject.IconPicture=No -ExtendedObject.TextStyle=No -ExtendedObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Object Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -ELnkShowStrn=Yes -ELnkShowName=Yes -ExtendedLink_SymbolLayout=<Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Source" >[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -FileObject.Stereotype=No -FileObject.DisplayName=Yes -FileObject.LocationOrName=No -FileObject.IconPicture=No -FileObject.TextStyle=No -FileObject.IconMode=Yes -FileObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Location" Attribute="LocationOrName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Package.Stereotype=Yes -Package.Comment=No -Package.IconPicture=No -Package.TextStyle=No -Package_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Display Model Version=Yes -Table.Stereotype=Yes -Table.DisplayName=Yes -Table.OwnerDisplayName=No -Table.Columns=Yes -Table.Columns._Filter="All Columns" PDMCOLNALL -Table.Columns._Columns=Stereotype IdentifierIndicator DomainOrDataType NullIndicator -Table.Columns._Limit=-5 -Table.Keys=No -Table.Keys._Columns=Stereotype Indicator -Table.Indexes=No -Table.Indexes._Columns=Stereotype -Table.Triggers=No -Table.Triggers._Columns=Stereotype -Table.Comment=No -Table.IconPicture=No -Table.TextStyle=No -Table_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Owner and Name" Attribute="OwnerDisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Columns" Collection="Columns" Columns="Stereotype No\r\nDisplayName Yes\r\nDataType No\r\nSymbolDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nKeyIndicator No\r\nIndexIndicator No\r\nNullStatus No" Filters="&quot;All Columns&quot; PDMCOLNALL &quot;&quot;\r\n&quot;PK Columns&quot; PDMCOLNPK &quot;\&quot;PRIM \&quot;TRUE\&quot; TRUE\&quot;&quot;\r\n&quot;Key Columns&quot; PDMCOLNKEY &quot;\&quot;KEYS \&quot;TRUE\&quot; TRUE\&quot;&quot;" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Keys" Collection="Keys" Columns="Stereotype No\r\nDisplayName Yes\r\nIndicator No" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Indexes" Collection="Indexes" Columns="Stereotype No\r\nDisplayName Yes\r\nIndicator No" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Triggers" Collection="Triggers" Columns="Stereotype No\r\nDisplayName Yes" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -View.Stereotype=Yes -View.DisplayName=Yes -View.OwnerDisplayName=No -View.Columns=Yes -View.Columns._Columns=DisplayName -View.Columns._Limit=-5 -View.TemporaryVTables=Yes -View.Indexes=No -View.Comment=No -View.IconPicture=No -View.TextStyle=No -View_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Owner and Name" Attribute="OwnerDisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Columns" Collection="Columns" Columns="DisplayName No\r\nExpression No\r\nDataType No\r\nSymbolDataType No &quot;Domain or Data type&quot;\r\nIndexIndicator No" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Tables" Collection="TemporaryVTables" Columns="Name Yes" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Indexes" Collection="Indexes" Columns="DisplayName Yes" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Procedure.Stereotype=No -Procedure.DisplayName=Yes -Procedure.OwnerDisplayName=No -Procedure.Comment=No -Procedure.IconPicture=No -Procedure.TextStyle=No -Procedure_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Owner and Name" Attribute="OwnerDisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Reference.Cardinality=No -Reference.ImplementationType=No -Reference.ChildRole=Yes -Reference.Stereotype=Yes -Reference.DisplayName=Yes -Reference.ForeignKeyConstraintName=No -Reference.JoinExpression=No -Reference.Integrity=No -Reference.ParentRole=Yes -Reference_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Cardinality" Attribute="Cardinality" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Implementation" Attribute="ImplementationType" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Child Role" Attribute="ChildRole" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="No" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Cons&amp;traint Name" Attribute="ForeignKeyConstraintName" Prefix="" Suffix="" Caption="Cons&amp;traint Name" Mandatory="No" />[CRLF] <StandardAttribute Name="Join" Attribute="JoinExpression" Prefix="" Suffix="" Caption="Join" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <StandardAttribute Name="Referential integrity" Attribute="Integrity" Prefix="" Suffix="" Caption="Referential integrity" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Parent Role" Attribute="ParentRole" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -ViewReference.ChildRole=Yes -ViewReference.Stereotype=Yes -ViewReference.DisplayName=No -ViewReference.JoinExpression=No -ViewReference.ParentRole=Yes -ViewReference_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Child Role" Attribute="ChildRole" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="No" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Join Expression" Attribute="JoinExpression" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Parent Role" Attribute="ParentRole" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -Entity.Stereotype=Yes -Entity.Attributes=Yes -Entity.Attributes._Filter="All attributes" CDMPENTALL -Entity.Attributes._Columns=Stereotype IdentifierIndicator DomainOrDataType NullIndicator -Entity.Attributes._Limit=-5 -Entity.Identifiers=Yes -Entity.Identifiers._Columns=Stereotype IdentifierIndicator -Entity.Comment=No -Entity.IconPicture=No -Entity.TextStyle=No -Entity_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" Filters="&quot;All attributes&quot; CDMPENTALL &quot;&quot;\r\n&quot;Primary attributes&quot; CDMPENTPK &quot;\&quot;PIDTF \&quot;TRUE\&quot; TRUE\&quot;&quot;\r\n&quot;Identifying attributes&quot; CDMPENTIDTF &quot;\&quot;AIDF \&quot;TRUE\&quot; TRUE\&quot;&quot;" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Identifiers" Collection="Identifiers" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Relationship.Entity1ToEntity2Role=Yes -Relationship.Entity2ToEntity1RoleCardinality=No -Relationship.Entity1ToEntity2RoleDominant=Yes -Relationship.Stereotype=Yes -Relationship.DisplayName=Yes -Relationship.JoinExpression=No -Relationship.Entity2ToEntity1Role=Yes -Relationship.Entity1ToEntity2RoleCardinality=No -Relationship.Entity2ToEntity1RoleDominant=Yes -Relationship_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity1ToEntity2Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity2ToEntity1RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity1ToEntity2RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity2ToEntity1Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity1ToEntity2RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity2ToEntity1RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -Inheritance.Stereotype=Yes -Inheritance.DisplayName=Yes -Inheritance.IconPicture=No -Inheritance.TextStyle=No -Inheritance_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Association.Stereotype=Yes -Association.Comment=No -Association.Attributes=Yes -Association.Attributes._Columns=Stereotype DataType NullIndicator -Association.Attributes._Limit=-5 -Association.IconPicture=No -Association.TextStyle=No -Association_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -AssociationLink.SymbolCardinality=Yes -AssociationLink.Stereotype=Yes -AssociationLink.Role=Yes -AssociationLink_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Cardinality" Attribute="SymbolCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Role" Attribute="Role" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> - -[DisplayPreferences\Symbol] - -[DisplayPreferences\Symbol\FRMEOBJ] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=6000 -Height=2000 -Brush color=255 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=64 -Brush gradient color=192 192 192 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 255 128 128 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FRMELNK] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FILO] -OBJSTRNFont=新宋体,8,N -OBJSTRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LCNMFont=新宋体,8,N -LCNMFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3600 -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\PDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\TABL] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -OWNRDISPNAMEFont=新宋体,8,N -OWNRDISPNAMEFont color=0, 0, 0 -ColumnsFont=新宋体,8,N -ColumnsFont color=0, 0, 0 -TablePkColumnsFont=新宋体,8,U -TablePkColumnsFont color=0, 0, 0 -TableFkColumnsFont=新宋体,8,N -TableFkColumnsFont color=0, 0, 0 -KeysFont=新宋体,8,N -KeysFont color=0, 0, 0 -IndexesFont=新宋体,8,N -IndexesFont color=0, 0, 0 -TriggersFont=新宋体,8,N -TriggersFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=178 214 252 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 128 192 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\VIEW] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -OWNRDISPNAMEFont=新宋体,8,N -OWNRDISPNAMEFont color=0, 0, 0 -ColumnsFont=新宋体,8,N -ColumnsFont color=0, 0, 0 -TablePkColumnsFont=新宋体,8,U -TablePkColumnsFont color=0, 0, 0 -TableFkColumnsFont=新宋体,8,N -TableFkColumnsFont color=0, 0, 0 -TemporaryVTablesFont=新宋体,8,N -TemporaryVTablesFont color=0, 0, 0 -IndexesFont=新宋体,8,N -IndexesFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=208 208 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 192 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\PROC] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -OWNRDISPNAMEFont=新宋体,8,N -OWNRDISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4000 -Height=1000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 108 0 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\REFR] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 128 192 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\VREF] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 192 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\USRDEPD] -OBJXSTRFont=新宋体,8,N -OBJXSTRFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=2 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\Free Symbol] -Free TextFont=新宋体,8,N -Free TextFont color=0 0 0 -Line style=0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMENTT] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0, 0, 0 -EntityForeignAttributeFont=新宋体,8,N -EntityForeignAttributeFont color=0, 0, 0 -IdentifiersFont=新宋体,8,N -IdentifiersFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=176 186 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 88 74 181 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMRLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 88 74 181 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=Yes -Width=1600 -Height=1000 -Brush color=176 186 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMLINH] -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ENTT] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0 0 0 -IdentifiersFont=新宋体,8,N -IdentifiersFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=176 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 170 170 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\RLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 170 170 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ASSC] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3000 -Brush color=208 208 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINK] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=Yes -Width=1600 -Height=1000 -Brush color=176 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINH] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\LDM] - -[DisplayPreferences\CDM] -(8500, 11000) -((315,354), (433,354)) --29257 --29257 - - -1694741364 -((-24624,4709), (-22750,16654)) -((-23687,5109),(-23687,16254)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694741364 -((-944,7220), (930,16654)) -((-7,7620),(-7,16254)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694741364 -((-944,-5709), (930,2998)) -((-7,2598),(-7,-5309)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694741364 -((-23112,4428), (393,5949)) -((-7,5053),(-22712,5053)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694741365 --1 -((-26210,2747), (-21164,7471)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694741365 --1 -((-2407,13480), (2393,19028)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694741365 --1 -((-2407,-8083), (2393,-2535)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694741365 --1 -((-26087,14254), (-21287,18254)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694741365 --1 -((-2530,1922), (2516,8296)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - - - - - - - - -551AFCD6-3F14-456E-B508-EDB0C49006EF -汽车型号 -car_type -1694738346 -Administrator -1694738347 -Administrator -ORG {109C3E50-D484-47FF-B472-CDCE078B5E9F} -DAT 1694738347 -ORG {B3E491E8-925D-475B-9EB8-BA0AD948D351} -DAT 1694738296 - - - -CB9D2F55-6D2E-4939-A1F2-F6BEE5DC5DF3 -汽车型号编号 -car_No -1694738346 -Administrator -1694738346 -Administrator -ORG {E083B805-1555-43FB-A245-21FB9DDD904A} -DAT 1694738347 -ORG {E92D1D55-1085-4B59-B476-C21D6ABDE10D} -DAT 1694738296 -int -1 -1 - - -559C55DD-C483-45E6-A176-9FFDF0696A31 -品牌编号 -car_brand_No -1694738346 -Administrator -1694738727 -Administrator -ORG {698533E4-71EB-47B5-97DE-3244289F4966} -DAT 1694738347 -ORG {E995D1E7-A9E0-4AA7-A356-AC1674A41B01},{3100E5CE-9CA2-4850-82CF-E5000C2FB274} -DAT 1694738296 -int - - -964EEBFC-9B58-41AD-882B-E69C8630A618 -汽车型号名称 -car_name -1694738346 -Administrator -1694741364 -Administrator -ORG {E2389ED8-A4DC-481B-947B-F2D01D12C2CC} -DAT 1694738347 -ORG {8E7D8415-B3D3-4B26-BD4A-FDB6FCA0A6CB} -DAT 1694738296 -varchar(30) -30 -1 - - -319264BC-943B-4D70-A299-D148DCFC03C0 -汽车型号颜色 -car_color -1694738346 -Administrator -1694738346 -Administrator -ORG {73151ADC-3C4C-4870-9A9A-260C48501A20} -DAT 1694738347 -ORG {4356909A-762A-4A5F-9A85-BEA8E676752F} -DAT 1694738296 -char(2) -2 - - - - -40BCB011-3F18-4488-9B44-E2BC8E9133BD -Identifier_1 -Identifier_1 -1694738346 -Administrator -1694738346 -Administrator -ORG {747BA1F6-F00A-4BFB-8532-6DAAAD9B2C66} -DAT 1694738347 -ORG {3CB9BAE6-1EDA-4AF6-904B-AB486F9132B9} -DAT 1694738296 - - - - - - - -A1E87AF7-53CF-4D2C-901E-B5BE2BE488CA -car_type_PK -car_type_PK -1694738347 -Administrator -1694738347 -Administrator -1 - - - - - -367E7ED3-B7D7-4F62-85A7-1799B61D71BB -1694738347 -Administrator -1694738347 -Administrator - - - - - - - -755ABD07-C78B-4629-9BCD-2932867AA17E -belong_FK -belong_FK -1694738347 -Administrator -1694738347 -Administrator - - - - - -53948EE5-8B78-4F25-A9C9-0B97A806F8E8 -1694738347 -Administrator -1694738347 -Administrator - - - - - - - - - - - - -B3B03EAC-9FD9-4180-B126-8FD8F4C34B25 -顾客 -customer -1694738346 -Administrator -1694738347 -Administrator -ORG {19DCC9F9-96A7-4E7C-A7A2-A368CFF05EF0} -DAT 1694738347 -ORG {FAA32ABD-9DE4-4D30-A520-F59CDD41D524} -DAT 1694738296 - - - -D8FCB00C-7D37-4E60-AD7D-39956FB5F328 -顾客编号 -customer_No -1694738346 -Administrator -1694738346 -Administrator -ORG {7891EB10-1362-4D3F-A71E-51B3AFBDA93B} -DAT 1694738347 -ORG {4ED84CAD-5607-47B5-A404-B3E3F8CF4407} -DAT 1694738296 -int -1 -1 - - -708A0D9F-B70C-48CD-95CE-6BFD26260217 -销售员姓名 -salesman_name -1694738346 -Administrator -1694738346 -Administrator -ORG {CB9CBEE3-145C-46FF-AAAB-4D4C9C60E952} -DAT 1694738347 -ORG {1C5E1501-20A1-4A14-A1A7-CE6E48A150EB} -DAT 1694738296 -char(10) -10 -1 - - -76CE374B-D754-4E00-A81B-B66E12B1B49D -销售员性别 -salesman_gender -1694738346 -Administrator -1694738346 -Administrator -ORG {DEA42EED-B81D-45B7-A87B-D89AE494CC0D} -DAT 1694738347 -ORG {FD7CAD95-E8A8-4A3E-A514-27E96F434C2C} -DAT 1694738296 -char(1) -1 - - -CE04DB55-4C8B-4024-B9EF-A9ED20AB059C -销售员年龄 -salesman_age -1694738346 -Administrator -1694738346 -Administrator -ORG {711EF30D-D2CE-4EF7-89D8-020CFBD2354B} -DAT 1694738347 -ORG {FEA6B69A-BD73-447F-9E7C-EBE4D4C76DEC} -DAT 1694738296 -int - - -AA2DC6B4-EDC8-4BA3-A084-42C670AA69E1 -销售员电话 -salesman_tel -1694738346 -Administrator -1694738346 -Administrator -ORG {40492EE3-D96F-4AF0-BE3B-2264B44D7E33} -DAT 1694738347 -ORG {D69C3C7B-C536-4691-BF93-0F0DFA78A80A} -DAT 1694738296 -numeric(11,0) -11 -1 - - - - -BC71C81F-C697-4B22-8B48-A9FC5586146F -Identifier_1 -Identifier_1 -1694738346 -Administrator -1694738346 -Administrator -ORG {E5B5A3A9-B178-4CFF-85FE-00C74C2B63C6} -DAT 1694738347 -ORG {BBD7A7D4-3C2C-4A09-A4ED-9584163F9DD2} -DAT 1694738296 - - - - - - - -15284EEA-0B73-4FA5-BE4F-AA029050D137 -customer_PK -customer_PK -1694738347 -Administrator -1694738347 -Administrator -1 - - - - - -B75E8F08-2A76-488A-986D-70FE856E677F -1694738347 -Administrator -1694738347 -Administrator - - - - - - - - - - - - -1E40D661-FEFB-4B7E-8224-EA0AF7DBA32D -销售员 -salesman -1694738346 -Administrator -1694738347 -Administrator -ORG {BBBA04D7-A867-40D7-906B-EF637BC1C50F} -DAT 1694738347 -ORG {BEC62234-1771-4B7A-87F4-1350428C776E} -DAT 1694738296 - - - -E5CABBDC-2945-458B-9898-DE59EFF439F1 -销售员编号 -salesman_No2 -1694738346 -Administrator -1694738346 -Administrator -ORG {EBA0F0EB-1E74-435A-83BA-95DA9EB98B4A} -DAT 1694738347 -ORG {7884401C-690E-4A39-9E14-9710AF76F3D3} -DAT 1694738296 -int -1 -1 - - -990FADC2-1349-49A3-8120-D94004006CF9 -销售员姓名 -salesman_name -1694738346 -Administrator -1694738346 -Administrator -ORG {694D9D1B-B1A0-4E1F-BA74-8F63D896AFD8} -DAT 1694738347 -ORG {CEF61124-8A54-4297-BC59-D84EBD8C3C82} -DAT 1694738296 -char(10) -10 -1 - - -33CDE1BC-359C-434E-A4EF-9C7571063629 -销售员性别 -salesman_gender -1694738346 -Administrator -1694738346 -Administrator -ORG {DEF33F35-3C95-4B37-880A-8DFA2DD306F8} -DAT 1694738347 -ORG {9251E97E-B2B8-4338-935A-EF7F744069FB} -DAT 1694738296 -char(1) -1 - - -EB44D5C9-F037-4DC1-B6EC-983F41EA1A0A -销售员年龄 -salesman_age -1694738346 -Administrator -1694738346 -Administrator -ORG {F73FADE0-A6DA-48E8-9752-45561D856A60} -DAT 1694738347 -ORG {57A9F5C2-285F-4EB2-B0AA-52EBE80295EC} -DAT 1694738296 -int - - -2C491A76-E901-4FC4-8077-22CF23CC27F3 -销售员电话 -salesman_tel -1694738346 -Administrator -1694738346 -Administrator -ORG {7072C517-AF02-480F-96A3-E44AF0532864} -DAT 1694738347 -ORG {0A46F993-A8C8-4468-BDF4-FE4D86C1814A} -DAT 1694738296 -numeric(11,0) -11 -1 - - - - -04F5B9C1-256F-4EC6-9616-E7C883365C1D -Identifier_1 -Identifier_1 -1694738346 -Administrator -1694738346 -Administrator -ORG {C115FB61-01C5-4EED-9987-64860B2A394D} -DAT 1694738347 -ORG {659FF838-E7B3-4209-996D-5F7BA41EA2EF} -DAT 1694738296 - - - - - - - -B0A0AC4E-929D-45F7-83B5-90B64B0DE2CD -salesman_PK -salesman_PK -1694738347 -Administrator -1694738347 -Administrator -1 - - - - - -A74FE186-2258-4632-9DE7-3F67B8117AC9 -1694738347 -Administrator -1694738347 -Administrator - - - - - - - - - - - - -87D46A73-EAC8-441B-95E7-009F652FFD15 -汽车品牌 -car_brand -1694738346 -Administrator -1694738347 -Administrator -ORG {3435C116-1691-490C-AB05-A96B77941291} -DAT 1694738347 -ORG {F554247B-14B2-4A91-94EE-140843055E82} -DAT 1694738296 - - - -7ABBF6F7-7303-4B77-A059-37042EB7A5F7 -品牌编号 -car_brand_No -1694738346 -Administrator -1694738727 -Administrator -ORG {A395BBCE-31CC-4259-9738-07693A8B7483} -DAT 1694738347 -ORG {E995D1E7-A9E0-4AA7-A356-AC1674A41B01} -DAT 1694738296 -int -1 -1 - - -C1F8178B-943F-4403-9BC3-2DDE3242A466 -品牌名称 -car_brand_name -1694738346 -Administrator -1694738346 -Administrator -ORG {2C131EDD-F299-4D00-9CD8-8DC9145D8201} -DAT 1694738347 -ORG {E4371271-58FD-4865-935C-B38078CD4855} -DAT 1694738296 -char(10) -10 -1 - - - - -8CB1B209-4572-4ED3-B9CB-3AC071FFBBE3 -Identifier_1 -Identifier_1 -1694738346 -Administrator -1694738346 -Administrator -ORG {CFA76641-932B-4B2D-ABF9-304D75D41A54} -DAT 1694738347 -ORG {87EB373C-3C24-48BD-B0B9-ED6570698DFD} -DAT 1694738296 - - - - - - - -263D1CE1-CFAC-47F0-87E2-D1259BE3AC66 -car_brand_PK -car_brand_PK -1694738347 -Administrator -1694738347 -Administrator -1 - - - - - -270D948D-5633-4C28-81A5-0FE943F51BBD -1694738347 -Administrator -1694738347 -Administrator - - - - - - - - - - - - -F956AD77-96CF-432B-8315-EED95D1A746A -销售记录 -sale_record -1694738346 -Administrator -1694738347 -Administrator -ORG {92F55831-D1D8-439B-AC3B-BB564DD65B80} -DAT 1694738347 -ORG {B99A4277-7110-4F8C-99B0-6055F777D077} -DAT 1694738296 - - - -75F88203-0F22-4CC4-A259-E22DE6CFA061 -销售记录编号 -sale_record_No -1694738346 -Administrator -1694738346 -Administrator -ORG {300439B3-0ED7-4993-9A85-DE4EB18BF155} -DAT 1694738347 -ORG {7F456E26-A6A1-4AB3-BD90-F540C4AD9E7E} -DAT 1694738296 -int -1 -1 - - -FB849FA0-E5A4-4265-B448-607A088A7C10 -顾客编号 -customer_No -1694738346 -Administrator -1694738346 -Administrator -ORG {F7CBA88E-53FD-4754-BF86-410BF467A12C} -DAT 1694738347 -ORG {4ED84CAD-5607-47B5-A404-B3E3F8CF4407},{EB0943BD-564E-4149-A731-B13653456998} -DAT 1694738296 -int - - -5FD0BDE6-0468-4D42-B83C-2FF2125F8056 -销售员编号 -salesman_No2 -1694738346 -Administrator -1694738346 -Administrator -ORG {D70F181E-4362-4E1D-8F46-F54462BEF7D9} -DAT 1694738347 -ORG {7884401C-690E-4A39-9E14-9710AF76F3D3},{AD185B53-3D5C-4568-BE78-082778EB8321} -DAT 1694738296 -int - - -89308815-918F-4726-B682-7FFED28558BE -汽车型号编号 -car_No -1694738346 -Administrator -1694738346 -Administrator -ORG {D09B60C0-14CE-4D14-8023-D41E9C7F7384} -DAT 1694738347 -ORG {E92D1D55-1085-4B59-B476-C21D6ABDE10D},{E0F65193-29F4-4EE5-BFAD-93608104A198} -DAT 1694738296 -int - - -8E082580-01B0-4E61-806B-1809F8AEB8F2 -销售金额 -sale_fee -1694738346 -Administrator -1694738346 -Administrator -ORG {02E669EB-EFC7-43FB-BE01-003DBE0DA251} -DAT 1694738347 -ORG {E7B98BCF-9362-4B17-BBA3-AC12CAF6B5E5} -DAT 1694738296 -decimal(9,2) -9 -2 -1 - - -693AA84C-A4CA-4846-BD4A-16726927AC53 -销售日期 -sale_date -1694738346 -Administrator -1694738346 -Administrator -ORG {89B2BC3E-D610-4C9B-A940-7DF18FAC6835} -DAT 1694738347 -ORG {CC9E3C89-1076-4D55-B0DA-D9F7E63909DE} -DAT 1694738296 -date -1 - - - - -DE08127E-41A8-46B4-BBF3-ED033DCD3603 -Identifier_1 -Identifier_1 -1694738346 -Administrator -1694738346 -Administrator -ORG {36A09260-7220-4A5E-A7C1-A677E336B607} -DAT 1694738347 -ORG {9C6DC214-9326-4833-924D-8F6B570107DB} -DAT 1694738296 - - - - - - - -82A75706-7FB9-455F-BA3E-475EDED98A22 -sale_record_PK -sale_record_PK -1694738347 -Administrator -1694738347 -Administrator -1 - - - - - -A4B1BB35-4174-4DF1-B735-9A07381B2FBA -1694738347 -Administrator -1694738347 -Administrator - - - - - - - -C2F46E09-3B78-4C8C-BA98-3F347B2038B4 -buy_FK -buy_FK -1694738347 -Administrator -1694738347 -Administrator - - - - - -EECBCA65-FD90-4C7A-8C2B-E7E1AD0E5DD2 -1694738347 -Administrator -1694738347 -Administrator - - - - - - - -6FD3A6DF-B24C-4E12-A5DA-225BE3520E88 -sale_FK -sale_FK -1694738347 -Administrator -1694738347 -Administrator - - - - - -CA7B5BFF-D2FD-4993-825E-D035E7845040 -1694738347 -Administrator -1694738347 -Administrator - - - - - - - -8880F02B-4CC5-4270-9A1B-2ACB18A81D96 -work off_FK -work off_FK -1694738347 -Administrator -1694738347 -Administrator - - - - - -F1F017D8-F139-414D-842F-365DEAEB5847 -1694738347 -Administrator -1694738347 -Administrator - - - - - - - - - - - - - - -C083F251-63F1-499E-9738-EFC0A1FE2613 -属于 -belong -1694738346 -Administrator -1694738346 -Administrator -ORG {7588B539-A397-4BF8-A7D7-2330A02EBEAA} -DAT 1694738347 -ORG {3100E5CE-9CA2-4850-82CF-E5000C2FB274} -DAT 1694738296 -0..* -1 -1 - - - - - - - - - - - -A7325BEB-DEBF-446E-A569-0D62A1411B3D -1694738346 -Administrator -1694738346 -Administrator -ORG {C820A620-1954-4C67-A1BE-C0BA1659482F} -DAT 1694738347 - - - - - - - - - - -2B0CC44C-C917-4472-9D97-FF16AF66D472 -购买 -buy -1694738346 -Administrator -1694738346 -Administrator -ORG {D8DAA953-0FAB-4C68-94A8-8F69B09D3A72} -DAT 1694738347 -ORG {EB0943BD-564E-4149-A731-B13653456998} -DAT 1694738296 -0..* -1 -1 - - - - - - - - - - - -03454A0C-F434-4BDA-932B-AACA4E633CB4 -1694738346 -Administrator -1694738346 -Administrator -ORG {182C7397-BF30-4C55-94AB-001C567AC5F2} -DAT 1694738347 - - - - - - - - - - -3AB947BE-C0BC-495E-B902-0924DB81E00F -销售 -sale -1694738346 -Administrator -1694738346 -Administrator -ORG {AFFF1405-D75C-469F-A65F-D4A3782FDE01} -DAT 1694738347 -ORG {AD185B53-3D5C-4568-BE78-082778EB8321} -DAT 1694738296 -0..* -1 -1 - - - - - - - - - - - -89EAD3FA-7F1B-41D3-9550-C76D719561CC -1694738346 -Administrator -1694738346 -Administrator -ORG {11ABE6E9-1D29-47B3-A893-30F4641EB87B} -DAT 1694738347 - - - - - - - - - - -6E177381-F07B-41F8-941F-58C8C63B9000 -售出 -work_off -1694738346 -Administrator -1694738496 -Administrator -ORG {62A80048-E7E3-4DA6-8DDA-F17CDBDCB81D} -DAT 1694738347 -ORG {E0F65193-29F4-4EE5-BFAD-93608104A198} -DAT 1694738296 -0..* -1 -1 - - - - - - - - - - - -B3BBF923-9E66-4591-8F14-281ED9CCC47E -1694738346 -Administrator -1694738346 -Administrator -ORG {2632987C-D642-4C89-B024-0F05EEAD3416} -DAT 1694738347 - - - - - - - - - - - - -0B5B1439-28F8-4775-8024-17D319AE18F7 -PUBLIC -PUBLIC -1694738341 -Administrator -1694738341 -Administrator - - - - -1E513B9E-18B4-495C-B4F1-C61C0C2BEC77 -MySQL 5.0 -MYSQL50 -1694738344 -Administrator -1694738344 -Administrator -file:///%_DBMS%/mysql50.xdb -F4F16ECD-F2F1-4006-AF6F-638D5C65F35E -4BA9F647-DAB1-11D1-9944-006097355D9B -1276524678 - - - - - -0231781A-C68D-4376-A53E-D535A21492B1 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694738347 -Administrator -1694749259 -Administrator -file:///F|/ConceptualDataModel_1.ldm -70136198-6D9C-4E51-8FB5-AED752B89C46 -5F45F978-C4F3-4E35-A3FC-AF3318663A0F -1694749260 - - - - - - - - - - \ No newline at end of file diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/\346\261\275\350\275\246\345\225\206\345\272\227.md" "b/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/\346\261\275\350\275\246\345\225\206\345\272\227.md" deleted file mode 100644 index 654e71266dd0585d6586f811b79ddc17b160a5c5..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/\346\261\275\350\275\246\345\225\206\345\272\227.md" +++ /dev/null @@ -1,359 +0,0 @@ -# 2023年9月16日 汽车商店 - -## ER图: - -[![pPfYOmD.png](https://z1.ax1x.com/2023/09/16/pPfYOmD.png)](https://imgse.com/i/pPfYOmD) - -## 代码: - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 09:29:28 */ -/*==============================================================*/ -drop database if exists car; -create database if not exists car charset utf8; -use car; - - -drop table if exists car_brand; - -drop table if exists car_type; - -drop table if exists customer; - -drop table if exists sale_record; - -drop table if exists salesman; - -/*==============================================================*/ -/* Table: car_brand */ -/*==============================================================*/ -create table car_brand -( - car_brand_No int not null auto_increment, - car_brand_name char(10) not null, - primary key (car_brand_No) -); - -/*==============================================================*/ -/* Table: car_type */ -/*==============================================================*/ -create table car_type -( - car_No int not null auto_increment, - car_brand_No int, - car_name varchar(30) not null, - car_color char(2), - primary key (car_No) -); - -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - customer_No int not null auto_increment, - salesman_name char(10) not null, - salesman_gender char(1), - salesman_age int, - salesman_tel numeric(11,0) not null, - primary key (customer_No) -); - -/*==============================================================*/ -/* Table: sale_record */ -/*==============================================================*/ -create table sale_record -( - sale_record_No int not null auto_increment, - customer_No int, - salesman_No2 int, - car_No int, - sale_fee decimal(9,2) not null, - sale_date date not null, - primary key (sale_record_No) -); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_No2 int not null auto_increment, - salesman_name char(10) not null, - salesman_gender char(1), - salesman_age int, - salesman_tel numeric(11,0) not null, - primary key (salesman_No2) -); - -alter table car_type add constraint FK_belong foreign key (car_brand_No) - references car_brand (car_brand_No) on delete restrict on update restrict; - -alter table sale_record add constraint FK_buy foreign key (customer_No) - references customer (customer_No) on delete restrict on update restrict; - -alter table sale_record add constraint FK_sale foreign key (salesman_No2) - references salesman (salesman_No2) on delete restrict on update restrict; - -alter table sale_record add constraint FK_work_off foreign key (car_No) - references car_type (car_No) on delete restrict on update restrict; - - - --- 插入数据 - - -insert into car_brand VALUES -(null,"宝马"), -(null,"奔驰"), -(null,"奥迪"), -(null,"大众"), -(null,"福特"), -(null,"日产"), -(null,"丰田"), -(null,"霍顿"), -(null,"雪佛兰"), -(null,"斯巴鲁"), -(null,"玛莎拉蒂"), -(null,"法拉利"), -(null,"兰博基尼"), -(null,"保时捷"), -(null,"路虎"), -(null,"宾利"), -(null,"沃尔沃"), -(null,"雷克萨斯"), -(null,"福特野马"), -(null,"特斯拉"); - - -insert into car_type VALUES -(null,1, "1系列", "红色"), -(null,1, "2系列", "蓝色"), -(null,1, "3系列", "黑色"), -(null,1, "4系列", "白色"), -(null,1, "5系列", "银色"), -(null,1, "6系列", "灰色"), -(null,1, "7系列", "黄色"), -(null,1, "X1", "绿色"), -(null,1, "X3", "紫色"), -(null,1, "X5", "橙色"), -(null,1, "X6", "棕色"), -(null,1, "Z4", "粉色"), -(null,2, "A级", "红色"), -(null,2, "B级", "蓝色"), -(null,2, "C级", "黑色"), -(null,2, "E级", "白色"), -(null,2, "S级", "银色"), -(null,2, "GLA", "灰色"), -(null,2, "GLC", "黄色"), -(null,2, "GLE", "绿色"), -(null,2, "GLS", "紫色"), -(null,2, "G级", "橙色"), -(null,2, "SLK", "棕色"), -(null,2, "SL", "粉色"), -(null,3, "A1", "红色"), -(null,3, "A3", "蓝色"), -(null,3, "A4", "黑色"), -(null,3, "A5", "白色"), -(null,3, "A6", "银色"), -(null,3, "A7", "灰色"), -(null,3, "A8", "黄色"), -(null,3, "Q2", "绿色"), -(null,3, "Q3", "紫色"), -(null,3, "Q5", "橙色"), -(null,3, "Q7", "棕色"), -(null,3, "TT", "粉色"), -(null,3, "R8", "红色"), -(null,4, "Polo", "蓝色"), -(null,4, "Golf", "黑色"), -(null,4, "Passat", "白色"), -(null,4, "Jetta", "银色"), -(null,4, "Tiguan", "灰色"), -(null,4, "Touareg", "黄色"), -(null,4, "Phaeton", "绿色"), -(null,4, "Beetle", "紫色"), -(null,5, "Fiesta", "橙色"), -(null,5, "Focus", "棕色"), -(null,5, "Mondeo", "粉色"), -(null,5, "Mustang", "红色"), -(null,5, "Escape", "蓝色"), -(null,5, "Explorer", "黑色"), -(null,5, "Expedition", "白色"), -(null,5, "F-150", "银色"), -(null,6, "Micra", "灰色"), -(null,6, "Note", "黄色"), -(null,6, "Sentra", "绿色"), -(null,6, "Altima", "紫色"), -(null,6, "Maxima", "橙色"), -(null,6, "Qashqai", "棕色"), -(null,6, "Rogue", "粉色"), -(null,6, "Pathfinder", "红色"), -(null,6, "X-Trail", "蓝色"), -(null,6, "Murano", "黑色"), -(null,6, "Patrol", "白色"), -(null,7, "Yaris", "银色"), -(null,7, "Corolla", "灰色"), -(null,7, "Camry", "黄色"), -(null,7, "Avalon", "绿色"), -(null,7, "Prius", "紫色"), -(null,7, "RAV4", "橙色"), -(null,7, "Highlander", "棕色"), -(null,7, "4Runner", "粉色"), -(null,7, "Land Cruiser", "红色"), -(null,8, "Spark", "蓝色"), -(null,8, "Barina", "黑色"), -(null,8, "Cruze", "白色"), -(null,8, "Malibu", "银色"), -(null,8, "Captiva", "灰色"), -(null,8, "Colorado", "黄色"), -(null,9, "Sonic", "绿色"), -(null,9, "Cruze", "紫色"), -(null,9, "Malibu", "橙色"), -(null,9, "Impala", "棕色"), -(null,9, "Camaro", "粉色"), -(null,9, "Corvette", "红色"), -(null,9, "Equinox", "蓝色"), -(null,9, "Traverse", "黑色"), -(null,9, "Tahoe", "白色"), -(null,9, "Suburban", "银色"), -(null,10, "Impreza", "灰色"), -(null,10, "Legacy", "黄色"), -(null,10, "Outback", "绿色"), -(null,10, "Forester", "紫色"), -(null,10, "XV Crosstrek", "橙色"), -(null,10, "WRX", "棕色"), -(null,10, "BRZ", "粉色"), -(null,11, "Ghibli", "红色"), -(null,11, "Quattroporte", "蓝色"), -(null,11, "Levante", "黑色"), -(null,11, "GranTurismo", "白色"), -(null,11, "GranCabrio", "银色"), -(null,12, "488 GTB", "灰色"), -(null,12, "812 Superfast", "黄色"), -(null,12, "Portofino", "绿色"), -(null,12, "GTC4Lusso", "紫色"), -(null,12, "SF90 Stradale", "橙色"), -(null,13, "Huracan", "棕色"), -(null,13, "Aventador", "粉色"), -(null,13, "Urus", "红色"), -(null,14, "911", "蓝色"), -(null,14, "Cayenne", "黑色"), -(null,14, "Macan", "白色"), -(null,14, "Panamera", "银色"), -(null,14, "Taycan", "灰色"), -(null,15, "Range Rover", "黄色"), -(null,15, "Range Rover Sport", "绿色"), -(null,15, "Range Rover Velar", "紫色"), -(null,15, "Range Rover Evoque", "橙色"), -(null,15, "Discovery", "棕色"), -(null,15, "Discovery Sport", "粉色"), -(null,16, "Bentayga", "红色"), -(null,16, "Continental GT", "蓝色"), -(null,16, "Flying Spur", "黑色"), -(null,17, "S60", "白色"), -(null,17, "S90", "银色"), -(null,17, "XC40", "灰色"), -(null,17, "XC60", "黄色"), -(null,17, "XC90", "绿色"), -(null,18, "IS", "紫色"), -(null,18, "ES", "橙色"), -(null,18, "GS", "棕色"), -(null,18, "LS", "粉色"), -(null,18, "NX", "红色"), -(null,18, "RX", "蓝色"), -(null,18, "GX", "黑色"), -(null,18, "LX", "白色"), -(null,19, "Mustang", "银色"), -(null,20, "Model S", "灰色"), -(null,20, "Model 3", "黄色"), -(null,20, "Model X", "绿色"), -(null,20, "Model Y", "紫色"); - - - - - -insert into customer VALUES -(null,"陈八", "男", 31, "13901234567"), -(null,"杨九", "女", 27, "13876543210"), -(null,"徐十", "男", 29, "13765432109"), -(null,"宋十一", "女", 33, "13654321098"), -(null,"黄十二", "男", 26, "13543210987"), -(null,"周十三", "女", 34, "13987654321"), -(null,"郑十四", "男", 30, "13876543210"), -(null,"王十五", "女", 28, "13765432109"), -(null,"李十六", "男", 32, "13654321098"), -(null,"张十七", "女", 29, "13543210987"), -(null,"张三", "男", 28, "13812345678"), -(null,"李四", "女", 32, "13987654321"), -(null,"王五", "男", 25, "13798765432"), -(null,"赵六", "女", 30, "13678901234"), -(null,"刘七", "男", 35, "13567890123"); - - -insert into salesman VALUES -(null,"钱七","男",29,"13723456789"), -(null,"孙八","女",26,"13887654321"), -(null,"周九","男",24,"13987654321"), -(null,"吴十","女",31,"13612345678"), -(null,"郑十一","男",32,"13512345678"), -(null,"王十二","女",29,"13798765432"), -(null,"蒋十三","男",27,"13823456789"), -(null,"沈十四","女",25,"13987654321"), -(null,"杨十五","男",28,"13687654321"), -(null,"朱十六","女",30,"13723456789"), -(null,"秦十七","男",26,"13567891234"), -(null,"许十八","女",24,"13998765432"), -(null,"何十九","男",25,"13812345678"), -(null,"马二十","女",27,"13612345678"), -(null,"林二十一","男",29,"13987654321"), -(null,"刘二十二","女",31,"13798765432"); - - - -insert into sale_record VALUES -( 1, 12, 8, 26, 1075324, "20231014" ), -( 2, 13, 8, 129, 109872, "20231020" ), -( 3, 1, 3, 50, 1202603, "20230225" ), -( 4, 13, 1, 111, 1251630, "20230930" ), -( 5, 10, 10, 64, 61621, "20230628" ), -( 6, 5, 5, 83, 1166616, "20230108" ), -( 7, 15, 3, 35, 1040460, "20231019" ), -( 8, 14, 16, 120, 738195, "20230206" ), -( 9, 8, 10, 114, 480933, "20231027" ), -( 10, 8, 13, 104, 710717, "20230904" ), -( 11, 4, 5, 5, 621368, "20230201" ), -( 12, 3, 3, 1, 1334824, "20230417" ), -( 13, 7, 14, 101, 907078, "20230209" ), -( 14, 5, 5, 112, 264528, "20230815" ), -( 15, 1, 4, 78, 359795, "20231102" ), -( 16, 4, 4, 98, 401519, "20230319" ), -( 17, 14, 5, 115, 224371, "20231104" ), -( 18, 8, 8, 104, 469208, "20230322" ), -( 19, 7, 15, 5, 223584, "20230922" ), -( 20, 14, 14, 59, 715409, "20230323" ); - - - - --- 1.查询特定销售员的销售记录 -select * from sale_record where salesman_No2=(select salesman_No2 from salesman where salesman_name="钱七"); - -- 2.查找销售记录中销售价格最高的汽车 - SELECT * from sale_record where sale_fee=(select MAX(sale_fee) from sale_record); - -- 3.统计某个销售员的销售总额 - select r.salesman_No2 销售人员ID,s.salesman_name 姓名,SUM(r.sale_fee) 销售总额 from sale_record r LEFT JOIN salesman s on r.salesman_No2=s.salesman_No2 where s.salesman_No2=8; - -- 4.根据客户信息查询其购买过的汽车 - select * from sale_record where customer_No=(select customer_No from customer where salesman_name="李四"); - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - SELECT * from sale_record where car_no in (SELECT car_No from car_type where car_brand_No=(select car_brand_No from car_brand where car_brand_name="宝马")); - -- 6.检索特定日期范围内的销售了哪些汽车 - select * from sale_record where sale_date="20231020"; - -- 7.查找某车型的销售历史。 - SELECT*FROM car_brand b LEFT JOIN car_type t ON b.car_brand_No=t.car_brand_No LEFT JOIN sale_record r ON r.car_No=t.car_No; - -- 8.统计每个销售员的销售数量 - SELECT s.salesman_No2 销售员 ID,s.salesman_name 销售员姓名,COUNT(customer_No) 销售数量 FROM salesman s LEFT JOIN sale_record r ON s.salesman_No2=r.salesman_No2 GROUP BY s.salesman_No2 ORDER BY 销售数量 DESC; - -``` - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/\346\261\275\350\275\246\345\225\206\345\272\227.txt" "b/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/\346\261\275\350\275\246\345\225\206\345\272\227.txt" deleted file mode 100644 index 172ecf9f84fb08d83ce95c93309a799109d34181..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230915 \347\254\254\344\270\203\346\254\241\344\275\234\344\270\232 \346\261\275\350\275\246\345\225\206\345\272\227/\346\261\275\350\275\246\345\225\206\345\272\227.txt" +++ /dev/null @@ -1,354 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 09:29:28 */ -/*==============================================================*/ -drop database if exists car; -create database if not exists car charset utf8; -use car; - - -drop table if exists car_brand; - -drop table if exists car_type; - -drop table if exists customer; - -drop table if exists sale_record; - -drop table if exists salesman; - -/*==============================================================*/ -/* Table: car_brand */ -/*==============================================================*/ -create table car_brand -( - car_brand_No int not null auto_increment, - car_brand_name char(10) not null, - primary key (car_brand_No) -); - -/*==============================================================*/ -/* Table: car_type */ -/*==============================================================*/ -create table car_type -( - car_No int not null auto_increment, - car_brand_No int, - car_name varchar(30) not null, - car_color char(2), - primary key (car_No) -); - -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - customer_No int not null auto_increment, - salesman_name char(10) not null, - salesman_gender char(1), - salesman_age int, - salesman_tel numeric(11,0) not null, - primary key (customer_No) -); - -/*==============================================================*/ -/* Table: sale_record */ -/*==============================================================*/ -create table sale_record -( - sale_record_No int not null auto_increment, - customer_No int, - salesman_No2 int, - car_No int, - sale_fee decimal(9,2) not null, - sale_date date not null, - primary key (sale_record_No) -); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_No2 int not null auto_increment, - salesman_name char(10) not null, - salesman_gender char(1), - salesman_age int, - salesman_tel numeric(11,0) not null, - primary key (salesman_No2) -); - -alter table car_type add constraint FK_belong foreign key (car_brand_No) - references car_brand (car_brand_No) on delete restrict on update restrict; - -alter table sale_record add constraint FK_buy foreign key (customer_No) - references customer (customer_No) on delete restrict on update restrict; - -alter table sale_record add constraint FK_sale foreign key (salesman_No2) - references salesman (salesman_No2) on delete restrict on update restrict; - -alter table sale_record add constraint FK_work_off foreign key (car_No) - references car_type (car_No) on delete restrict on update restrict; - - - --- 插入数据 - - -insert into car_brand VALUES -(null,"宝马"), -(null,"奔驰"), -(null,"奥迪"), -(null,"大众"), -(null,"福特"), -(null,"日产"), -(null,"丰田"), -(null,"霍顿"), -(null,"雪佛兰"), -(null,"斯巴鲁"), -(null,"玛莎拉蒂"), -(null,"法拉利"), -(null,"兰博基尼"), -(null,"保时捷"), -(null,"路虎"), -(null,"宾利"), -(null,"沃尔沃"), -(null,"雷克萨斯"), -(null,"福特野马"), -(null,"特斯拉"); - - -insert into car_type VALUES -(null,1, "1系列", "红色"), -(null,1, "2系列", "蓝色"), -(null,1, "3系列", "黑色"), -(null,1, "4系列", "白色"), -(null,1, "5系列", "银色"), -(null,1, "6系列", "灰色"), -(null,1, "7系列", "黄色"), -(null,1, "X1", "绿色"), -(null,1, "X3", "紫色"), -(null,1, "X5", "橙色"), -(null,1, "X6", "棕色"), -(null,1, "Z4", "粉色"), -(null,2, "A级", "红色"), -(null,2, "B级", "蓝色"), -(null,2, "C级", "黑色"), -(null,2, "E级", "白色"), -(null,2, "S级", "银色"), -(null,2, "GLA", "灰色"), -(null,2, "GLC", "黄色"), -(null,2, "GLE", "绿色"), -(null,2, "GLS", "紫色"), -(null,2, "G级", "橙色"), -(null,2, "SLK", "棕色"), -(null,2, "SL", "粉色"), -(null,3, "A1", "红色"), -(null,3, "A3", "蓝色"), -(null,3, "A4", "黑色"), -(null,3, "A5", "白色"), -(null,3, "A6", "银色"), -(null,3, "A7", "灰色"), -(null,3, "A8", "黄色"), -(null,3, "Q2", "绿色"), -(null,3, "Q3", "紫色"), -(null,3, "Q5", "橙色"), -(null,3, "Q7", "棕色"), -(null,3, "TT", "粉色"), -(null,3, "R8", "红色"), -(null,4, "Polo", "蓝色"), -(null,4, "Golf", "黑色"), -(null,4, "Passat", "白色"), -(null,4, "Jetta", "银色"), -(null,4, "Tiguan", "灰色"), -(null,4, "Touareg", "黄色"), -(null,4, "Phaeton", "绿色"), -(null,4, "Beetle", "紫色"), -(null,5, "Fiesta", "橙色"), -(null,5, "Focus", "棕色"), -(null,5, "Mondeo", "粉色"), -(null,5, "Mustang", "红色"), -(null,5, "Escape", "蓝色"), -(null,5, "Explorer", "黑色"), -(null,5, "Expedition", "白色"), -(null,5, "F-150", "银色"), -(null,6, "Micra", "灰色"), -(null,6, "Note", "黄色"), -(null,6, "Sentra", "绿色"), -(null,6, "Altima", "紫色"), -(null,6, "Maxima", "橙色"), -(null,6, "Qashqai", "棕色"), -(null,6, "Rogue", "粉色"), -(null,6, "Pathfinder", "红色"), -(null,6, "X-Trail", "蓝色"), -(null,6, "Murano", "黑色"), -(null,6, "Patrol", "白色"), -(null,7, "Yaris", "银色"), -(null,7, "Corolla", "灰色"), -(null,7, "Camry", "黄色"), -(null,7, "Avalon", "绿色"), -(null,7, "Prius", "紫色"), -(null,7, "RAV4", "橙色"), -(null,7, "Highlander", "棕色"), -(null,7, "4Runner", "粉色"), -(null,7, "Land Cruiser", "红色"), -(null,8, "Spark", "蓝色"), -(null,8, "Barina", "黑色"), -(null,8, "Cruze", "白色"), -(null,8, "Malibu", "银色"), -(null,8, "Captiva", "灰色"), -(null,8, "Colorado", "黄色"), -(null,9, "Sonic", "绿色"), -(null,9, "Cruze", "紫色"), -(null,9, "Malibu", "橙色"), -(null,9, "Impala", "棕色"), -(null,9, "Camaro", "粉色"), -(null,9, "Corvette", "红色"), -(null,9, "Equinox", "蓝色"), -(null,9, "Traverse", "黑色"), -(null,9, "Tahoe", "白色"), -(null,9, "Suburban", "银色"), -(null,10, "Impreza", "灰色"), -(null,10, "Legacy", "黄色"), -(null,10, "Outback", "绿色"), -(null,10, "Forester", "紫色"), -(null,10, "XV Crosstrek", "橙色"), -(null,10, "WRX", "棕色"), -(null,10, "BRZ", "粉色"), -(null,11, "Ghibli", "红色"), -(null,11, "Quattroporte", "蓝色"), -(null,11, "Levante", "黑色"), -(null,11, "GranTurismo", "白色"), -(null,11, "GranCabrio", "银色"), -(null,12, "488 GTB", "灰色"), -(null,12, "812 Superfast", "黄色"), -(null,12, "Portofino", "绿色"), -(null,12, "GTC4Lusso", "紫色"), -(null,12, "SF90 Stradale", "橙色"), -(null,13, "Huracan", "棕色"), -(null,13, "Aventador", "粉色"), -(null,13, "Urus", "红色"), -(null,14, "911", "蓝色"), -(null,14, "Cayenne", "黑色"), -(null,14, "Macan", "白色"), -(null,14, "Panamera", "银色"), -(null,14, "Taycan", "灰色"), -(null,15, "Range Rover", "黄色"), -(null,15, "Range Rover Sport", "绿色"), -(null,15, "Range Rover Velar", "紫色"), -(null,15, "Range Rover Evoque", "橙色"), -(null,15, "Discovery", "棕色"), -(null,15, "Discovery Sport", "粉色"), -(null,16, "Bentayga", "红色"), -(null,16, "Continental GT", "蓝色"), -(null,16, "Flying Spur", "黑色"), -(null,17, "S60", "白色"), -(null,17, "S90", "银色"), -(null,17, "XC40", "灰色"), -(null,17, "XC60", "黄色"), -(null,17, "XC90", "绿色"), -(null,18, "IS", "紫色"), -(null,18, "ES", "橙色"), -(null,18, "GS", "棕色"), -(null,18, "LS", "粉色"), -(null,18, "NX", "红色"), -(null,18, "RX", "蓝色"), -(null,18, "GX", "黑色"), -(null,18, "LX", "白色"), -(null,19, "Mustang", "银色"), -(null,20, "Model S", "灰色"), -(null,20, "Model 3", "黄色"), -(null,20, "Model X", "绿色"), -(null,20, "Model Y", "紫色"); - - - - - -insert into customer VALUES -(null,"陈八", "男", 31, "13901234567"), -(null,"杨九", "女", 27, "13876543210"), -(null,"徐十", "男", 29, "13765432109"), -(null,"宋十一", "女", 33, "13654321098"), -(null,"黄十二", "男", 26, "13543210987"), -(null,"周十三", "女", 34, "13987654321"), -(null,"郑十四", "男", 30, "13876543210"), -(null,"王十五", "女", 28, "13765432109"), -(null,"李十六", "男", 32, "13654321098"), -(null,"张十七", "女", 29, "13543210987"), -(null,"张三", "男", 28, "13812345678"), -(null,"李四", "女", 32, "13987654321"), -(null,"王五", "男", 25, "13798765432"), -(null,"赵六", "女", 30, "13678901234"), -(null,"刘七", "男", 35, "13567890123"); - - -insert into salesman VALUES -(null,"钱七","男",29,"13723456789"), -(null,"孙八","女",26,"13887654321"), -(null,"周九","男",24,"13987654321"), -(null,"吴十","女",31,"13612345678"), -(null,"郑十一","男",32,"13512345678"), -(null,"王十二","女",29,"13798765432"), -(null,"蒋十三","男",27,"13823456789"), -(null,"沈十四","女",25,"13987654321"), -(null,"杨十五","男",28,"13687654321"), -(null,"朱十六","女",30,"13723456789"), -(null,"秦十七","男",26,"13567891234"), -(null,"许十八","女",24,"13998765432"), -(null,"何十九","男",25,"13812345678"), -(null,"马二十","女",27,"13612345678"), -(null,"林二十一","男",29,"13987654321"), -(null,"刘二十二","女",31,"13798765432"); - - - -insert into sale_record VALUES -( 1, 12, 8, 26, 1075324, "20231014" ), -( 2, 13, 8, 129, 109872, "20231020" ), -( 3, 1, 3, 50, 1202603, "20230225" ), -( 4, 13, 1, 111, 1251630, "20230930" ), -( 5, 10, 10, 64, 61621, "20230628" ), -( 6, 5, 5, 83, 1166616, "20230108" ), -( 7, 15, 3, 35, 1040460, "20231019" ), -( 8, 14, 16, 120, 738195, "20230206" ), -( 9, 8, 10, 114, 480933, "20231027" ), -( 10, 8, 13, 104, 710717, "20230904" ), -( 11, 4, 5, 5, 621368, "20230201" ), -( 12, 3, 3, 1, 1334824, "20230417" ), -( 13, 7, 14, 101, 907078, "20230209" ), -( 14, 5, 5, 112, 264528, "20230815" ), -( 15, 1, 4, 78, 359795, "20231102" ), -( 16, 4, 4, 98, 401519, "20230319" ), -( 17, 14, 5, 115, 224371, "20231104" ), -( 18, 8, 8, 104, 469208, "20230322" ), -( 19, 7, 15, 5, 223584, "20230922" ), -( 20, 14, 14, 59, 715409, "20230323" ); - - - - --- 1.查询特定销售员的销售记录 -select * from sale_record where salesman_No2=(select salesman_No2 from salesman where salesman_name="钱七"); - -- 2.查找销售记录中销售价格最高的汽车 - SELECT * from sale_record where sale_fee=(select MAX(sale_fee) from sale_record); - -- 3.统计某个销售员的销售总额 - select r.salesman_No2 销售人员ID,s.salesman_name 姓名,SUM(r.sale_fee) 销售总额 from sale_record r LEFT JOIN salesman s on r.salesman_No2=s.salesman_No2 where s.salesman_No2=8; - -- 4.根据客户信息查询其购买过的汽车 - select * from sale_record where customer_No=(select customer_No from customer where salesman_name="李四"); - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - SELECT * from sale_record where car_no in (SELECT car_No from car_type where car_brand_No=(select car_brand_No from car_brand where car_brand_name="宝马")); - -- 6.检索特定日期范围内的销售了哪些汽车 - select * from sale_record where sale_date="20231020"; - -- 7.查找某车型的销售历史。 - - -- 8.统计每个销售员的销售数量 - select * from salesman s LEFT JOIN sale_record r on s. ; - - - - - - - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230919 \347\254\254\345\205\253\346\254\241\344\275\234\344\270\232 \345\244\215\344\271\240SQL\350\257\255\345\217\245/tesxt010000333" "b/53 \345\221\250\345\216\232\350\276\260/20230919 \347\254\254\345\205\253\346\254\241\344\275\234\344\270\232 \345\244\215\344\271\240SQL\350\257\255\345\217\245/tesxt010000333" deleted file mode 160000 index abed74cb7dbb639685277c2ab01bf1319ddd4595..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230919 \347\254\254\345\205\253\346\254\241\344\275\234\344\270\232 \345\244\215\344\271\240SQL\350\257\255\345\217\245/tesxt010000333" +++ /dev/null @@ -1 +0,0 @@ -Subproject commit abed74cb7dbb639685277c2ab01bf1319ddd4595 diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230919 \347\254\254\345\205\253\346\254\241\344\275\234\344\270\232 \345\244\215\344\271\240SQL\350\257\255\345\217\245/\347\255\224\346\241\210.md" "b/53 \345\221\250\345\216\232\350\276\260/20230919 \347\254\254\345\205\253\346\254\241\344\275\234\344\270\232 \345\244\215\344\271\240SQL\350\257\255\345\217\245/\347\255\224\346\241\210.md" deleted file mode 100644 index 2200c26772161a11386ba3bcfda16f3fa5ccd69c..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230919 \347\254\254\345\205\253\346\254\241\344\275\234\344\270\232 \345\244\215\344\271\240SQL\350\257\255\345\217\245/\347\255\224\346\241\210.md" +++ /dev/null @@ -1,274 +0,0 @@ -# 2023年9月20日 复习SQL语句 - -## 答案: - -```mysql -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 -select sum(salary*12) 工资总和 from employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 -select sum(salary*(1+ifnull(commission_pct,0))*12) from employees; - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct -select distinct job_id from employees; - - -# 3.查询工资大于12000的员工姓名和工资 -select * from employees where salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 -select last_name 姓名,department_id 部门号 from employees where employee_id = 176; - - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -select * from departments; - - - - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -select * from employees where !(salary BETWEEN 5000 and 12000); - - -# 2.选择在20或50号部门工作的员工姓名和部门号 -select last_name,department_id from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id -select last_name,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -select last_name,salary,commission_pct from employees where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 -select last_name from employees where last_name like "__尔"; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -select last_name from employees where last_name like "%特%" "%尔%"; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -select * from employees where first_name like "%尔"; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -select last_name,department_name from employees e , departments d where e.department_id BETWEEN 80 and 100 && d.department_id=e.department_id; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -select last_name, salary,manager_id from employees where manager_id in (100,101,110); - - - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select last_name,department_id,salary*12 年薪 from employees ORDER BY 年薪 desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 -select last_name,salary from employees where !(salary between 8000 and 17000) ORDER BY salary desc LIMIT 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select * from employees where email like "%e%" ORDER BY LENGTH(email) desc ,department_id; - - - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -SELECT last_name,e.department_id,department_name from employees e ,departments d where e.department_id=d.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id -select job_id from employees e,locations l , departments d where e.department_id=d.department_id && d.location_id=l.location_id && employee_id=90; -select l.location_id from employees e,locations l , departments d where e.department_id=d.department_id && d.location_id=l.location_id && d.department_id=90; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city -select last_name,department_name,d.location_id,city from employees e LEFT JOIN departments d on e.department_id=d.department_id LEFT JOIN locations l on l.location_id=d.location_id where e.commission_pct is not null; - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -select last_name,job_id,d.department_id,department_name from employees e LEFT JOIN departments d on e.department_id=d.department_id LEFT JOIN locations l on l.location_id=d.location_id where city="多伦多"; - -#sql92语法(自然连接): -select last_name,job_id,d.department_id,department_name from employees e , departments d ,locations l where city="多伦多" && e.department_id=d.department_id && l.location_id=d.location_id; - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 -select department_name,state_province,last_name,job_title,salary from employees e LEFT JOIN departments d on e.department_id=d.department_id LEFT JOIN locations l on l.location_id=d.location_id LEFT JOIN jobs j on j.job_id=e.job_id where department_name="行政部"; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 -select last_name 员工姓名, employee_id 员工编号, manager_id 上级的员工编号 from employees; - -# 7.查询哪些部门没有员工 -select department_name from departments d LEFT JOIN employees e on d.department_id= e.department_id where e.department_id is null; - -# 8. 查询哪个城市没有部门 -select city from locations l LEFT JOIN departments d on d.location_id=l.location_id where department_name is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -SELECT e.* from departments d LEFT JOIN employees e on d.department_id=e.department_id where department_name in ('销售部','信息技术部'); - - - - -# 第08章_聚合函数的课后练习 - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -SELECT job_id,max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees GROUP BY job_id; - -#4.选择各个job_id的员工人数 -SELECT job_id, COUNT(employee_id) from employees GROUP BY job_id; - -# 5.查询员工 -select max(salary)-min(salary) 最高工资和最低工资的差距 from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 -select manager_id,min(salary) from employees where manager_id is not null && !(salary<6000) GROUP BY manager_id; - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 -SELECT department_name 部门的名字,location_id,COUNT(employee_id) 员工数量,avg(salary) 平均工资 from employees e LEFT JOIN departments d on d.department_id=e.department_id where department_name is not null GROUP BY d.department_id ORDER BY 平均工资 desc; - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 -SELECT department_name,job_title ,min(salary) from departments d LEFT JOIN employees e on e.department_id=d.department_id LEFT JOIN jobs j on j.job_id=e.job_id where job_title is not null GROUP BY job_title,department_name; - - - - -# 第09章_子查询的课后练习 - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -select last_name,salary from employees where department_id=(select department_id from employees where last_name = '兹洛特基'); - - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -select employee_id,last_name,salary from employees where salary >(select avg(salary) from employees); - - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary -select last_name,job_id,salary from employees where salary>(select max(salary) from employees where job_id='SA_MAN'); - - - -#4.查询姓名中包含字母尔的员工在相同部门的员工的员工号和姓名 -select employee_id,last_name from employees where department_id in (SELECT department_id from employees where first_name like "%尔%"); - - -#5.查询部门的location_id为1700的部门工作的员工的员工号 -SELECT employee_id from employees where department_id in (SELECT department_id from departments where location_id=1700); - - - -#6.查询管理者是 金 的员工姓名和工资 -SELECT last_name ,salary from employees where department_id=(SELECT department_id from employees where last_name ='金' && manager_id is null); - - -#7.查询工资最低的员工信息: last_name, salary -SELECT last_name,salary from employees where salary=(SELECT min(salary) from employees); - - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 -SELECT * from departments where department_id=(SELECT department_id from employees where department_id is not null GROUP BY department_id ORDER BY avg(salary) LIMIT 1); - - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -SELECT avg(salary) from employees where department_id=(SELECT department_id from employees where department_id is not null GROUP BY department_id ORDER BY avg(salary) LIMIT 1); - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 -SELECT * from jobs where job_title=(SELECT job_title from employees e LEFT JOIN departments d on d.department_id=e.department_id LEFT JOIN jobs j on j.job_id=e.job_id GROUP BY job_title ORDER BY avg(salary) desc LIMIT 1); - - - -#11.查询平均工资高于公司平均工资的部门有哪些? -SELECT department_id,department_name from departments where department_id in (select department_id from employees where department_id is not null GROUP BY department_id HAVING avg(salary) >(SELECT avg(salary) from employees)); - - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 -select e1.* from employees e1 LEFT JOIN employees e2 on e1.department_id=e2.department_id where e1.manager_id is null; - - -#方式2:子查询 -#员工编号=(管理员编号有哪些) -SELECT * from employees where employee_id =(SELECT employee_id from employees where manager_id is null); - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? -SELECT min(salary) from employees where department_id=(SELECT department_id from employees where department_id is not null GROUP BY department_id ORDER BY max(salary) LIMIT 1); - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary - -SELECT * from employees where manager_id is null && department_id=( -SELECT department_id from employees GROUP BY department_id ORDER BY avg(salary) desc LIMIT 1); - - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -SELECT distinct department_id from employees where !(job_id = "ST_CLERK") && department_id is not null; - - -#16. 选择所有没有管理者的员工的last_name -SELECT last_name from employees where manager_id is null; - - -#17.查询员工号、姓名、雇用时间、工资 -#方式1: -SELECT employee_id,last_name,hire_date,salary from employees ; - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 -select employee_id,last_name,salary from employees e ,(SELECT department_id,avg(salary) 部门平均工资 from employees where department_id is not null GROUP BY department_id) n where e.department_id =n.department_id && e.salary>n.`部门平均工资`; - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -SELECT department_name from departments d, -(SELECT department_id,COUNT(department_id) 部门数 from employees where department_id is not null GROUP BY department_id) n where d.department_id=n.department_id && n.`部门数`>5; - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) -SELECT c.country_id from countries c , -(SELECT location_id,country_id from locations) l, -(SELECT * from departments) d where c.country_id =l.country_id && l.location_id=d.location_id GROUP BY c.country_id HAVING COUNT(d.department_id)>2; -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - - -``` - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230920 \347\254\254\344\271\235\346\254\241\344\275\234\344\270\232 RABC/2023\345\271\2649\346\234\21020\346\227\245 RBAC.md" "b/53 \345\221\250\345\216\232\350\276\260/20230920 \347\254\254\344\271\235\346\254\241\344\275\234\344\270\232 RABC/2023\345\271\2649\346\234\21020\346\227\245 RBAC.md" deleted file mode 100644 index f80539b599a7139e0e2aca84d6ef2bea7353a7bd..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230920 \347\254\254\344\271\235\346\254\241\344\275\234\344\270\232 RABC/2023\345\271\2649\346\234\21020\346\227\245 RBAC.md" +++ /dev/null @@ -1,126 +0,0 @@ -# 2023年9月20日 笔记 - -## RBAC:基于角色的权限访问控制模型 - -### RBAC的模型中包括用户(U)、角色(R)和许可权(P)等3类实体集合。 - -### RABC权限管理的核心部分,其他的版本都是建立在0的基础上的,看一下类图: - -![img](https://pic3.zhimg.com/80/v2-edd20453fd895b0f7ca83681a511e8c2_720w.webp) - - -![img](https://pic2.zhimg.com/80/v2-b05736b11ae947bb3aaa035ce68edbd5_720w.webp) - - ![img](https://pic1.zhimg.com/80/v2-7f6d1c11f58d7806082234322fc2d1e0_720w.webp) - -### RBAC的核心是:角色 - -#### 基于角色的访问控制(RBAC)已成为高级访问控制的主要方法之一。通过RBAC,您可以控制最终用户在广义和精细级别上可以做什么。您可以指定用户是管理员,专家用户还是最终用户,并使角色和访问权限与组织中员工的职位保持一致。仅根据需要为员工完成工作的足够访问权限来分配权限。通过上面的介绍相信一定会让你有所收获。对我接下来的 [Spring Security 实战干货](https://link.zhihu.com/?target=https%3A//felord.cn/) 集成 **RBAC** 也是提前预一下热。其实不管你使用什么安全框架, **RBAC** 都是必须掌握的。如果你有什么问题可以留言讨论。也可以通过关注公众号 **Felordcn** 与我联系。 - - - -```mysql -drop database if exists test; -create database test charset utf8; -use test; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:29:03 */ -/*==============================================================*/ - - -drop table if exists access; - -drop table if exists access2; - -drop table if exists login; - -drop table if exists role; - -drop table if exists user; - -/*==============================================================*/ -/* Table: access */ -/*==============================================================*/ -create table access -( - access_No int not null auto_increment, - menu varchar(20) not null, - primary key (access_No) -); - -/*==============================================================*/ -/* Table: access2 */ -/*==============================================================*/ -create table access2 -( - access_No int not null, - role_ID int not null, - primary key (access_No, role_ID) -); - -/*==============================================================*/ -/* Table: login */ -/*==============================================================*/ -create table login -( - role_ID int not null, - user_ID int not null, - primary key (role_ID, user_ID) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_ID int(3) not null auto_increment, - role_name varchar(4), - primary key (role_ID) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_ID int not null auto_increment, - user_name varchar(15) not null, - password varchar(15) not null, - primary key (user_ID) -); - -alter table access2 add constraint FK_access foreign key (access_No) - references access (access_No) on delete restrict on update restrict; - -alter table access2 add constraint FK_access2 foreign key (role_ID) - references role (role_ID) on delete restrict on update restrict; - -alter table login add constraint FK_login foreign key (role_ID) - references role (role_ID) on delete restrict on update restrict; - -alter table login add constraint FK_login2 foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - - -``` - -```mysql -SELECT - u.user_name 姓名,role_name 角色,menu 权限 -FROM - access a, - access2 a2, - login l, - role r, - `user` u -WHERE -a.access_No=a2.access_No && -a2.role_ID=r.role_ID && -l.user_ID=u.user_ID && -l.role_ID=r.role_ID && -u.user_name='zhc' && u.`password`=110; - -``` - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230921 \347\254\254\345\215\201\346\254\241\344\275\234\344\270\232 SKU/SKU.md" "b/53 \345\221\250\345\216\232\350\276\260/20230921 \347\254\254\345\215\201\346\254\241\344\275\234\344\270\232 SKU/SKU.md" deleted file mode 100644 index 92308a176568b901552c004fd12aa49363c22730..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230921 \347\254\254\345\215\201\346\254\241\344\275\234\344\270\232 SKU/SKU.md" +++ /dev/null @@ -1,277 +0,0 @@ -# 2023年9月22日 SKU知识 - -### 笔记: - -SKU是库存单位的一种标识,全称为Stock Keeping Unit,即库存管理单位。它是用来区分不同产品、不同规格、不同颜色、不同尺寸等特征的标识码。每个SKU都具有唯一性,可以用于对商品进行售卖、库存管理和跟踪。 - -SKU通常由一串字母、数字或符号组成,可以根据需要进行自定义。它可以包含有关产品的各种信息,如品牌、型号、颜色、尺寸、配置等,以便更好地区分和管理商品。通过使用SKU,商家可以更准确地追踪库存、管理订单、进行销售分析和制定采购计划。 - -SKU在零售业特别重要,可以帮助商家更好地管理和销售商品。通过为每个商品分配一个唯一的SKU,商家可以轻松识别和跟踪每个商品的销售和库存情况,从而更好地满足客户需求,提高销售效率和利润。 - -总之,SKU是一种用于标识和区分不同商品的库存管理单位,可以帮助商家更好地管理库存、销售和采购。 - -#### HUAWEI 手机 - -### 建库代码: - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 17:34:11 */ -/*==============================================================*/ - -drop database if exists Phone; -create database if not exists Phone charset utf8; -use Phone; - -drop table if exists SKU; - -drop table if exists attributes; - -drop table if exists attributes_relationship; - -drop table if exists attributes_value; - -drop table if exists commodity; - -/*==============================================================*/ -/* Table: SKU */ -/*==============================================================*/ -create table SKU -( - SKU_No int not null auto_increment, - commodity_No int, - SKU_title varchar(100) not null, - primary key (SKU_No) -); - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_No int not null auto_increment, - attributes_name varchar(20) not null, - primary key (attributes_No) -); - -/*==============================================================*/ -/* Table: attributes_relationship */ -/*==============================================================*/ -create table attributes_relationship -( - attributes_relationship int not null auto_increment, - attributes_No int, - attributes_value_No int, - SKU_No int, - primary key (attributes_relationship) -); - -/*==============================================================*/ -/* Table: attributes_value */ -/*==============================================================*/ -create table attributes_value -( - attributes_value_No int not null auto_increment, - attributes_content varchar(50) not null, - primary key (attributes_value_No) -); - -/*==============================================================*/ -/* Table: commodity */ -/*==============================================================*/ -create table commodity -( - commodity_No int not null auto_increment, - commodity_name varchar(20) not null, - commodity_content varchar(100) not null, - primary key (commodity_No) -); - -alter table SKU add constraint FK_Relationship_1 foreign key (commodity_No) - references commodity (commodity_No) on delete restrict on update restrict; - -alter table attributes_relationship add constraint FK_SKU_attribute_relationship foreign key (SKU_No) - references SKU (SKU_No) on delete restrict on update restrict; - -alter table attributes_relationship add constraint FK_attribute_ship foreign key (attributes_No) - references attributes (attributes_No) on delete restrict on update restrict; - -alter table attributes_relationship add constraint FK_attribute_value_ship foreign key (attributes_value_No) - references attributes_value (attributes_value_No) on delete restrict on update restrict; - - -``` - -### 插入数据代码: - -```mysql -/* - Navicat Premium Data Transfer - - Source Server : localhost_3306 - Source Server Type : MySQL - Source Server Version : 80034 - Source Host : localhost:3306 - Source Schema : test - - Target Server Type : MySQL - Target Server Version : 80034 - File Encoding : 65001 - - Date: 21/09/2023 17:33:55 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for attributes --- ---------------------------- -DROP TABLE IF EXISTS `attributes`; -CREATE TABLE `attributes` ( - `attributes_No` int NOT NULL AUTO_INCREMENT, - `attributes_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`attributes_No`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of attributes --- ---------------------------- -INSERT INTO `attributes` VALUES (1, '颜色'); -INSERT INTO `attributes` VALUES (2, '内存'); - --- ---------------------------- --- Table structure for attributes_relationship --- ---------------------------- -DROP TABLE IF EXISTS `attributes_relationship`; -CREATE TABLE `attributes_relationship` ( - `attributes_relationship` int NOT NULL AUTO_INCREMENT, - `attributes_No` int NULL DEFAULT NULL, - `attributes_value_No` int NULL DEFAULT NULL, - `SKU_No` int NULL DEFAULT NULL, - PRIMARY KEY (`attributes_relationship`) USING BTREE, - INDEX `FK_SKU_attribute_relationship`(`SKU_No` ASC) USING BTREE, - INDEX `FK_attribute_ship`(`attributes_No` ASC) USING BTREE, - INDEX `FK_attribute_value_ship`(`attributes_value_No` ASC) USING BTREE, - CONSTRAINT `FK_attribute_ship` FOREIGN KEY (`attributes_No`) REFERENCES `attributes` (`attributes_No`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_attribute_value_ship` FOREIGN KEY (`attributes_value_No`) REFERENCES `attributes_value` (`attributes_value_No`) ON DELETE RESTRICT ON UPDATE RESTRICT, - CONSTRAINT `FK_SKU_attribute_relationship` FOREIGN KEY (`SKU_No`) REFERENCES `sku` (`SKU_No`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 37 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of attributes_relationship --- ---------------------------- -INSERT INTO `attributes_relationship` VALUES (1, 1, 2, 1); -INSERT INTO `attributes_relationship` VALUES (2, 2, 4, 1); -INSERT INTO `attributes_relationship` VALUES (3, 1, 1, 2); -INSERT INTO `attributes_relationship` VALUES (4, 2, 4, 2); -INSERT INTO `attributes_relationship` VALUES (5, 1, 3, 3); -INSERT INTO `attributes_relationship` VALUES (6, 2, 4, 3); -INSERT INTO `attributes_relationship` VALUES (7, 1, 2, 4); -INSERT INTO `attributes_relationship` VALUES (8, 2, 5, 4); -INSERT INTO `attributes_relationship` VALUES (9, 1, 1, 5); -INSERT INTO `attributes_relationship` VALUES (10, 2, 5, 5); -INSERT INTO `attributes_relationship` VALUES (11, 1, 3, 6); -INSERT INTO `attributes_relationship` VALUES (12, 2, 5, 6); -INSERT INTO `attributes_relationship` VALUES (13, 1, 2, 7); -INSERT INTO `attributes_relationship` VALUES (14, 2, 4, 7); -INSERT INTO `attributes_relationship` VALUES (15, 1, 1, 8); -INSERT INTO `attributes_relationship` VALUES (16, 2, 4, 8); -INSERT INTO `attributes_relationship` VALUES (17, 1, 3, 9); -INSERT INTO `attributes_relationship` VALUES (18, 2, 4, 9); -INSERT INTO `attributes_relationship` VALUES (19, 1, 2, 10); -INSERT INTO `attributes_relationship` VALUES (20, 2, 5, 10); -INSERT INTO `attributes_relationship` VALUES (21, 1, 1, 11); -INSERT INTO `attributes_relationship` VALUES (22, 2, 5, 11); -INSERT INTO `attributes_relationship` VALUES (23, 1, 3, 12); -INSERT INTO `attributes_relationship` VALUES (24, 2, 5, 12); -INSERT INTO `attributes_relationship` VALUES (25, 1, 2, 13); -INSERT INTO `attributes_relationship` VALUES (26, 2, 4, 13); -INSERT INTO `attributes_relationship` VALUES (27, 1, 1, 14); -INSERT INTO `attributes_relationship` VALUES (28, 2, 4, 14); -INSERT INTO `attributes_relationship` VALUES (29, 1, 3, 15); -INSERT INTO `attributes_relationship` VALUES (30, 2, 4, 15); -INSERT INTO `attributes_relationship` VALUES (31, 1, 2, 16); -INSERT INTO `attributes_relationship` VALUES (32, 2, 5, 16); -INSERT INTO `attributes_relationship` VALUES (33, 1, 1, 17); -INSERT INTO `attributes_relationship` VALUES (34, 2, 5, 17); -INSERT INTO `attributes_relationship` VALUES (35, 1, 3, 18); -INSERT INTO `attributes_relationship` VALUES (36, 2, 5, 18); - --- ---------------------------- --- Table structure for attributes_value --- ---------------------------- -DROP TABLE IF EXISTS `attributes_value`; -CREATE TABLE `attributes_value` ( - `attributes_value_No` int NOT NULL AUTO_INCREMENT, - `attributes_content` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`attributes_value_No`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of attributes_value --- ---------------------------- -INSERT INTO `attributes_value` VALUES (1, '红色'); -INSERT INTO `attributes_value` VALUES (2, '蓝色'); -INSERT INTO `attributes_value` VALUES (3, '绿色'); -INSERT INTO `attributes_value` VALUES (4, '512G'); -INSERT INTO `attributes_value` VALUES (5, '256G'); - --- ---------------------------- --- Table structure for commodity --- ---------------------------- -DROP TABLE IF EXISTS `commodity`; -CREATE TABLE `commodity` ( - `commodity_No` int NOT NULL AUTO_INCREMENT, - `commodity_name` varchar(20) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - `commodity_content` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`commodity_No`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of commodity --- ---------------------------- -INSERT INTO `commodity` VALUES (1, '华为Mate60 Pro', '华为NB'); -INSERT INTO `commodity` VALUES (2, '华为Mate70 Pro', '华为吊炸天'); -INSERT INTO `commodity` VALUES (3, '华为Mate80 Pro', '华为牛逼轰轰'); - --- ---------------------------- --- Table structure for sku --- ---------------------------- -DROP TABLE IF EXISTS `sku`; -CREATE TABLE `sku` ( - `SKU_No` int NOT NULL AUTO_INCREMENT, - `commodity_No` int NULL DEFAULT NULL, - `SKU_title` varchar(100) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL, - PRIMARY KEY (`SKU_No`) USING BTREE, - INDEX `FK_Relationship_1`(`commodity_No` ASC) USING BTREE, - CONSTRAINT `FK_Relationship_1` FOREIGN KEY (`commodity_No`) REFERENCES `commodity` (`commodity_No`) ON DELETE RESTRICT ON UPDATE RESTRICT -) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb3 COLLATE = utf8mb3_general_ci ROW_FORMAT = Dynamic; - --- ---------------------------- --- Records of sku --- ---------------------------- -INSERT INTO `sku` VALUES (1, 1, '华为(HUAWEI)旗舰手机Mat60 Pro 512G 蓝色'); -INSERT INTO `sku` VALUES (2, 1, '华为(HUAWEI)旗舰手机Mat60 Pro 512G 红色'); -INSERT INTO `sku` VALUES (3, 1, '华为(HUAWEI)旗舰手机Mat60 Pro 512G 绿色'); -INSERT INTO `sku` VALUES (4, 1, '华为(HUAWEI)旗舰手机Mat60 Pro 256G 蓝色'); -INSERT INTO `sku` VALUES (5, 1, '华为(HUAWEI)旗舰手机Mat60 Pro 256G 红色'); -INSERT INTO `sku` VALUES (6, 1, '华为(HUAWEI)旗舰手机Mat60 Pro 256G 绿色'); -INSERT INTO `sku` VALUES (7, 2, '华为(HUAWEI)旗舰手机Mat70 Pro 512G 蓝色'); -INSERT INTO `sku` VALUES (8, 2, '华为(HUAWEI)旗舰手机Mat70 Pro 512G 红色'); -INSERT INTO `sku` VALUES (9, 2, '华为(HUAWEI)旗舰手机Mat70 Pro 512G 绿色'); -INSERT INTO `sku` VALUES (10, 2, '华为(HUAWEI)旗舰手机Mat70 Pro 256G 蓝色'); -INSERT INTO `sku` VALUES (11, 2, '华为(HUAWEI)旗舰手机Mat70 Pro 256G 红色'); -INSERT INTO `sku` VALUES (12, 2, '华为(HUAWEI)旗舰手机Mat70 Pro 256G 绿色'); -INSERT INTO `sku` VALUES (13, 3, '华为(HUAWEI)旗舰手机Mat80 Pro 512G 蓝色'); -INSERT INTO `sku` VALUES (14, 3, '华为(HUAWEI)旗舰手机Mat80 Pro 512G 红色'); -INSERT INTO `sku` VALUES (15, 3, '华为(HUAWEI)旗舰手机Mat80 Pro 512G 绿色'); -INSERT INTO `sku` VALUES (16, 3, '华为(HUAWEI)旗舰手机Mat80 Pro 256G 蓝色'); -INSERT INTO `sku` VALUES (17, 3, '华为(HUAWEI)旗舰手机Mat80 Pro 256G 红色'); -INSERT INTO `sku` VALUES (18, 3, '华为(HUAWEI)旗舰手机Mat80 Pro 256G 绿色'); - -SET FOREIGN_KEY_CHECKS = 1; - -``` - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/CF.md" "b/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/CF.md" deleted file mode 100644 index d59f8edfcaa76d65ed3f6210567a6f15b91dd68c..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/CF.md" +++ /dev/null @@ -1,204 +0,0 @@ -# 2023年9月14日 自创数据库 - -# CF:穿越火线 - -### 需求分析: - -##### 顶层主体:保卫者、潜伏者 - -##### 次主体:枪械、角色、击杀记录、模式、地图、对抗、对抗结果 - -保卫者:ID,角色,枪械 - -潜伏者:ID,角色,枪械 - ---- - -ER图: - -[![pPWk3tA.md.png](https://z1.ax1x.com/2023/09/14/pPWk3tA.md.png)](https://imgse.com/i/pPWk3tA) - -MySQL代码: - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 22:12:42 */ -/*==============================================================*/ - -drop database if exists CF; -create database if not exists CF charset utf8; -use CF; - -drop table if exists VS; - -drop table if exists VS_result; - -drop table if exists aggressor; - -drop table if exists aggressor_result; - -drop table if exists `character`; - -drop table if exists defence; - -drop table if exists defence_result; - -drop table if exists firearms; - -drop table if exists map; - -drop table if exists model; - -/*==============================================================*/ -/* Table: VS */ -/*==============================================================*/ -create table VS -( - VS_No int not null auto_increment, - model_No int, - map_No int, - defence_ID int, - aggressor_ID int, - primary key (VS_No) -); - -/*==============================================================*/ -/* Table: VS_result */ -/*==============================================================*/ -create table VS_result -( - result_No int not null auto_increment, - VS_No int, - VS_result char(5) not null, - struck_down int not null, - die int not null, - assist int not null, - primary key (result_No) -); - -/*==============================================================*/ -/* Table: aggressor */ -/*==============================================================*/ -create table aggressor -( - aggressor_ID int not null auto_increment, - character_No int, - firearms_No int, - primary key (aggressor_ID) -); - -/*==============================================================*/ -/* Table: aggressor_result */ -/*==============================================================*/ -create table aggressor_result -( - result_No int not null, - aggressor_ID int not null, - primary key (result_No, aggressor_ID) -); - -/*==============================================================*/ -/* Table: character */ -/*==============================================================*/ -create table `character` -( - character_No int not null auto_increment, - character_name char(10) not null, - character_sex char(1) not null, - primary key (character_No) -); - -/*==============================================================*/ -/* Table: defence */ -/*==============================================================*/ -create table defence -( - defence_ID int not null auto_increment, - character_No int, - firearms_No int, - primary key (defence_ID) -); - -/*==============================================================*/ -/* Table: defence_result */ -/*==============================================================*/ -create table defence_result -( - result_No int not null, - defence_ID int not null, - primary key (result_No, defence_ID) -); - -/*==============================================================*/ -/* Table: firearms */ -/*==============================================================*/ -create table firearms -( - firearms_No int not null auto_increment, - firearms_name char(10) not null, - firearms_type char(5) not null, - primary key (firearms_No) -); - -/*==============================================================*/ -/* Table: map */ -/*==============================================================*/ -create table map -( - map_No int not null auto_increment, - map_name char(10) not null, - primary key (map_No) -); - -/*==============================================================*/ -/* Table: model */ -/*==============================================================*/ -create table model -( - model_No int not null auto_increment, - model_name char(10) not null, - primary key (model_No) -); - -alter table VS add constraint FK_aggressor_VS foreign key (aggressor_ID) - references aggressor (aggressor_ID) on delete restrict on update restrict; - -alter table VS add constraint FK_choose_map foreign key (map_No) - references map (map_No) on delete restrict on update restrict; - -alter table VS add constraint FK_choose_model foreign key (model_No) - references model (model_No) on delete restrict on update restrict; - -alter table VS add constraint FK_defence_VS foreign key (defence_ID) - references defence (defence_ID) on delete restrict on update restrict; - -alter table VS_result add constraint FK_VS_result foreign key (VS_No) - references VS (VS_No) on delete restrict on update restrict; - -alter table aggressor add constraint FK_aggressor_character foreign key (character_No) - references `character` (character_No) on delete restrict on update restrict; - -alter table aggressor add constraint FK_aggressor_firearms foreign key (firearms_No) - references firearms (firearms_No) on delete restrict on update restrict; - -alter table aggressor_result add constraint FK_aggressor_result foreign key (result_No) - references VS_result (result_No) on delete restrict on update restrict; - -alter table aggressor_result add constraint FK_aggressor_result2 foreign key (aggressor_ID) - references aggressor (aggressor_ID) on delete restrict on update restrict; - -alter table defence add constraint FK_defence_character foreign key (character_No) - references `character` (character_No) on delete restrict on update restrict; - -alter table defence add constraint FK_defence_firearms foreign key (firearms_No) - references firearms (firearms_No) on delete restrict on update restrict; - -alter table defence_result add constraint FK_defence_result foreign key (result_No) - references VS_result (result_No) on delete restrict on update restrict; - -alter table defence_result add constraint FK_defence_result2 foreign key (defence_ID) - references defence (defence_ID) on delete restrict on update restrict; - -``` - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/CF.png" "b/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/CF.png" deleted file mode 100644 index cfe4c004e0281c6534e82d2bcf2272ee51cc5f6a..0000000000000000000000000000000000000000 Binary files "a/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/CF.png" and /dev/null differ diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/CF\357\274\232\347\251\277\350\266\212\347\201\253\347\272\277.sql" "b/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/CF\357\274\232\347\251\277\350\266\212\347\201\253\347\272\277.sql" deleted file mode 100644 index def5258f4ff0e6b3d37f622dcf08bb0c3ce85515..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/CF\357\274\232\347\251\277\350\266\212\347\201\253\347\272\277.sql" +++ /dev/null @@ -1,179 +0,0 @@ -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 22:12:42 */ -/*==============================================================*/ - -drop database if exists CF; -create database if not exists CF charset utf8; -use CF; - -drop table if exists VS; - -drop table if exists VS_result; - -drop table if exists aggressor; - -drop table if exists aggressor_result; - -drop table if exists `character`; - -drop table if exists defence; - -drop table if exists defence_result; - -drop table if exists firearms; - -drop table if exists map; - -drop table if exists model; - -/*==============================================================*/ -/* Table: VS */ -/*==============================================================*/ -create table VS -( - VS_No int not null auto_increment, - model_No int, - map_No int, - defence_ID int, - aggressor_ID int, - primary key (VS_No) -); - -/*==============================================================*/ -/* Table: VS_result */ -/*==============================================================*/ -create table VS_result -( - result_No int not null auto_increment, - VS_No int, - VS_result char(5) not null, - struck_down int not null, - die int not null, - assist int not null, - primary key (result_No) -); - -/*==============================================================*/ -/* Table: aggressor */ -/*==============================================================*/ -create table aggressor -( - aggressor_ID int not null auto_increment, - character_No int, - firearms_No int, - primary key (aggressor_ID) -); - -/*==============================================================*/ -/* Table: aggressor_result */ -/*==============================================================*/ -create table aggressor_result -( - result_No int not null, - aggressor_ID int not null, - primary key (result_No, aggressor_ID) -); - -/*==============================================================*/ -/* Table: character */ -/*==============================================================*/ -create table `character` -( - character_No int not null auto_increment, - character_name char(10) not null, - character_sex char(1) not null, - primary key (character_No) -); - -/*==============================================================*/ -/* Table: defence */ -/*==============================================================*/ -create table defence -( - defence_ID int not null auto_increment, - character_No int, - firearms_No int, - primary key (defence_ID) -); - -/*==============================================================*/ -/* Table: defence_result */ -/*==============================================================*/ -create table defence_result -( - result_No int not null, - defence_ID int not null, - primary key (result_No, defence_ID) -); - -/*==============================================================*/ -/* Table: firearms */ -/*==============================================================*/ -create table firearms -( - firearms_No int not null auto_increment, - firearms_name char(10) not null, - firearms_type char(5) not null, - primary key (firearms_No) -); - -/*==============================================================*/ -/* Table: map */ -/*==============================================================*/ -create table map -( - map_No int not null auto_increment, - map_name char(10) not null, - primary key (map_No) -); - -/*==============================================================*/ -/* Table: model */ -/*==============================================================*/ -create table model -( - model_No int not null auto_increment, - model_name char(10) not null, - primary key (model_No) -); - -alter table VS add constraint FK_aggressor_VS foreign key (aggressor_ID) - references aggressor (aggressor_ID) on delete restrict on update restrict; - -alter table VS add constraint FK_choose_map foreign key (map_No) - references map (map_No) on delete restrict on update restrict; - -alter table VS add constraint FK_choose_model foreign key (model_No) - references model (model_No) on delete restrict on update restrict; - -alter table VS add constraint FK_defence_VS foreign key (defence_ID) - references defence (defence_ID) on delete restrict on update restrict; - -alter table VS_result add constraint FK_VS_result foreign key (VS_No) - references VS (VS_No) on delete restrict on update restrict; - -alter table aggressor add constraint FK_aggressor_character foreign key (character_No) - references `character` (character_No) on delete restrict on update restrict; - -alter table aggressor add constraint FK_aggressor_firearms foreign key (firearms_No) - references firearms (firearms_No) on delete restrict on update restrict; - -alter table aggressor_result add constraint FK_aggressor_result foreign key (result_No) - references VS_result (result_No) on delete restrict on update restrict; - -alter table aggressor_result add constraint FK_aggressor_result2 foreign key (aggressor_ID) - references aggressor (aggressor_ID) on delete restrict on update restrict; - -alter table defence add constraint FK_defence_character foreign key (character_No) - references `character` (character_No) on delete restrict on update restrict; - -alter table defence add constraint FK_defence_firearms foreign key (firearms_No) - references firearms (firearms_No) on delete restrict on update restrict; - -alter table defence_result add constraint FK_defence_result foreign key (result_No) - references VS_result (result_No) on delete restrict on update restrict; - -alter table defence_result add constraint FK_defence_result2 foreign key (defence_ID) - references defence (defence_ID) on delete restrict on update restrict; - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/ConceptualDataModel_1.ldm" "b/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/ConceptualDataModel_1.ldm" deleted file mode 100644 index 561dca337c0287ca6cccb464ac784bc2aebdee0b..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/ConceptualDataModel_1.ldm" +++ /dev/null @@ -1,3317 +0,0 @@ - - - - - - - - - -97B017EB-1881-45B3-A485-C7DDA54BDE63 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694699446 -榨菜 -1694699472 -榨菜 -ORG {9D76193E-911A-488B-B9E4-7E80FC76CDA2} -DAT 1694699456 -ATT MOPT -ATT FOPT -[FolderOptions] - -[FolderOptions\Common] -GenerationCheckModel=Yes -GenerationPath= -GenerationOptions= -GenerationTasks= -GenerationTargets= -GenerationSelections= - -[FolderOptions\CheckModel] - -[FolderOptions\CheckModel\Package] - -[FolderOptions\CheckModel\Package\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\GenrCircularityYes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\GenrCircularityNo] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\ShortcutUniqCode] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Package\ChildShortcut] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain] - -[FolderOptions\CheckModel\Domain\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckOtherDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity] - -[FolderOptions\CheckModel\Entity\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\MaxLen - NAME] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EmptyColl - PENTCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttNbSerials] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EmptyColl - IDTFCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EmptyCollYesYes] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttSamePrnt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttMultInhr] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttSevInhr] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\PidtfInhrAtt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute] - -[FolderOptions\CheckModel\Entity.Entity Attribute\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\AttrDiffDomn] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckOtherDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier] - -[FolderOptions\CheckModel\Entity.Identifier\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\EmptyColl - PENTCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckIncludeColl - Entt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\IdtfChildPIdtf] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship] - -[FolderOptions\CheckModel\Relationship\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshReflexiveDeptYes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshReflexiveDeptNo] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshBject] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshMany] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance] - -[FolderOptions\CheckModel\Inheritance\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\EmptyColl - CHILDCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\InhrComplete] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Replication] - -[FolderOptions\CheckModel\Replication\PartialReplication] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule] - -[FolderOptions\CheckModel\Business Rule\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\EmptyColl - OBJCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object] - -[FolderOptions\CheckModel\Extended Object\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link] - -[FolderOptions\CheckModel\Extended Link\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File] - -[FolderOptions\CheckModel\File\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckPathExists] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format] - -[FolderOptions\CheckModel\Data Format\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckDataFormatNullExpression] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes -[ModelOptions] - -[ModelOptions\Logical options] -CaseSensitive=No -DisplayName=Yes -EnableTrans=No -UseTerm=No -EnableRequirements=No -EnableFullShortcut=Yes -Notation=4 -RlshUnique=Yes -DefaultDttp= -DomnCopyDttp=Yes -DomnCopyChck=No -DomnCopyRule=No -DomnCopyExat=No -DomnCopyMand=No -DttpFullName=Yes -RlshMigrateDomain=Yes -RlshMigrateCheck=Yes -RlshMigrateRule=Yes -RlshMigrateExtd=Yes -RlshAllowNN=No -RlshGenNN=No -FKNameTemplate=%.3:PARENT%_%ATTRIBUTE% -FKNameTemplateUsage=No -RlshAsstTmpl=Each %Entity1.Name%[CRLF].if %Entity1ToEntity2RoleMandatory%[CRLF] must[CRLF].else[CRLF] may[CRLF].endif[CRLF].if %Entity1ToEntity2Role%[CRLF] %.L:Entity1ToEntity2Role%[CRLF].else[CRLF] have[CRLF].endif[CRLF].if %Entity1ToEntity2RoleMaximumCardinality%==1[CRLF].if %Entity1ToEntity2RoleMandatory%[CRLF] one and only one[CRLF].else[CRLF] at most one[CRLF].endif[CRLF].else[CRLF] one or more[CRLF].endif[CRLF].if %Entity1%==%Entity2%[CRLF] other[CRLF].endif[CRLF] %Entity2.Name%.[CRLF]Each %Entity2.Name%[CRLF].if %Entity2ToEntity1RoleMandatory%[CRLF] must[CRLF].else[CRLF] may[CRLF].endif[CRLF].if %Entity2ToEntity1Role%[CRLF] %.L:Entity2ToEntity1Role%[CRLF].else[CRLF] have[CRLF].endif[CRLF].if %Entity2ToEntity1RoleMaximumCardinality%==1[CRLF].if %Entity2ToEntity1RoleMandatory%[CRLF] one and only one[CRLF].else[CRLF] at most one[CRLF].endif[CRLF].else[CRLF] one or more[CRLF].endif[CRLF].if %Entity1%==%Entity2%[CRLF] other[CRLF].endif[CRLF] %Entity1.Name%. -RlshAsstExt= - -[ModelOptions\Logical options\NamingOptionsTemplates] - -[ModelOptions\Logical options\ClssNamingOptions] - -[ModelOptions\Logical options\ClssNamingOptions\FILO] - -[ModelOptions\Logical options\ClssNamingOptions\FILO\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FILO\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FRMEOBJ] - -[ModelOptions\Logical options\ClssNamingOptions\FRMEOBJ\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FRMEOBJ\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FRMELNK] - -[ModelOptions\Logical options\ClssNamingOptions\FRMELNK\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FRMELNK\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\DefaultClass] - -[ModelOptions\Logical options\ClssNamingOptions\DefaultClass\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\DefaultClass\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMPCKG] - -[ModelOptions\Logical options\ClssNamingOptions\LDMPCKG\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMPCKG\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMDOMN] - -[ModelOptions\Logical options\ClssNamingOptions\LDMDOMN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMDOMN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMENTT] - -[ModelOptions\Logical options\ClssNamingOptions\LDMENTT\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMENTT\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMPROP] - -[ModelOptions\Logical options\ClssNamingOptions\LDMPROP\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMPROP\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMIDTF] - -[ModelOptions\Logical options\ClssNamingOptions\LDMIDTF\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMIDTF\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMRLSH] - -[ModelOptions\Logical options\ClssNamingOptions\LDMRLSH\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMRLSH\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMINHR] - -[ModelOptions\Logical options\ClssNamingOptions\LDMINHR\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMINHR\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Generate] - -[ModelOptions\Generate\Cdm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No - -[ModelOptions\Generate\Pdm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No -BuildTrgr=No -TablePrefix= -IndxPKName=%TABLE%_PK -IndxAKName=%TABLE%_AK -IndxFKName=%REFR%_FK -IndxThreshold= -PreserveMode=Yes - - -37F24EC7-46A8-420F-9F43-AFCAFFBB6591 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694699473 -榨菜 -1694699473 -榨菜 - -0B86E387-9F19-4197-B72B-00B2EDC5A8B7 -CDE44E21-9669-11D1-9914-006097355D9B - - - - -68BD24AE-2E54-4A38-8131-1BC93711D043 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694699457 -榨菜 -1694699457 -榨菜 - -9D76193E-911A-488B-B9E4-7E80FC76CDA2 -1E597170-9350-11D1-AB3C-0020AF71E433 - - - - -FA92831A-9A25-48DE-A1D2-669EDF31AE12 -Diagram_1 -Diagram_1 -1694699456 -榨菜 -1694699456 -榨菜 -ORG {8DEC29B5-62FD-4473-B79B-9EE76BA5C05D} -DAT 1694699456 -[DisplayPreferences] - -[DisplayPreferences\LDM] - -[DisplayPreferences\General] -Adjust to text=Yes -Snap Grid=No -Constrain Labels=Yes -Display Grid=No -Show Page Delimiter=No -Show Links intersections=Yes -Activate automatic link routing=Yes -Grid size=800 -Graphic unit=2 -Window color=192 192 192 -Background image= -Background mode=8 -Watermark image= -Watermark mode=8 -Show watermark on screen=No -Gradient mode=0 -Gradient end color=255 255 255 -Show Swimlane=No -SwimlaneVert=Yes -TreeVert=No -CompDark=0 - -[DisplayPreferences\Object] -Show Icon=No -Mode=2 -Trunc Length=40 -Word Length=40 -Word Text=!"#$%&')*+,-./:;=>?@\]^_`|}~ -Shortcut IntIcon=Yes -Shortcut IntLoct=Yes -Shortcut IntFullPath=No -Shortcut IntLastPackage=Yes -Shortcut ExtIcon=Yes -Shortcut ExtLoct=No -Shortcut ExtFullPath=No -Shortcut ExtLastPackage=Yes -Shortcut ExtIncludeModl=Yes -EObjShowStrn=Yes -ExtendedObject.Comment=No -ExtendedObject.IconPicture=No -ExtendedObject.TextStyle=No -ExtendedObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Object Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -ELnkShowStrn=Yes -ELnkShowName=Yes -ExtendedLink_SymbolLayout=<Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Source" >[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -FileObject.Stereotype=No -FileObject.DisplayName=Yes -FileObject.LocationOrName=No -FileObject.IconPicture=No -FileObject.TextStyle=No -FileObject.IconMode=Yes -FileObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Location" Attribute="LocationOrName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Package.Stereotype=Yes -Package.Comment=No -Package.IconPicture=No -Package.TextStyle=No -Package_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Display Model Version=Yes -Entity.Stereotype=Yes -Entity.Attributes=Yes -Entity.Attributes._Filter="All attributes" CDMPENTALL -Entity.Attributes._Columns=Stereotype IdentifierIndicator DomainOrDataType NullIndicator -Entity.Attributes._Limit=-5 -Entity.Identifiers=Yes -Entity.Identifiers._Columns=Stereotype IdentifierIndicator -Entity.Comment=No -Entity.IconPicture=No -Entity.TextStyle=No -Entity_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" Filters="&quot;All attributes&quot; CDMPENTALL &quot;&quot;\r\n&quot;Primary attributes&quot; CDMPENTPK &quot;\&quot;PIDTF \&quot;TRUE\&quot; TRUE\&quot;&quot;\r\n&quot;Identifying attributes&quot; CDMPENTIDTF &quot;\&quot;AIDF \&quot;TRUE\&quot; TRUE\&quot;&quot;" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Identifiers" Collection="Identifiers" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Relationship.Entity1ToEntity2Role=Yes -Relationship.Entity2ToEntity1RoleCardinality=No -Relationship.Entity1ToEntity2RoleDominant=Yes -Relationship.Stereotype=Yes -Relationship.DisplayName=Yes -Relationship.JoinExpression=No -Relationship.Entity2ToEntity1Role=Yes -Relationship.Entity1ToEntity2RoleCardinality=No -Relationship.Entity2ToEntity1RoleDominant=Yes -Relationship_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity1ToEntity2Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity2ToEntity1RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity1ToEntity2RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity2ToEntity1Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity1ToEntity2RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity2ToEntity1RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -Inheritance.Stereotype=Yes -Inheritance.DisplayName=Yes -Inheritance.IconPicture=No -Inheritance.TextStyle=No -Inheritance_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Association.Stereotype=Yes -Association.Comment=No -Association.Attributes=Yes -Association.Attributes._Columns=Stereotype DataType NullIndicator -Association.Attributes._Limit=-5 -Association.IconPicture=No -Association.TextStyle=No -Association_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -AssociationLink.SymbolCardinality=Yes -AssociationLink.Stereotype=Yes -AssociationLink.Role=Yes -AssociationLink_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Cardinality" Attribute="SymbolCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Role" Attribute="Role" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> - -[DisplayPreferences\Symbol] - -[DisplayPreferences\Symbol\FRMEOBJ] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=6000 -Height=2000 -Brush color=255 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=64 -Brush gradient color=192 192 192 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 255 128 128 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FRMELNK] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FILO] -OBJSTRNFont=新宋体,8,N -OBJSTRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LCNMFont=新宋体,8,N -LCNMFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3600 -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMENTT] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0, 0, 0 -EntityForeignAttributeFont=新宋体,8,N -EntityForeignAttributeFont color=0, 0, 0 -IdentifiersFont=新宋体,8,N -IdentifiersFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=176 186 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 88 74 181 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMRLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 88 74 181 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=Yes -Width=1600 -Height=1000 -Brush color=176 186 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMLINH] -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\USRDEPD] -OBJXSTRFont=新宋体,8,N -OBJXSTRFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=2 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\Free Symbol] -Free TextFont=新宋体,8,N -Free TextFont color=0 0 0 -Line style=0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ENTT] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0 0 0 -IdentifiersFont=新宋体,8,N -IdentifiersFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=176 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 170 170 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\RLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 170 170 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ASSC] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3000 -Brush color=208 208 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINK] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=Yes -Width=1600 -Height=1000 -Brush color=176 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINH] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\CDM] -(8500, 11000) -((315,354), (433,354)) --29257 --29257 - - -((-35354,-4703), (-25306,24248)) -((-25706,23352),(-33554,23352),(-33554,-3710)) -1 -55 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((-20413,-6103), (43656,24248)) -((-20013,23352),(41856,23352),(41856,-5617)) -1 -55 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((22927,-6103), (40335,21193)) -((23327,20297),(38535,20297),(38535,-5110)) -2 -55 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((-33318,-24644), (-195,-22244)) -((-32918,-23444),(-1595,-23444)) -1 -55 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((2395,-22107), (28991,-19707)) -((28591,-20882),(17888,-20882),(17888,-20907),(2795,-20907)) -1 -55 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((-33445,-20487), (1652,-5192)) -((-32395,-5592),(-32395,-19287),(1252,-19287)) -1 -55 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((5785,-20202), (35749,-6499)) -((35349,-6899),(35349,-12904),(19004,-12904),(19004,-19002),(6558,-19002)) -1 -55 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((665,-18416), (4264,-8817)) -((2464,-18016),(2464,-9874)) -1 -55 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((-30094,-6503), (-15917,-4103)) -((-29694,-5303),(-16317,-5303)) -1 -55 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((-16617,-6586), (-2790,-4186)) -((-16217,-5386),(-3190,-5386)) -1 -14080 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((20872,-8264), (35075,-5864)) -((34675,-7064),(21272,-7064)) -1 -55 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((2064,-8268), (21772,-5868)) -((21372,-7068),(2464,-7068)) -1 -14080 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((-32522,-4703), (20174,18740)) -((19774,18340),(19774,11952),(-31322,11952),(-31322,-4253)) -1 -55 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694699472 --1 -((-37702,-7303), (-29406,-3303)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694699472 --1 -((34387,-8703), (42683,-4703)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694699472 --1 -((-25706,21352), (-14320,25352)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694699472 --1 -((17634,18297), (29020,22297)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694699472 --1 -((-38559,-25690), (-27277,-21690)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694699472 --1 -((28591,-21864), (39873,-17864)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - --1 -((-1595,-23798), (7185,-18016)) -0 -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 -1 - - - - - -1694699472 --1 -((-3190,-10217), (8118,-3993)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694699472 --1 -((-20414,-7305), (-12223,-3305)) -11184640 -16759472 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -EntityForeignAttribute 0 新宋体,8,N -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694699472 --1 -((17177,-9106), (25368,-5106)) -11184640 -16759472 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -EntityForeignAttribute 0 新宋体,8,N -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - - - - - - - - -A0D3EDF4-CD74-44C6-A9BA-5635DE8AEEC3 -保卫者 -defence -1694699456 -榨菜 -1694699456 -榨菜 -ORG {602963C5-8C39-4966-AC5C-C8E1577A8C46} -DAT 1694699456 -{\rtf1\ansi\ansicpg936\deff0\nouicompat\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}} -{\*\generator Riched20 10.0.19041}\viewkind4\uc1 -\pard\f0\fs20\lang2052\tab\tab\par -} - - - -A9FEBD68-DA93-4E6E-A41F-3DDB2DF6E746 -Identifier_1 -Identifier_1 -1694699456 -榨菜 -1694699456 -榨菜 -ORG {4BF43456-3916-4937-B56A-78DE03C3F5AE} -DAT 1694699456 - - - - - - - - - - -F0B98C1E-12C7-461B-B787-30B1D5C6C8AF -保卫者ID -defence_ID -1694699456 -榨菜 -1694699456 -榨菜 -ORG {3E08BC56-5FCA-45EC-8D37-9402585A7B1F} -DAT 1694699456 -NO -1 - - -3AF47DC8-0099-4E84-A6D9-8B35977AA455 -角色编号 -character_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {7B317979-D621-47EA-A2D3-E866DFBAC7BD},{472B5A5E-9344-4667-969F-AA20EB2780B2} -DAT 1694699456 -I - - -0F9FDFA5-6C31-4830-9940-F293AC9608DC -枪械编号 -firearms_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {A28D6908-894B-4BE8-887C-B5DE25A1D690},{8DDD6E34-F60E-421A-AB47-AE92B6AEAD79} -DAT 1694699456 -I - - - - -14FEF608-4E2F-4274-B8F0-5E47CCA5DE6D -潜伏者 -aggressor -1694699456 -榨菜 -1694699456 -榨菜 -ORG {CA1594EC-0733-45CD-B0CE-E817617A9C9C} -DAT 1694699456 - - -7843006F-533E-4007-B325-9BF4FE075D1F -Identifier_1 -Identifier_1 -1694699456 -榨菜 -1694699456 -榨菜 -ORG {6F9C4D45-98A2-43B4-99B0-B123B9575443} -DAT 1694699456 - - - - - - - - - - -D3BE9F91-B613-41F5-BA65-7BB3FB10036B -潜伏者ID -aggressor_ID -1694699456 -榨菜 -1694699456 -榨菜 -ORG {95E1F7CB-DC1E-4920-8B45-7250F3625A8E} -DAT 1694699456 -NO -1 - - -B34EFDFF-6067-40E7-A032-B8E845688065 -角色编号 -character_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {7B317979-D621-47EA-A2D3-E866DFBAC7BD},{D4C3B6A3-ED20-4447-AE57-C7C53E38B6DD} -DAT 1694699456 -I - - -4E492B8A-A610-4C27-B285-BCCA2AE5F599 -枪械编号 -firearms_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {A28D6908-894B-4BE8-887C-B5DE25A1D690},{A850D229-531B-4735-A4A5-524D705C91DB} -DAT 1694699456 -I - - - - -4518E1C8-63D4-41EB-9BE7-73A18A9488BB -角色 -character -1694699456 -榨菜 -1694699456 -榨菜 -ORG {0165226C-5055-44A8-9346-78A6C03FBCB6} -DAT 1694699456 - - -699FC8A9-15FD-4AF0-B04E-101050A78695 -Identifier_1 -Identifier_1 -1694699456 -榨菜 -1694699456 -榨菜 -ORG {0CA54FDA-6A01-457E-AD7B-AE1AD15B84DA} -DAT 1694699456 - - - - - - - - - - -36E12F40-615A-4325-B958-288C80860257 -角色编号 -character_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {7B317979-D621-47EA-A2D3-E866DFBAC7BD} -DAT 1694699456 -NO -1 - - -1449036C-0936-4421-9F50-9D281D67A675 -角色姓名 -character_name -1694699456 -榨菜 -1694699456 -榨菜 -ORG {44C75338-D5D1-4011-A04E-31A82E830617} -DAT 1694699456 -A10 -10 -1 - - -D41ADE44-6812-4C55-9C45-9D666FAB0C70 -角色性别 -character_sex -1694699456 -榨菜 -1694699456 -榨菜 -ORG {EA67F1CA-D529-4347-AAB3-24F5777CBAA6} -DAT 1694699456 -A1 -1 -1 - - - - -2C55E804-C7F7-45EE-8E59-7B97DDC41D62 -枪械 -firearms -1694699456 -榨菜 -1694699456 -榨菜 -ORG {FA5EC4FA-E021-4114-B1D9-238629BF00B5} -DAT 1694699456 - - -C85ECCF3-2E6A-43E2-A653-6EBB85E1FF6E -Identifier_1 -Identifier_1 -1694699456 -榨菜 -1694699456 -榨菜 -ORG {32A52C8C-3F3F-4CDC-B5FF-A96B8EBBC832} -DAT 1694699456 - - - - - - - - - - -4FCA9A80-DC77-4C83-ADEB-003CCEC75C3F -枪械编号 -firearms_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {A28D6908-894B-4BE8-887C-B5DE25A1D690} -DAT 1694699456 -NO -1 - - -37538E47-48C8-4BBA-BA78-D20E8610A537 -枪械名称 -firearms_name -1694699456 -榨菜 -1694699456 -榨菜 -ORG {FAF376C3-D299-4F62-9DD7-95A63ADCDAFF} -DAT 1694699456 -A10 -10 -1 - - -812F6AF8-6783-467F-96CE-5699C130AC46 -枪械类型 -firearms_type -1694699456 -榨菜 -1694699456 -榨菜 -ORG {8DECF0A8-70B8-442A-B642-945431DD0311} -DAT 1694699456 -A5 -5 -1 - - - - -9D5828ED-B8EF-4164-BC6E-AB6D43D46EEC -模式 -model -1694699456 -榨菜 -1694699456 -榨菜 -ORG {30C37DD6-BF81-42B6-965D-CCB9402F02D3} -DAT 1694699456 - - -2F98AEEA-342F-43B9-9006-DA27AA359A65 -Identifier_1 -Identifier_1 -1694699456 -榨菜 -1694699456 -榨菜 -ORG {12D4CF48-D8F9-4246-8999-8F004959D8E5} -DAT 1694699456 - - - - - - - - - - -7E81F2D1-7445-4759-9596-0A009DBC8E49 -模式编号 -model_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {6541FC6B-1DAB-465C-9136-C26C520A79DE} -DAT 1694699456 -NO -1 - - -1824C63D-FC3B-479F-B432-F94CFB2355BE -模式名称 -model_name -1694699456 -榨菜 -1694699456 -榨菜 -ORG {69D5A6F7-E66B-4FBC-8B5E-3DFF466E7EE1} -DAT 1694699456 -A10 -10 -1 - - - - -7646D016-F92E-4D55-B59F-02C7011DE253 -地图 -map -1694699456 -榨菜 -1694699456 -榨菜 -ORG {3E71E37F-726E-4249-8586-DFD272D8A250} -DAT 1694699456 - - -DC94FF7E-956D-4ADF-B187-60B338DA3B15 -Identifier_1 -Identifier_1 -1694699456 -榨菜 -1694699456 -榨菜 -ORG {09D9AED5-755A-4CD7-98AB-198CCBFFDD98} -DAT 1694699456 - - - - - - - - - - -F355562F-0D7E-471A-A739-42D8D531C48C -地图编号 -map_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {5FAA33BE-857C-4B41-B952-5269DF9DAD0B} -DAT 1694699456 -NO -1 - - -255FFCA4-7514-45CA-AC06-BFCC66A50D63 -地图名称 -map_name -1694699456 -榨菜 -1694699456 -榨菜 -ORG {419FA10D-C702-41BB-9AC7-53A403CA89B0} -DAT 1694699456 -A10 -10 -1 - - - - -41695125-751C-4C2B-93E8-1174A7A18A17 -对抗 -VS -1694699456 -榨菜 -1694699456 -榨菜 -ORG {7602555D-2E7C-4417-AD28-11CE73119861} -DAT 1694699456 - - -BA9F064D-3E0F-4EE1-A571-B3D238FF2CC5 -Identifier_1 -Identifier_1 -1694699456 -榨菜 -1694699456 -榨菜 -ORG {E06EF8DE-1F9A-4FB5-BCF8-3344998548B5} -DAT 1694699456 - - - - - - - - - - -45DF21D0-BA89-4B1C-A6E6-D3782914738A -对抗编号 -VS_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {4F407D3F-EF12-46BA-9BC6-51717828BFBD} -DAT 1694699456 -NO -1 - - -0E9D69FD-3774-4B4F-AC59-A047EBAB21BF -模式编号 -model_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {6541FC6B-1DAB-465C-9136-C26C520A79DE},{A3E36BFA-BBE8-4CB3-8424-C6F685981F86} -DAT 1694699456 -I - - -C500C568-5EBC-4A86-823A-24696733ABA9 -地图编号 -map_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {5FAA33BE-857C-4B41-B952-5269DF9DAD0B},{E623B725-EAC6-4C64-9AE4-98A38D87BE30} -DAT 1694699456 -I - - -C3041DE5-9041-4E2D-8D74-65C00A849D8C -保卫者ID -defence_ID -1694699456 -榨菜 -1694699456 -榨菜 -ORG {3E08BC56-5FCA-45EC-8D37-9402585A7B1F},{D83A37F7-FC3B-4930-927D-A442E22262F2} -DAT 1694699456 -I - - -FCDC1F03-0CD8-449A-8DA3-F30458276550 -潜伏者ID -aggressor_ID -1694699456 -榨菜 -1694699456 -榨菜 -ORG {95E1F7CB-DC1E-4920-8B45-7250F3625A8E},{E2C0E3EF-9E32-43E9-B1A7-72D7D10FE3C3} -DAT 1694699456 -I - - - - -2EF16A8C-83F5-4C49-8748-4D7B2FDEB832 -对抗结果 -VS_result -1694699456 -榨菜 -1694699456 -榨菜 -ORG {0714CD92-876B-4BED-B13E-28FF61377D2C} -DAT 1694699456 - - -163D491F-2152-41B8-858D-E426CDD6C796 -Identifier_1 -Identifier_1 -1694699456 -榨菜 -1694699456 -榨菜 -ORG {D576B4B0-6F75-4F46-B2ED-0D702CBB8989} -DAT 1694699456 - - - - - - - - - - -997ADF39-7E57-4115-A4B2-90050DEBBF97 -结果编号 -result_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {903FE77B-63DC-47B4-B2CF-E22092737C2E} -DAT 1694699456 -NO -1 - - -3D044BDF-AC6A-4203-877B-50C2F9BB57B9 -对抗编号 -VS_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {4F407D3F-EF12-46BA-9BC6-51717828BFBD},{B40AD1A1-05E2-4E84-9244-07AA66BF23C8} -DAT 1694699456 -I - - -29C0A8DD-1F64-42F1-B48D-26B39C3F9EC8 -对抗结果 -VS_result -1694699456 -榨菜 -1694699456 -榨菜 -ORG {37DE54BD-9766-4926-837F-C57C9CFF0329} -DAT 1694699456 -A5 -5 -1 - - -0D91C72D-2893-4218-BB57-CA78AB0B9AA1 -击杀数 -struck_down -1694699456 -榨菜 -1694699456 -榨菜 -ORG {F63275EB-5EDD-4234-8E3E-E66E17DBABDC} -DAT 1694699456 -I -1 - - -03863B58-E8EA-4B17-98A5-FA3F1C7F194D -死亡数 -die -1694699456 -榨菜 -1694699456 -榨菜 -ORG {FB9A168F-DF28-4B41-96CF-009DF6FA8C3D} -DAT 1694699456 -I -1 - - -CD42CD4C-D872-4E4A-8993-04C28ED49F49 -助攻数 -assist -1694699456 -榨菜 -1694699456 -榨菜 -ORG {94F3547E-B2A2-4BAA-B59C-E1236B3BB2E8} -DAT 1694699456 -I -1 - - - - -6FC453D9-A79E-4304-8803-C68F93610098 -保卫结果 -defence_result -0 - -0 - -ORG {34F0C72B-684B-4F7C-AD9A-996476DF1B22} -DAT 1694699456 - - -7D1F753C-373B-4A76-B504-CD3C5171EA63 -Identifier_1 -Identifier_1 -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - -6496C20B-6A43-4E4C-85C7-30D3BB0196DD -结果编号 -result_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {903FE77B-63DC-47B4-B2CF-E22092737C2E},{34F0C72B-684B-4F7C-AD9A-996476DF1B22} -DAT 1694699456 -I -1 - - -9B661812-2C5C-49A0-984A-8733C0B0B44C -保卫者ID -defence_ID -1694699456 -榨菜 -1694699456 -榨菜 -ORG {3E08BC56-5FCA-45EC-8D37-9402585A7B1F},{34F0C72B-684B-4F7C-AD9A-996476DF1B22} -DAT 1694699456 -I -1 - - - - -FF5AF82F-6E33-4BBD-87EC-F3697D948D0A -潜伏结果 -aggressor_result -0 - -0 - -ORG {86D565B6-338B-4776-BE7D-F01BD31E0E4B} -DAT 1694699456 - - -F11A3C04-F0FD-4E73-9346-9166A8EBA432 -Identifier_1 -Identifier_1 -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - -29030088-C665-4C90-AC8C-EA846D942788 -结果编号 -result_No -1694699456 -榨菜 -1694699456 -榨菜 -ORG {903FE77B-63DC-47B4-B2CF-E22092737C2E},{86D565B6-338B-4776-BE7D-F01BD31E0E4B} -DAT 1694699456 -I -1 - - -4C164414-7CDE-4AF0-B94D-4590403A67BD -潜伏者ID -aggressor_ID -1694699456 -榨菜 -1694699456 -榨菜 -ORG {95E1F7CB-DC1E-4920-8B45-7250F3625A8E},{86D565B6-338B-4776-BE7D-F01BD31E0E4B} -DAT 1694699456 -I -1 - - - - - - -2E63DDE2-C39E-4A8D-8A38-FA5ECA56CA14 -保卫角色 -defence_character -1694699456 -榨菜 -1694699456 -榨菜 -ORG {472B5A5E-9344-4667-969F-AA20EB2780B2} -DAT 1694699456 -0,n -0,1 - - - - - - - - -56152D3D-A923-4887-94E9-92E455B66C0F -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - -79363DB4-04FC-466E-B22B-1487802D2C78 -保卫枪械 -defence_firearms -1694699456 -榨菜 -1694699456 -榨菜 -ORG {8DDD6E34-F60E-421A-AB47-AE92B6AEAD79} -DAT 1694699456 -0,n -0,1 - - - - - - - - -0F2C51A8-71D4-42AC-BAF4-402A824C01A4 -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - -C2C86B42-F979-41AB-A272-B49A4C96ACAA -潜伏角色 -aggressor_character -1694699456 -榨菜 -1694699456 -榨菜 -ORG {D4C3B6A3-ED20-4447-AE57-C7C53E38B6DD} -DAT 1694699456 -0,n -0,1 - - - - - - - - -9961C060-00B9-4C3D-943D-AA18977F5763 -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - -7D2B6874-91C7-49F4-948C-6301061D0B9D -潜伏枪械 -aggressor_firearms -1694699456 -榨菜 -1694699456 -榨菜 -ORG {A850D229-531B-4735-A4A5-524D705C91DB} -DAT 1694699456 -0,n -0,1 - - - - - - - - -3C0ACB58-3244-440A-9272-0511A7FC6B8C -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - -E8F93C18-AEA6-462C-95D7-A5BEA01A2641 -选模式 -choose_model -1694699456 -榨菜 -1694699456 -榨菜 -ORG {A3E36BFA-BBE8-4CB3-8424-C6F685981F86} -DAT 1694699456 -0,n -0,1 - - - - - - - - -9EC87D3C-D843-4F92-BDD0-86DCF0978A89 -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - -9E132309-36C4-47C2-9B1B-A78DF54B67DF -选地图 -choose_map -1694699456 -榨菜 -1694699456 -榨菜 -ORG {E623B725-EAC6-4C64-9AE4-98A38D87BE30} -DAT 1694699456 -0,n -0,1 - - - - - - - - -D8E68253-1B96-444C-A496-74F13469658D -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - -C4590F99-B33E-4F2B-BB1F-167EE314FD7C -对抗 -defence_VS -1694699456 -榨菜 -1694699456 -榨菜 -ORG {D83A37F7-FC3B-4930-927D-A442E22262F2} -DAT 1694699456 -0,n -0,1 - - - - - - - - -ECA0EB94-020A-46F0-8F69-44ADECB5E987 -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - -9050E7FF-644E-4404-8159-10424B408BD2 -对抗 -aggressor_VS -1694699456 -榨菜 -1694699456 -榨菜 -ORG {E2C0E3EF-9E32-43E9-B1A7-72D7D10FE3C3} -DAT 1694699456 -0,n -0,1 - - - - - - - - -ACC362EB-B9E9-4EB8-9962-2378945CCBB1 -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - -58DE069C-5D35-44D3-B666-B6C43B4ABC56 -对抗结果 -VS_result -1694699456 -榨菜 -1694699456 -榨菜 -ORG {B40AD1A1-05E2-4E84-9244-07AA66BF23C8} -DAT 1694699456 -0,n -0,1 - - - - - - - - -328C481F-ACFE-472E-971F-6EB8CE2C1C32 -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - -9C5D84FF-65C1-48C2-A188-3976852B876F -保卫结果 -defence_result2 -0 - -0 - -ORG {34F0C72B-684B-4F7C-AD9A-996476DF1B22} -DAT 1694699456 -B -1,n -1,1 - - - - - - - - -D35CECCB-83C4-4FE1-83A2-58E3DC28F14A -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - -43C7F1D2-C7D6-4B42-B615-AFA37B808462 -保卫结果 -defence_result -0 - -0 - -ORG {34F0C72B-684B-4F7C-AD9A-996476DF1B22} -DAT 1694699456 -A -1,1 -1,n - - - - - - - - -723206D6-0511-410A-A520-16FA7F1E8375 -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - -48954F4F-24B1-4705-A79E-00F419064263 -潜伏结果 -aggressor_result2 -0 - -0 - -ORG {86D565B6-338B-4776-BE7D-F01BD31E0E4B} -DAT 1694699456 -B -1,n -1,1 - - - - - - - - -BFC7AE84-DF2B-4267-AE43-8A9D7234191B -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - -865B1904-C8F3-4FBA-BACB-1881B860E137 -潜伏结果 -aggressor_result -0 - -0 - -ORG {86D565B6-338B-4776-BE7D-F01BD31E0E4B} -DAT 1694699456 -A -1,1 -1,n - - - - - - - - -3AB4B5C6-79C2-42DF-9052-842B8A5801EA -1694699456 -榨菜 -1694699456 -榨菜 - - - - - - - - - - - - - - - -70498336-CC76-4DF5-A7AD-81F597AEB044 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694699456 -榨菜 -1694699456 -榨菜 -file:///E|/数据库-高级进阶/课上文件/2023年9月14日/ConceptualDataModel_1.cdm -9D76193E-911A-488B-B9E4-7E80FC76CDA2 -1E597170-9350-11D1-AB3C-0020AF71E433 -1694700777 - - - - - -3D9AED92-E8AD-4843-B88F-045FA4D07566 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694699473 -榨菜 -1694700778 -榨菜 -file:///E|/数据库-高级进阶/database-advanced/53 周厚辰/20230914 第七次作业 CF数据库/ConceptualDataModel_1.pdm -0B86E387-9F19-4197-B72B-00B2EDC5A8B7 -CDE44E21-9669-11D1-9914-006097355D9B -1694700778 - - - - - - - - - - \ No newline at end of file diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/ConceptualDataModel_1.pdm" "b/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/ConceptualDataModel_1.pdm" deleted file mode 100644 index 5d224a49689b47a644be06513e8bdad5499eb860..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230922 \347\254\254\345\215\201\344\270\200\346\254\241\344\275\234\344\270\232 CF\346\225\260\346\215\256\345\272\223/ConceptualDataModel_1.pdm" +++ /dev/null @@ -1,7017 +0,0 @@ - - - - - - - - - -0B86E387-9F19-4197-B72B-00B2EDC5A8B7 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694699470 -榨菜 -1694699479 -榨菜 -ORG {97B017EB-1881-45B3-A485-C7DDA54BDE63} -DAT 1694699473 -ATT FOPT -[FolderOptions] - -[FolderOptions\Physical Objects] -GenerationCheckModel=Yes -GenerationPath= -GenerationOptions= -GenerationTasks= -GenerationTargets= -GenerationSelections= -RevPkey=Yes -RevFkey=Yes -RevAkey=Yes -RevCheck=Yes -RevIndx=Yes -RevOpts=Yes -RevViewAsTabl=No -RevViewOpts=Yes -RevSystAsTabl=Yes -RevTablPerm=No -RevViewPerm=No -RevProcPerm=No -RevDbpkPerm=No -RevSqncPerm=No -RevAdtPerm=No -RevUserPriv=No -RevUserOpts=No -RevGrpePriv=No -RevRolePriv=No -RevDtbsOpts=Yes -RevDtbsPerm=No -RevViewIndx=Yes -RevJidxOpts=Yes -RevStats=No -RevTspcPerm=No -RevCaseSensitive=No -GenTrgrStdMsg=Yes -GenTrgrMsgTab= -GenTrgrMsgNo= -GenTrgrMsgTxt= -TrgrPreserve=No -TrgrIns=Yes -TrgrUpd=Yes -TrgrDel=Yes -TrgrC2Ins=Yes -TrgrC2Upd=Yes -TrgrC3=Yes -TrgrC4=Yes -TrgrC5=Yes -TrgrC6=Yes -TrgrC7=Yes -TrgrC8=Yes -TrgrC9=Yes -TrgrC10=Yes -TrgrC11=Yes -TrgrC1=Yes -TrgrC12Ins=Yes -TrgrC12Upd=Yes -TrgrC13=Yes -UpdateTableStatistics=Yes -UpdateColumnStatistics=Yes - -[FolderOptions\Physical Objects\Database Generation] -GenScriptName=CF:穿越火线.sql -GenScriptName0=CF:穿越火线.sql -GenScriptName1=医生.sql -GenScriptName2=豆瓣电影.sql -GenScriptName3=11111111.sql -GenScriptName4=11111111 -GenScriptName5= -GenScriptName6= -GenScriptName7= -GenScriptName8= -GenScriptName9= -GenPathName=D:\小米云盘\桌面\ -GenSingleFile=Yes -GenODBC=No -GenCheckModel=Yes -GenScriptPrev=Yes -GenArchiveModel=No -GenUseSync=No -GenSyncChoice=0 -GenSyncArch= -GenSyncRmg=0 - -[FolderOptions\Physical Objects\Database Generation\Format] -GenScriptTitle=Yes -GenScriptNamLabl=No -GenScriptQDtbs=No -GenScriptQOwnr=Yes -GenScriptCase=0 -GenScriptEncoding=ANSI -GenScriptNAcct=No -IdentifierDelimiter=" - -[FolderOptions\Physical Objects\Database Generation\Database] -Create=Yes -Open=Yes -Close=Yes -Drop=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Database\Create] -Physical Options=Yes -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\Tablespace] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Tablespace\Create] -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\Storage] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\User] -Create=Yes -Drop=Yes -Comment=Yes -Privilege=No - -[FolderOptions\Physical Objects\Database Generation\User\Create] -Physical Options=No - -[FolderOptions\Physical Objects\Database Generation\Group] -Create=Yes -Drop=Yes -Comment=Yes -Privilege=No - -[FolderOptions\Physical Objects\Database Generation\Role] -Create=Yes -Drop=Yes -Privilege=No - -[FolderOptions\Physical Objects\Database Generation\UserDefinedDataType] -Create=Yes -Comment=Yes -Drop=Yes - -[FolderOptions\Physical Objects\Database Generation\UserDefinedDataType\Create] -Default value=Yes -Check=Yes - -[FolderOptions\Physical Objects\Database Generation\AbstractDataType] -Create=Yes -Header=Yes -Footer=Yes -Drop=Yes -Comment=Yes -Install JAVA class=Yes -Remove JAVA class=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Rule] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Default] -Create=Yes -Comment=Yes -Drop=Yes - -[FolderOptions\Physical Objects\Database Generation\Sequence] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Table&&Column] - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Table] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Table\Create] -Check=Yes -Physical Options=Yes -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Table\Create\Check] -Constraint declaration=No - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Column] -User datatype=No -Default value=Yes -Check=Yes -Physical Options=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Column\Check] -Constraint declaration=No - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key] - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key\Primary key] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key\Primary key\Create] -Constraint declaration=No -Physical Options=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key\Alternate key] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Key\Alternate key\Create] -Constraint declaration=No -Physical Options=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Foreign key] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Foreign key\Create] -Constraint declaration=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Index] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Index\Create] -Constraint declaration=Yes -Physical Options=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Index\Filter] -Primary key=No -Foreign key=No -Alternate key=No -Cluster=Yes -Other=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Trigger] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Table&&Column\Trigger\Filter] -For insert=Yes -For update=Yes -For delete=Yes -For other=Yes - -[FolderOptions\Physical Objects\Database Generation\View] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\View\Create] -Force Column list=No -Physical Options=Yes -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\View\ViewColumn] -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\View\ViewIndex] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\View\ViewIndex\Create] -Physical Options=Yes - -[FolderOptions\Physical Objects\Database Generation\View\ViewIndex\Filter] -Cluster=Yes -Other=Yes - -[FolderOptions\Physical Objects\Database Generation\View\Trigger] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\View\Trigger\Filter] -For insert=Yes -For update=Yes -For delete=Yes -For other=Yes - -[FolderOptions\Physical Objects\Database Generation\DBMSTrigger] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Synonym] -Create=Yes -Drop=Yes - -[FolderOptions\Physical Objects\Database Generation\Synonym\Filter] -Table=Yes -View=Yes -Proc=Yes -Synonym=Yes -Database Package=Yes -Sequence=Yes - -[FolderOptions\Physical Objects\Database Generation\JoinIndex] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\JoinIndex\Create] -Physical Options=Yes -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\Procedure] -Create=Yes -Drop=Yes -Comment=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\Procedure\Create] -Header=Yes -Footer=Yes - -[FolderOptions\Physical Objects\Database Generation\DatabasePackage] -Create=Yes -Drop=Yes -Permission=No - -[FolderOptions\Physical Objects\Database Generation\WebService] -Create=Yes -Drop=Yes -Comment=Yes - -[FolderOptions\Physical Objects\Database Generation\Dimension] -Create=Yes -Drop=Yes - -[FolderOptions\Physical Objects\Database Generation\Synchronization] -GenBackupTabl=1 -GenKeepBackTabl=1 -GenTmpTablDrop=No -GenKeepTablOpts=No - -[FolderOptions\Physical Objects\Test Data] -GenDataPathName= -GenDataSinglefile=Yes -GenDataScriptName=testdata -GenDataScriptName0= -GenDataScriptName1= -GenDataScriptName2= -GenDataScriptName3= -GenDataScriptName4= -GenDataScriptName5= -GenDataScriptName6= -GenDataScriptName7= -GenDataScriptName8= -GenDataScriptName9= -GenDataOdbc=0 -GenDataDelOld=No -GenDataTitle=No -GenDataDefNumRows=20 -GenDataCommit=0 -GenDataPacket=0 -GenDataOwner=No -GenDataProfNumb= -GenDataProfChar= -GenDataProfDate= -GenDataCSVSeparator=, -GenDataFileFormat=CSV -GenDataUseWizard=No - -[FolderOptions\Pdm] -IndxIQName=%COLUMN%_%INDEXTYPE% -IndxPK=Yes -IndxFK=Yes -IndxAK=Yes -IndxPKName=%TABLE%_PK -IndxFKName=%REFR%_FK -IndxAKName=%TABLE%_AK -IndxPreserve=Yes -IndxThreshold=0 -IndxStats=No -RefrPreserve=No -JidxPreserve=No -RbldMultiFact=Yes -RbldMultiDim=Yes -RbldMultiJidx=Yes -CubePreserve=No -TablStProcPreserve=No -ProcDepPreserve=Yes -TrgrDepPreserve=Yes -CubeScriptPath= -CubeScriptCase=0 -CubeScriptEncoding=ANSI -CubeScriptNacct=No -CubeScriptHeader=No -CubeScriptExt=csv -CubeScriptExt0=txt -CubeScriptExt1= -CubeScriptExt2= -CubeScriptSep=, -CubeScriptDeli=" -EstimationYears=0 -DfltDomnName=D_%.U:VALUE% -DfltColnName=D_%.U:VALUE% -DfltReuse=Yes -DfltDrop=Yes - -[FolderOptions\CheckModel] - -[FolderOptions\CheckModel\Package] - -[FolderOptions\CheckModel\Package\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CircularReference] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\ConstraintName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CnstMaxLen] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CircularDependency] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\ShortcutUniqCode] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Table] - -[FolderOptions\CheckModel\Table\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\UniqIndex] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\MaxLen - NAME] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\EmptyColl - COLNCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\EmptyColl - INDXCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\EmptyColl - KEYCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\SerialColumnNumber] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\EmptyCollYesYes] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\TableIndexes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\Mapping] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\MappingSFMap] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\EmptyColl - PERMCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Table\CheckTablePartitionKey] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckTableStartDate] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckTableRefNoLifecycle] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckTableSourceMapping] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckTablePartialColumnMapping] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckTableKeyColumnMapping] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\CheckTableNotOnLifecycleTablespace] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table\MYSQL50_Table_Table_storage_type] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column] - -[FolderOptions\CheckModel\Table.Column\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\DomainDivergence] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\ColumnMandatory] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\FkeyDttpDivergence] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\FkeyCheckDivergence] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\ColnSqncNoKey] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\ColnSqncDttp] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\SerialColumnFK] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\ColumnCompExpr] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckColumnOneToOneMapping] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckColumnDataTypeMapping] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckColumnNoMapping] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\MYSQL50_Column_Auto_increment_key] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Column\MYSQL50_Column_Datatype_attributes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index] - -[FolderOptions\CheckModel\Table.Index\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\EmptyColl - CIDXCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\UndefIndexType] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\IndexColumnCount] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\IQIndxHNGUniq] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\CheckIncludeColl - Tabl] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Index\MYSQL50_Index_Fulltext_indexes_validity] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key] - -[FolderOptions\CheckModel\Table.Key\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\EmptyColl - COLNCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\CheckIncludeColl - Tabl] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Key\MultiKeySqnc] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger] - -[FolderOptions\CheckModel\Table.Trigger\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table.Trigger\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index] - -[FolderOptions\CheckModel\Join Index\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Join Index\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View] - -[FolderOptions\CheckModel\View\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View\EmptyColl - PERMCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\View.View Index] - -[FolderOptions\CheckModel\View.View Index\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\EmptyColl - CIDXCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\IndexColumnCount] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View.View Index\CheckIncludeColl - Tabl] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference] - -[FolderOptions\CheckModel\Reference\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\Reflexive] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\EmptyColl - RFJNCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\IncompleteJoin] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Reference\JoinOrder] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference] - -[FolderOptions\CheckModel\View Reference\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\View Reference\EmptyColl - VRFJNCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain] - -[FolderOptions\CheckModel\Domain\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default] - -[FolderOptions\CheckModel\Default\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\DfltValeEmpty] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Default\DfltSameVale] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User] - -[FolderOptions\CheckModel\User\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\User\UniquePassword] -CheckSeverity=No -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Group] - -[FolderOptions\CheckModel\Group\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\EmptyColl - USERCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Group\UniquePassword] -CheckSeverity=No -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Role] - -[FolderOptions\CheckModel\Role\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Role\EmptyColl - USERCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure] - -[FolderOptions\CheckModel\Procedure\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\ProcBodyEmpty] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Procedure\EmptyColl - PERMCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\DBMS Trigger] - -[FolderOptions\CheckModel\DBMS Trigger\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\DBMS Trigger\DbmsTriggerEvent] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source] - -[FolderOptions\CheckModel\Data Source\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\EmptyColl - MODLSRC] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\DtscTargets] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Source\CheckDataSourceModels] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Horizontal Partitioning] - -[FolderOptions\CheckModel\Horizontal Partitioning\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Horizontal Partitioning\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Horizontal Partitioning\EmptyColl - PARTCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Horizontal Partitioning\TargetTables] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Vertical Partitioning] - -[FolderOptions\CheckModel\Vertical Partitioning\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Vertical Partitioning\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Vertical Partitioning\EmptyColl - PARTCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Vertical Partitioning\TargetTables] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table Collapsing] - -[FolderOptions\CheckModel\Table Collapsing\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table Collapsing\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table Collapsing\EmptyColl - TargetTable] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Table Collapsing\TargetTables] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact] - -[FolderOptions\CheckModel\Fact\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\EmptyColl - MEASCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\Mapping] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\MappingSFMap] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\EmptyColl - ALLOLINKCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact\CubeDupAssociation] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension] - -[FolderOptions\CheckModel\Dimension\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\EmptyColl - DATTRCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\EmptyColl - HIERCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\DimnDupHierarchy] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\DimnDefHierarchy] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\Mapping] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\MappingSFMap] -CheckSeverity=No -FixRequested=Yes -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension\SerialColumnNumber] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association] - -[FolderOptions\CheckModel\Association\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Association\EmptyColl - Hierarchy] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute] - -[FolderOptions\CheckModel\Dimension.Attribute\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Attribute\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure] - -[FolderOptions\CheckModel\Fact.Measure\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Fact.Measure\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy] - -[FolderOptions\CheckModel\Dimension.Hierarchy\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Dimension.Hierarchy\EmptyColl - DATTRCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym] - -[FolderOptions\CheckModel\Synonym\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\MaxLen - NAME] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Synonym\EmptyColl - BASEOBJ] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type] - -[FolderOptions\CheckModel\Abstract Data Type\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\AdtInstantiable] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type\AdtAbstractUsed] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure] - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\AdtProcUniqName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\UniqueDefinition] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Abstract Data Type.Abstract Data Type Procedure\ReturnDataType] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package] - -[FolderOptions\CheckModel\Database Package\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\MaxLen - NAME] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\EmptyColl - PROCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package\EmptyColl - CURCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Database Package\EmptyColl - VARCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Database Package\EmptyColl - TYPCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Database Package\EmptyColl - EXCCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Database Package.Database Package Procedure] - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\UniqueDefinition] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\EmptyColl - PARM] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Database Package.Database Package Procedure\ReturnDataType] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence] - -[FolderOptions\CheckModel\Sequence\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Sequence\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor] - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\UniqueDefinition] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\ReturnDataType] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Cursor\EmptyColl - PARM] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Database Package.Database Package Variable] - -[FolderOptions\CheckModel\Database Package.Database Package Variable\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Variable\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type] - -[FolderOptions\CheckModel\Database Package.Database Package Type\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Type\UniqueDefinition] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception] - -[FolderOptions\CheckModel\Database Package.Database Package Exception\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database Package.Database Package Exception\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace] - -[FolderOptions\CheckModel\Tablespace\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Tablespace\IsObjectUsed] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage] - -[FolderOptions\CheckModel\Storage\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Storage\IsObjectUsed] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database] - -[FolderOptions\CheckModel\Database\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Database\IsObjectUsed] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service] - -[FolderOptions\CheckModel\Web Service\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation] - -[FolderOptions\CheckModel\Web Service.Web Operation\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Web Service.Web Operation\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle] - -[FolderOptions\CheckModel\Lifecycle\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\CheckLifecyclePhase] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\CheckLifecycleRetention] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle\CheckPartitionRange] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase] - -[FolderOptions\CheckModel\Lifecycle.Phase\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseTbspace] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseIQTbspace] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseDuplicateTbspace] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseTbspaceCurrency] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseRetention] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseIdlePeriod] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseDataSource] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Lifecycle.Phase\CheckPhaseExternalOnFirst] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Replication] - -[FolderOptions\CheckModel\Replication\PartialReplication] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule] - -[FolderOptions\CheckModel\Business Rule\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\EmptyColl - OBJCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object] - -[FolderOptions\CheckModel\Extended Object\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link] - -[FolderOptions\CheckModel\Extended Link\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File] - -[FolderOptions\CheckModel\File\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckPathExists] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format] - -[FolderOptions\CheckModel\Data Format\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckDataFormatNullExpression] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes -[ModelOptions] - -[ModelOptions\Physical Objects] -CaseSensitive=No -DisplayName=Yes -EnableTrans=No -UseTerm=No -EnableRequirements=No -EnableFullShortcut=Yes -DefaultDttp= -IgnoreOwner=No -RebuildTrigger=Yes -RefrUnique=Yes -RefrAutoMigrate=Yes -RefrMigrateReuse=Yes -RefrMigrateDomain=Yes -RefrMigrateCheck=Yes -RefrMigrateRule=Yes -RefrMigrateExtd=No -RefrMigrDefaultLink=No -RefrDfltImpl=D -RefrPrgtColn=No -RefrMigrateToEnd=No -RebuildTriggerDep=No -ColnFKName=%.3:PARENT%_%COLUMN% -ColnFKNameUse=No -DomnCopyDttp=Yes -DomnCopyChck=No -DomnCopyRule=No -DomnCopyMand=No -DomnCopyExtd=No -DomnCopyProf=No -Notation=0 -DomnDefaultMandatory=No -ColnDefaultMandatory=No -TablDefaultOwner= -ViewDefaultOwner= -TrgrDefaultOwnerTabl= -TrgrDefaultOwnerView= -IdxDefaultOwnerTabl= -IdxDefaultOwnerView= -JdxDefaultOwner= -DBPackDefaultOwner= -SeqDefaultOwner= -ProcDefaultOwner= -DBMSTrgrDefaultOwner= -Currency=USD -RefrDeleteConstraint=1 -RefrUpdateConstraint=1 -RefrParentMandatory=No -RefrParentChangeAllow=Yes -RefrCheckOnCommit=No - -[ModelOptions\Physical Objects\NamingOptionsTemplates] - -[ModelOptions\Physical Objects\ClssNamingOptions] - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMPCKG] - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMPCKG\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMPCKG\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMDOMN] - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMDOMN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\PDMDOMN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\TABL] - -[ModelOptions\Physical Objects\ClssNamingOptions\TABL\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\TABL\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\COLN] - -[ModelOptions\Physical Objects\ClssNamingOptions\COLN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\COLN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\INDX] - -[ModelOptions\Physical Objects\ClssNamingOptions\INDX\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\INDX\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\REFR] - -[ModelOptions\Physical Objects\ClssNamingOptions\REFR\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\REFR\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VREF] - -[ModelOptions\Physical Objects\ClssNamingOptions\VREF\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VREF\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEW] - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEW\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEW\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEWC] - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEWC\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\VIEWC\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBSERV] - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBSERV\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBSERV\Code] -Template= -MaxLen=254 -Case=M -ValidChar='a'-'z','A'-'Z','0'-'9',"/-_.!~*'()" -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBOP] - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBOP\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WEBOP\Code] -Template= -MaxLen=254 -Case=M -ValidChar='a'-'z','A'-'Z','0'-'9',"/-_.!~*'()" -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WPARAM] - -[ModelOptions\Physical Objects\ClssNamingOptions\WPARAM\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\WPARAM\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FACT] - -[ModelOptions\Physical Objects\ClssNamingOptions\FACT\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FACT\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DIMN] - -[ModelOptions\Physical Objects\ClssNamingOptions\DIMN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DIMN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\MEAS] - -[ModelOptions\Physical Objects\ClssNamingOptions\MEAS\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\MEAS\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DATTR] - -[ModelOptions\Physical Objects\ClssNamingOptions\DATTR\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DATTR\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FILO] - -[ModelOptions\Physical Objects\ClssNamingOptions\FILO\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FILO\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMEOBJ] - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMEOBJ\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMEOBJ\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMELNK] - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMELNK\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\FRMELNK\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DefaultClass] - -[ModelOptions\Physical Objects\ClssNamingOptions\DefaultClass\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Physical Objects\ClssNamingOptions\DefaultClass\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Connection] - -[ModelOptions\Pdm] - -[ModelOptions\Generate] - -[ModelOptions\Generate\Xsm] -GenRootElement=Yes -GenComplexType=No -GenAttribute=Yes -CheckModel=Yes -SaveLinks=Yes -ORMapping=No -NameToCode=No - -[ModelOptions\Generate\Pdm] -RRMapping=No - -[ModelOptions\Generate\Cdm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No -Notation=2 - -[ModelOptions\Generate\Oom] -CheckModel=Yes -SaveLinks=Yes -ORMapping=No -NameToCode=Yes -ClassPrefix= - -[ModelOptions\Generate\Ldm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No - -[ModelOptions\Default Opts] - -[ModelOptions\Default Opts\TABL] -PhysOpts= - -[ModelOptions\Default Opts\COLN] -PhysOpts= - -[ModelOptions\Default Opts\INDX] -PhysOpts= - -[ModelOptions\Default Opts\AKEY] -PhysOpts= - -[ModelOptions\Default Opts\PKEY] -PhysOpts= - -[ModelOptions\Default Opts\STOR] -PhysOpts= - -[ModelOptions\Default Opts\TSPC] -PhysOpts= - -[ModelOptions\Default Opts\SQNC] -PhysOpts= - -[ModelOptions\Default Opts\DTBS] -PhysOpts= - -[ModelOptions\Default Opts\USER] -PhysOpts= - -[ModelOptions\Default Opts\JIDX] -PhysOpts= - - -BD063D70-A4CE-4407-BED9-EB0D2B7F3CDB -ConceptualDataModel_1 -ConceptualDataModel_1 -1694699473 -榨菜 -1694699473 -榨菜 - -97B017EB-1881-45B3-A485-C7DDA54BDE63 -5F45F978-C4F3-4E35-A3FC-AF3318663A0F - - - - -2A3C20BA-87E5-43B5-9899-930B07F16469 -MySQL 5.0 -MYSQL50 -1694699470 -榨菜 -1694699470 -榨菜 - -F4F16ECD-F2F1-4006-AF6F-638D5C65F35E -4BA9F647-DAB1-11D1-9944-006097355D9B - - - - -75AA2876-4B10-4E8C-8EBD-CE7F7D6346EF -Diagram_1 -Diagram_1 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {FA92831A-9A25-48DE-A1D2-669EDF31AE12} -DAT 1694699473 -ORG {8DEC29B5-62FD-4473-B79B-9EE76BA5C05D} -DAT 1694699456 -[DisplayPreferences] - -[DisplayPreferences\PDM] - -[DisplayPreferences\General] -Adjust to text=Yes -Snap Grid=No -Constrain Labels=Yes -Display Grid=No -Show Page Delimiter=No -Show Links intersections=Yes -Activate automatic link routing=Yes -Grid size=800 -Graphic unit=2 -Window color=192 192 192 -Background image= -Background mode=8 -Watermark image= -Watermark mode=8 -Show watermark on screen=No -Gradient mode=0 -Gradient end color=255 255 255 -Show Swimlane=No -SwimlaneVert=Yes -TreeVert=No -CompDark=0 - -[DisplayPreferences\Object] -Show Icon=No -Mode=2 -Trunc Length=40 -Word Length=40 -Word Text=!"#$%&')*+,-./:;=>?@\]^_`|}~ -Shortcut IntIcon=Yes -Shortcut IntLoct=Yes -Shortcut IntFullPath=No -Shortcut IntLastPackage=Yes -Shortcut ExtIcon=Yes -Shortcut ExtLoct=No -Shortcut ExtFullPath=No -Shortcut ExtLastPackage=Yes -Shortcut ExtIncludeModl=Yes -EObjShowStrn=Yes -ExtendedObject.Comment=No -ExtendedObject.IconPicture=No -ExtendedObject.TextStyle=No -ExtendedObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Object Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -ELnkShowStrn=Yes -ELnkShowName=Yes -ExtendedLink_SymbolLayout=<Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Source" >[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -FileObject.Stereotype=No -FileObject.DisplayName=Yes -FileObject.LocationOrName=No -FileObject.IconPicture=No -FileObject.TextStyle=No -FileObject.IconMode=Yes -FileObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Location" Attribute="LocationOrName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Package.Stereotype=Yes -Package.Comment=No -Package.IconPicture=No -Package.TextStyle=No -Package_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Display Model Version=Yes -Table.Stereotype=Yes -Table.DisplayName=Yes -Table.OwnerDisplayName=No -Table.Columns=Yes -Table.Columns._Filter="All Columns" PDMCOLNALL -Table.Columns._Columns=Stereotype IdentifierIndicator DomainOrDataType NullIndicator -Table.Columns._Limit=-5 -Table.Keys=No -Table.Keys._Columns=Stereotype Indicator -Table.Indexes=No -Table.Indexes._Columns=Stereotype -Table.Triggers=No -Table.Triggers._Columns=Stereotype -Table.Comment=No -Table.IconPicture=No -Table.TextStyle=No -Table_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Owner and Name" Attribute="OwnerDisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Columns" Collection="Columns" Columns="Stereotype No\r\nDisplayName Yes\r\nDataType No\r\nSymbolDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nKeyIndicator No\r\nIndexIndicator No\r\nNullStatus No" Filters="&quot;All Columns&quot; PDMCOLNALL &quot;&quot;\r\n&quot;PK Columns&quot; PDMCOLNPK &quot;\&quot;PRIM \&quot;TRUE\&quot; TRUE\&quot;&quot;\r\n&quot;Key Columns&quot; PDMCOLNKEY &quot;\&quot;KEYS \&quot;TRUE\&quot; TRUE\&quot;&quot;" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Keys" Collection="Keys" Columns="Stereotype No\r\nDisplayName Yes\r\nIndicator No" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Indexes" Collection="Indexes" Columns="Stereotype No\r\nDisplayName Yes\r\nIndicator No" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Triggers" Collection="Triggers" Columns="Stereotype No\r\nDisplayName Yes" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -View.Stereotype=Yes -View.DisplayName=Yes -View.OwnerDisplayName=No -View.Columns=Yes -View.Columns._Columns=DisplayName -View.Columns._Limit=-5 -View.TemporaryVTables=Yes -View.Indexes=No -View.Comment=No -View.IconPicture=No -View.TextStyle=No -View_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Owner and Name" Attribute="OwnerDisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Columns" Collection="Columns" Columns="DisplayName No\r\nExpression No\r\nDataType No\r\nSymbolDataType No &quot;Domain or Data type&quot;\r\nIndexIndicator No" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Tables" Collection="TemporaryVTables" Columns="Name Yes" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Indexes" Collection="Indexes" Columns="DisplayName Yes" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Procedure.Stereotype=No -Procedure.DisplayName=Yes -Procedure.OwnerDisplayName=No -Procedure.Comment=No -Procedure.IconPicture=No -Procedure.TextStyle=No -Procedure_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Owner and Name" Attribute="OwnerDisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Reference.Cardinality=No -Reference.ImplementationType=No -Reference.ChildRole=Yes -Reference.Stereotype=Yes -Reference.DisplayName=Yes -Reference.ForeignKeyConstraintName=No -Reference.JoinExpression=No -Reference.Integrity=No -Reference.ParentRole=Yes -Reference_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Cardinality" Attribute="Cardinality" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Implementation" Attribute="ImplementationType" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Child Role" Attribute="ChildRole" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="No" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Cons&amp;traint Name" Attribute="ForeignKeyConstraintName" Prefix="" Suffix="" Caption="Cons&amp;traint Name" Mandatory="No" />[CRLF] <StandardAttribute Name="Join" Attribute="JoinExpression" Prefix="" Suffix="" Caption="Join" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <StandardAttribute Name="Referential integrity" Attribute="Integrity" Prefix="" Suffix="" Caption="Referential integrity" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Parent Role" Attribute="ParentRole" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -ViewReference.ChildRole=Yes -ViewReference.Stereotype=Yes -ViewReference.DisplayName=No -ViewReference.JoinExpression=No -ViewReference.ParentRole=Yes -ViewReference_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Child Role" Attribute="ChildRole" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="No" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Join Expression" Attribute="JoinExpression" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Parent Role" Attribute="ParentRole" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -Entity.Stereotype=Yes -Entity.Attributes=Yes -Entity.Attributes._Filter="All attributes" CDMPENTALL -Entity.Attributes._Columns=Stereotype IdentifierIndicator DomainOrDataType NullIndicator -Entity.Attributes._Limit=-5 -Entity.Identifiers=Yes -Entity.Identifiers._Columns=Stereotype IdentifierIndicator -Entity.Comment=No -Entity.IconPicture=No -Entity.TextStyle=No -Entity_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" Filters="&quot;All attributes&quot; CDMPENTALL &quot;&quot;\r\n&quot;Primary attributes&quot; CDMPENTPK &quot;\&quot;PIDTF \&quot;TRUE\&quot; TRUE\&quot;&quot;\r\n&quot;Identifying attributes&quot; CDMPENTIDTF &quot;\&quot;AIDF \&quot;TRUE\&quot; TRUE\&quot;&quot;" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Identifiers" Collection="Identifiers" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Relationship.Entity1ToEntity2Role=Yes -Relationship.Entity2ToEntity1RoleCardinality=No -Relationship.Entity1ToEntity2RoleDominant=Yes -Relationship.Stereotype=Yes -Relationship.DisplayName=Yes -Relationship.JoinExpression=No -Relationship.Entity2ToEntity1Role=Yes -Relationship.Entity1ToEntity2RoleCardinality=No -Relationship.Entity2ToEntity1RoleDominant=Yes -Relationship_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity1ToEntity2Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity2ToEntity1RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity1ToEntity2RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity2ToEntity1Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity1ToEntity2RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity2ToEntity1RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -Inheritance.Stereotype=Yes -Inheritance.DisplayName=Yes -Inheritance.IconPicture=No -Inheritance.TextStyle=No -Inheritance_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Association.Stereotype=Yes -Association.Comment=No -Association.Attributes=Yes -Association.Attributes._Columns=Stereotype DataType NullIndicator -Association.Attributes._Limit=-5 -Association.IconPicture=No -Association.TextStyle=No -Association_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -AssociationLink.SymbolCardinality=Yes -AssociationLink.Stereotype=Yes -AssociationLink.Role=Yes -AssociationLink_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Cardinality" Attribute="SymbolCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Role" Attribute="Role" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> - -[DisplayPreferences\Symbol] - -[DisplayPreferences\Symbol\FRMEOBJ] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=6000 -Height=2000 -Brush color=255 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=64 -Brush gradient color=192 192 192 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 255 128 128 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FRMELNK] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FILO] -OBJSTRNFont=新宋体,8,N -OBJSTRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LCNMFont=新宋体,8,N -LCNMFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3600 -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\PDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\TABL] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -OWNRDISPNAMEFont=新宋体,8,N -OWNRDISPNAMEFont color=0, 0, 0 -ColumnsFont=新宋体,8,N -ColumnsFont color=0, 0, 0 -TablePkColumnsFont=新宋体,8,U -TablePkColumnsFont color=0, 0, 0 -TableFkColumnsFont=新宋体,8,N -TableFkColumnsFont color=0, 0, 0 -KeysFont=新宋体,8,N -KeysFont color=0, 0, 0 -IndexesFont=新宋体,8,N -IndexesFont color=0, 0, 0 -TriggersFont=新宋体,8,N -TriggersFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=178 214 252 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 128 192 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\VIEW] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -OWNRDISPNAMEFont=新宋体,8,N -OWNRDISPNAMEFont color=0, 0, 0 -ColumnsFont=新宋体,8,N -ColumnsFont color=0, 0, 0 -TablePkColumnsFont=新宋体,8,U -TablePkColumnsFont color=0, 0, 0 -TableFkColumnsFont=新宋体,8,N -TableFkColumnsFont color=0, 0, 0 -TemporaryVTablesFont=新宋体,8,N -TemporaryVTablesFont color=0, 0, 0 -IndexesFont=新宋体,8,N -IndexesFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=208 208 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 192 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\PROC] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -OWNRDISPNAMEFont=新宋体,8,N -OWNRDISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4000 -Height=1000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 108 0 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\REFR] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 128 192 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\VREF] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 192 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\USRDEPD] -OBJXSTRFont=新宋体,8,N -OBJXSTRFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=2 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\Free Symbol] -Free TextFont=新宋体,8,N -Free TextFont color=0 0 0 -Line style=0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMENTT] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0, 0, 0 -EntityForeignAttributeFont=新宋体,8,N -EntityForeignAttributeFont color=0, 0, 0 -IdentifiersFont=新宋体,8,N -IdentifiersFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=176 186 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 88 74 181 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMRLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 88 74 181 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=Yes -Width=1600 -Height=1000 -Brush color=176 186 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMLINH] -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ENTT] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0 0 0 -IdentifiersFont=新宋体,8,N -IdentifiersFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=176 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 170 170 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\RLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 170 170 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ASSC] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3000 -Brush color=208 208 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINK] -SOURCEFont=新宋体,8,N -SOURCEFont color=0 0 0 -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=Yes -Width=1600 -Height=1000 -Brush color=176 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINH] -CENTERFont=新宋体,8,N -CENTERFont color=0 0 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\LDM] - -[DisplayPreferences\CDM] -(8500, 11000) -((315,354), (433,354)) --29257 --29257 - - -1694700654 -((-35241,-5196), (-774,5327)) -((-33554,-4796),(-33554,4702),(-1174,4702)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694700654 -((3226,-5196), (40895,5327)) -((39208,-4796),(39208,4702),(3626,4702)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694700654 -((3226,-5196), (38408,397)) -((38008,-4796),(38008,-228),(3626,-228)) -2 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694700654 -((-13590,-13641), (-774,-12120)) -((-1174,-13016),(-13190,-13016)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694700654 -((3226,-13641), (18087,-12120)) -((3626,-13016),(17687,-13016)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694700654 -((-34491,-16203), (-774,-8396)) -((-1174,-15307),(-33554,-15307),(-33554,-8796)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694700654 -((3226,-16411), (38945,-8396)) -((3626,-15515),(38008,-15515),(38008,-8796)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694700654 -((-285,-12816), (3089,-9582)) -((1578,-9982),(1578,-11199),(1226,-11199),(1226,-12416)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694700585 -((-33954,-7420), (-15190,-4852)) -((-15590,-6795),(-33554,-6795)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N -4 - - - - - - - - - - - -1694700654 -((-13591,-7421), (-774,-6171)) -((-13191,-6796),(-1174,-6796)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694700580 -((22087,-7421), (36008,-4852)) -((22487,-6796),(35608,-6796)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694700654 -((3226,-7421), (18088,-6171)) -((17688,-6796),(3626,-6796)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694700654 -((-34041,-5196), (-774,397)) -((-32354,-4796),(-32354,-228),(-1174,-228)) -1 -1 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694700423 --1 -((-35954,-8796), (-31154,-4796)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694700423 --1 -((35608,-8796), (40408,-4796)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694700654 --1 -((-1174,2702), (3626,6702)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694700654 --1 -((-1174,-2228), (3626,1772)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694700585 --1 -((-17990,-14615), (-13190,-10615)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694700580 --1 -((17687,-14915), (22487,-10915)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694700654 --1 -((-1174,-18198), (3626,-12416)) -0 -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 -1 - - - - - -1694700654 --1 -((-1174,-9982), (3626,-3610)) -0 -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 -1 - - - - - -1694700585 --1 -((-17990,-8796), (-13191,-4796)) -11184640 -16759472 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694700580 --1 -((17688,-8796), (22487,-4796)) -11184640 -16759472 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -OWNRDISPNAME 0 新宋体,8,N -Columns 0 新宋体,8,N -TablePkColumns 0 新宋体,8,U -TableFkColumns 0 新宋体,8,N -Keys 0 新宋体,8,N -Indexes 0 新宋体,8,N -Triggers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - - - - - - - - -90591D51-09D0-41F8-A783-AA1591A783A7 -保卫者 -defence -1694699472 -榨菜 -1694699473 -榨菜 -ORG {A0D3EDF4-CD74-44C6-A9BA-5635DE8AEEC3} -DAT 1694699473 -ORG {602963C5-8C39-4966-AC5C-C8E1577A8C46} -DAT 1694699456 - -{\rtf1\ansi\ansicpg936\deff0\nouicompat\deflang1033\deflangfe2052{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}} -{\*\generator Riched20 10.0.19041}\viewkind4\uc1 -\pard\f0\fs20\lang2052\tab\tab\par -} - - - -9B29D293-681E-4301-869F-309D6631C093 -保卫者ID -defence_ID -1694699472 -榨菜 -1694699472 -榨菜 -ORG {F0B98C1E-12C7-461B-B787-30B1D5C6C8AF} -DAT 1694699473 -ORG {3E08BC56-5FCA-45EC-8D37-9402585A7B1F} -DAT 1694699456 -int -1 -1 - - -DCCF3ADA-9A6E-408F-8F67-08F28E6DBABC -角色编号 -character_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {3AF47DC8-0099-4E84-A6D9-8B35977AA455} -DAT 1694699473 -ORG {7B317979-D621-47EA-A2D3-E866DFBAC7BD},{472B5A5E-9344-4667-969F-AA20EB2780B2} -DAT 1694699456 -int - - -6FF2A7B0-0766-4945-B521-6F32741283D5 -枪械编号 -firearms_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {0F9FDFA5-6C31-4830-9940-F293AC9608DC} -DAT 1694699473 -ORG {A28D6908-894B-4BE8-887C-B5DE25A1D690},{8DDD6E34-F60E-421A-AB47-AE92B6AEAD79} -DAT 1694699456 -int - - - - -E940D9D9-8E4B-4BE0-A0C2-C2D4E20CFC8D -Identifier_1 -Identifier_1 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {A9FEBD68-DA93-4E6E-A41F-3DDB2DF6E746} -DAT 1694699473 -ORG {4BF43456-3916-4937-B56A-78DE03C3F5AE} -DAT 1694699456 - - - - - - - -AA69C27E-557D-4BD2-90F1-2413520B3D1F -defence_PK -defence_PK -1694699473 -榨菜 -1694699473 -榨菜 -1 - - - - - -41DB4BDC-1E68-4ECA-B23B-CFD382ECA290 -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - -6FC8CF17-8824-46C8-8D72-DA8E03746A53 -defence_character_FK -defence_character_FK -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -1AA33167-95D4-40F7-B540-EF2C534E4CFB -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - -5A65F89A-FB09-4DA1-AA49-4350BAF68365 -defence_firearms_FK -defence_firearms_FK -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -824895C9-5CE8-42A8-AC52-AD3FAADBEEFD -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - - - - - - -CCAB2F5C-B53C-4457-A11C-F495D4AC94CA -潜伏者 -aggressor -1694699472 -榨菜 -1694699473 -榨菜 -ORG {14FEF608-4E2F-4274-B8F0-5E47CCA5DE6D} -DAT 1694699473 -ORG {CA1594EC-0733-45CD-B0CE-E817617A9C9C} -DAT 1694699456 - - - -18E1B7DC-97DD-44A5-BA24-80D82B97C7A9 -潜伏者ID -aggressor_ID -1694699472 -榨菜 -1694699472 -榨菜 -ORG {D3BE9F91-B613-41F5-BA65-7BB3FB10036B} -DAT 1694699473 -ORG {95E1F7CB-DC1E-4920-8B45-7250F3625A8E} -DAT 1694699456 -int -1 -1 - - -CB1571FE-03BC-4DD0-B985-242464EA92F0 -角色编号 -character_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {B34EFDFF-6067-40E7-A032-B8E845688065} -DAT 1694699473 -ORG {7B317979-D621-47EA-A2D3-E866DFBAC7BD},{D4C3B6A3-ED20-4447-AE57-C7C53E38B6DD} -DAT 1694699456 -int - - -9E3B8F33-5D06-4C01-963F-B41C0CFE12BC -枪械编号 -firearms_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {4E492B8A-A610-4C27-B285-BCCA2AE5F599} -DAT 1694699473 -ORG {A28D6908-894B-4BE8-887C-B5DE25A1D690},{A850D229-531B-4735-A4A5-524D705C91DB} -DAT 1694699456 -int - - - - -A8FDBA4C-CD69-4700-8783-D0FB7CEE64A7 -Identifier_1 -Identifier_1 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {7843006F-533E-4007-B325-9BF4FE075D1F} -DAT 1694699473 -ORG {6F9C4D45-98A2-43B4-99B0-B123B9575443} -DAT 1694699456 - - - - - - - -18C9C298-74DA-430C-A72A-A65E211E6796 -aggressor_PK -aggressor_PK -1694699473 -榨菜 -1694699473 -榨菜 -1 - - - - - -0BFB8BE8-E0DD-434A-B9A7-084DAB2BC834 -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - -167879B7-813A-4A97-87E4-CF62F5602298 -aggressor_character_FK -aggressor_character_FK -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -8FBB2918-E3D5-4BCD-ADA6-449D0A9A1FA8 -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - -4637393E-DBBD-4097-A758-6D8A67510528 -aggressor_firearms_FK -aggressor_firearms_FK -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -20304415-CB40-4659-874C-005E5EDBAEFE -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - - - - - - -DDFEFF45-FE95-432C-B81E-CF03A459D7AC -角色 -character -1694699472 -榨菜 -1694699473 -榨菜 -ORG {4518E1C8-63D4-41EB-9BE7-73A18A9488BB} -DAT 1694699473 -ORG {0165226C-5055-44A8-9346-78A6C03FBCB6} -DAT 1694699456 - - - -742CE55F-1142-4BB6-99AE-6179171D2EF0 -角色编号 -character_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {36E12F40-615A-4325-B958-288C80860257} -DAT 1694699473 -ORG {7B317979-D621-47EA-A2D3-E866DFBAC7BD} -DAT 1694699456 -int -1 -1 - - -3B4A8B9C-C287-4D6F-9DE3-3A3D8B4FC797 -角色姓名 -character_name -1694699472 -榨菜 -1694699472 -榨菜 -ORG {1449036C-0936-4421-9F50-9D281D67A675} -DAT 1694699473 -ORG {44C75338-D5D1-4011-A04E-31A82E830617} -DAT 1694699456 -char(10) -10 -1 - - -5C9B2F73-45D4-4753-8834-789B59DDABE1 -角色性别 -character_sex -1694699472 -榨菜 -1694699472 -榨菜 -ORG {D41ADE44-6812-4C55-9C45-9D666FAB0C70} -DAT 1694699473 -ORG {EA67F1CA-D529-4347-AAB3-24F5777CBAA6} -DAT 1694699456 -char(1) -1 -1 - - - - -E312D2E6-5021-4070-BDAD-1DC970282C75 -Identifier_1 -Identifier_1 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {699FC8A9-15FD-4AF0-B04E-101050A78695} -DAT 1694699473 -ORG {0CA54FDA-6A01-457E-AD7B-AE1AD15B84DA} -DAT 1694699456 - - - - - - - -17C18E6D-9DCC-48AC-8F57-2BBB4C12303C -character_PK -character_PK -1694699473 -榨菜 -1694699473 -榨菜 -1 - - - - - -635CFC15-493A-4277-B57C-38B96C6159FD -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - - - - - - -832F27FD-D358-4FC5-8F19-9E2CDCF7F7CC -枪械 -firearms -1694699472 -榨菜 -1694699473 -榨菜 -ORG {2C55E804-C7F7-45EE-8E59-7B97DDC41D62} -DAT 1694699473 -ORG {FA5EC4FA-E021-4114-B1D9-238629BF00B5} -DAT 1694699456 - - - -DBCB5FBE-1F1F-4A73-904B-114816E2A216 -枪械编号 -firearms_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {4FCA9A80-DC77-4C83-ADEB-003CCEC75C3F} -DAT 1694699473 -ORG {A28D6908-894B-4BE8-887C-B5DE25A1D690} -DAT 1694699456 -int -1 -1 - - -0FF4C741-E1DB-4A74-8025-C3C2C8FDC670 -枪械名称 -firearms_name -1694699472 -榨菜 -1694699472 -榨菜 -ORG {37538E47-48C8-4BBA-BA78-D20E8610A537} -DAT 1694699473 -ORG {FAF376C3-D299-4F62-9DD7-95A63ADCDAFF} -DAT 1694699456 -char(10) -10 -1 - - -A3E2BEFD-9F22-4F12-BF07-4C861963BD3C -枪械类型 -firearms_type -1694699472 -榨菜 -1694699472 -榨菜 -ORG {812F6AF8-6783-467F-96CE-5699C130AC46} -DAT 1694699473 -ORG {8DECF0A8-70B8-442A-B642-945431DD0311} -DAT 1694699456 -char(5) -5 -1 - - - - -A29C51DC-5A1C-42DE-895B-5F440DDAC938 -Identifier_1 -Identifier_1 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {C85ECCF3-2E6A-43E2-A653-6EBB85E1FF6E} -DAT 1694699473 -ORG {32A52C8C-3F3F-4CDC-B5FF-A96B8EBBC832} -DAT 1694699456 - - - - - - - -DCB2C835-BBAB-42BE-B52C-202912D839B1 -firearms_PK -firearms_PK -1694699473 -榨菜 -1694699473 -榨菜 -1 - - - - - -964ED3E4-02F1-4FD6-8C01-C8CDB5EA9FB5 -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - - - - - - -32508312-326C-4747-93E4-5021ED364E90 -模式 -model -1694699472 -榨菜 -1694699473 -榨菜 -ORG {9D5828ED-B8EF-4164-BC6E-AB6D43D46EEC} -DAT 1694699473 -ORG {30C37DD6-BF81-42B6-965D-CCB9402F02D3} -DAT 1694699456 - - - -422D9BED-E257-4888-A7F3-D72232055DBE -模式编号 -model_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {7E81F2D1-7445-4759-9596-0A009DBC8E49} -DAT 1694699473 -ORG {6541FC6B-1DAB-465C-9136-C26C520A79DE} -DAT 1694699456 -int -1 -1 - - -3F07A7E9-AE00-443D-810A-CB65275620E1 -模式名称 -model_name -1694699472 -榨菜 -1694699472 -榨菜 -ORG {1824C63D-FC3B-479F-B432-F94CFB2355BE} -DAT 1694699473 -ORG {69D5A6F7-E66B-4FBC-8B5E-3DFF466E7EE1} -DAT 1694699456 -char(10) -10 -1 - - - - -5C5AAAD7-AC9F-45AB-820A-E5004BCF22AB -Identifier_1 -Identifier_1 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {2F98AEEA-342F-43B9-9006-DA27AA359A65} -DAT 1694699473 -ORG {12D4CF48-D8F9-4246-8999-8F004959D8E5} -DAT 1694699456 - - - - - - - -D2A3D33A-468E-4EAC-B806-B733A1C8940E -model_PK -model_PK -1694699473 -榨菜 -1694699473 -榨菜 -1 - - - - - -45D0E364-BF4B-486C-866F-CCD0A8F1B728 -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - - - - - - -09A9511D-91D6-4837-9B54-EC7CAAF88AF7 -地图 -map -1694699472 -榨菜 -1694699473 -榨菜 -ORG {7646D016-F92E-4D55-B59F-02C7011DE253} -DAT 1694699473 -ORG {3E71E37F-726E-4249-8586-DFD272D8A250} -DAT 1694699456 - - - -0E31DAB7-7A40-49DB-9A5F-87EC04612FC9 -地图编号 -map_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {F355562F-0D7E-471A-A739-42D8D531C48C} -DAT 1694699473 -ORG {5FAA33BE-857C-4B41-B952-5269DF9DAD0B} -DAT 1694699456 -int -1 -1 - - -E46124AE-7AB5-4A3A-AD26-BE7F65B50F1C -地图名称 -map_name -1694699472 -榨菜 -1694699472 -榨菜 -ORG {255FFCA4-7514-45CA-AC06-BFCC66A50D63} -DAT 1694699473 -ORG {419FA10D-C702-41BB-9AC7-53A403CA89B0} -DAT 1694699456 -char(10) -10 -1 - - - - -BFB86B27-D625-4ADE-87D5-BD16312C6584 -Identifier_1 -Identifier_1 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {DC94FF7E-956D-4ADF-B187-60B338DA3B15} -DAT 1694699473 -ORG {09D9AED5-755A-4CD7-98AB-198CCBFFDD98} -DAT 1694699456 - - - - - - - -169196FE-37E8-4432-995A-9D3605A22B15 -map_PK -map_PK -1694699473 -榨菜 -1694699473 -榨菜 -1 - - - - - -EA973E91-2664-4AFB-BD1F-52CDADF2589C -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - - - - - - -5884902F-057A-4340-AFF3-F41E033CC3FB -对抗 -VS -1694699472 -榨菜 -1694699473 -榨菜 -ORG {41695125-751C-4C2B-93E8-1174A7A18A17} -DAT 1694699473 -ORG {7602555D-2E7C-4417-AD28-11CE73119861} -DAT 1694699456 - - - -24D95944-E444-412E-A503-58477CECDD21 -对抗编号 -VS_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {45DF21D0-BA89-4B1C-A6E6-D3782914738A} -DAT 1694699473 -ORG {4F407D3F-EF12-46BA-9BC6-51717828BFBD} -DAT 1694699456 -int -1 -1 - - -31D3DBE9-A205-4124-BCB0-0D339C740C3E -模式编号 -model_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {0E9D69FD-3774-4B4F-AC59-A047EBAB21BF} -DAT 1694699473 -ORG {6541FC6B-1DAB-465C-9136-C26C520A79DE},{A3E36BFA-BBE8-4CB3-8424-C6F685981F86} -DAT 1694699456 -int - - -E78BCBC3-7A93-4ECC-A429-1D1A2A006228 -地图编号 -map_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {C500C568-5EBC-4A86-823A-24696733ABA9} -DAT 1694699473 -ORG {5FAA33BE-857C-4B41-B952-5269DF9DAD0B},{E623B725-EAC6-4C64-9AE4-98A38D87BE30} -DAT 1694699456 -int - - -AF65DAD1-2770-4A17-87A2-14C3086BC0F9 -保卫者ID -defence_ID -1694699472 -榨菜 -1694699472 -榨菜 -ORG {C3041DE5-9041-4E2D-8D74-65C00A849D8C} -DAT 1694699473 -ORG {3E08BC56-5FCA-45EC-8D37-9402585A7B1F},{D83A37F7-FC3B-4930-927D-A442E22262F2} -DAT 1694699456 -int - - -670BB1BE-0789-4E87-B1AC-26984156B746 -潜伏者ID -aggressor_ID -1694699472 -榨菜 -1694699472 -榨菜 -ORG {FCDC1F03-0CD8-449A-8DA3-F30458276550} -DAT 1694699473 -ORG {95E1F7CB-DC1E-4920-8B45-7250F3625A8E},{E2C0E3EF-9E32-43E9-B1A7-72D7D10FE3C3} -DAT 1694699456 -int - - - - -8704A6E0-003D-42B6-AF29-B6FF514BC6D5 -Identifier_1 -Identifier_1 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {BA9F064D-3E0F-4EE1-A571-B3D238FF2CC5} -DAT 1694699473 -ORG {E06EF8DE-1F9A-4FB5-BCF8-3344998548B5} -DAT 1694699456 - - - - - - - -36C73FE5-7D7E-44A2-9104-EC87D2855774 -VS_PK -VS_PK -1694699473 -榨菜 -1694699473 -榨菜 -1 - - - - - -B38A4B01-0128-48C7-8397-92559249E010 -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - -3F903FD4-EE2E-4109-BA74-0A65BC5ABF94 -choose_model_FK -choose_model_FK -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -CAADDFE2-33E3-4701-9AE2-C1525EE06F2A -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - -49B4F37F-CD44-41D8-AD2B-EC2970B6CDFA -choose_map_FK -choose_map_FK -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -416C400F-EE8C-41C2-AC4B-D5FD5B31380A -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - -6C215814-4A0D-4EBE-A63A-32065B2F872D -defence_VS_FK -defence_VS_FK -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -93DE65D8-56C0-482C-9E4E-01C31D14C762 -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - -153ED060-B6A7-4655-AE86-404130A01B51 -aggressor_VS_FK -aggressor_VS_FK -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -BC827D0E-3491-4B20-B1B3-3895B9A20DAD -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - - - - - - -02C0407D-B198-45C1-B57A-5F02A4708D91 -对抗结果 -VS_result -1694699472 -榨菜 -1694699473 -榨菜 -ORG {2EF16A8C-83F5-4C49-8748-4D7B2FDEB832} -DAT 1694699473 -ORG {0714CD92-876B-4BED-B13E-28FF61377D2C} -DAT 1694699456 - - - -2831D025-B5ED-4886-BD01-C56A843CA4A2 -结果编号 -result_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {997ADF39-7E57-4115-A4B2-90050DEBBF97} -DAT 1694699473 -ORG {903FE77B-63DC-47B4-B2CF-E22092737C2E} -DAT 1694699456 -int -1 -1 - - -70B60407-4358-46FB-89C2-1A6CFE58E814 -对抗编号 -VS_No -1694699472 -榨菜 -1694699472 -榨菜 -ORG {3D044BDF-AC6A-4203-877B-50C2F9BB57B9} -DAT 1694699473 -ORG {4F407D3F-EF12-46BA-9BC6-51717828BFBD},{B40AD1A1-05E2-4E84-9244-07AA66BF23C8} -DAT 1694699456 -int - - -715D8044-1656-4F83-BF62-48B2AE361E3B -对抗结果 -VS_result -1694699472 -榨菜 -1694699472 -榨菜 -ORG {29C0A8DD-1F64-42F1-B48D-26B39C3F9EC8} -DAT 1694699473 -ORG {37DE54BD-9766-4926-837F-C57C9CFF0329} -DAT 1694699456 -char(5) -5 -1 - - -2BD1B9C8-2954-4AAB-8F2F-E91F382D9DE3 -击杀数 -struck_down -1694699472 -榨菜 -1694699472 -榨菜 -ORG {0D91C72D-2893-4218-BB57-CA78AB0B9AA1} -DAT 1694699473 -ORG {F63275EB-5EDD-4234-8E3E-E66E17DBABDC} -DAT 1694699456 -int -1 - - -996B7642-7735-4F13-9647-FF0A5446E7DD -死亡数 -die -1694699472 -榨菜 -1694699472 -榨菜 -ORG {03863B58-E8EA-4B17-98A5-FA3F1C7F194D} -DAT 1694699473 -ORG {FB9A168F-DF28-4B41-96CF-009DF6FA8C3D} -DAT 1694699456 -int -1 - - -DAD824B9-BFC6-465E-8F66-7BB2E2B61AA5 -助攻数 -assist -1694699472 -榨菜 -1694699472 -榨菜 -ORG {CD42CD4C-D872-4E4A-8993-04C28ED49F49} -DAT 1694699473 -ORG {94F3547E-B2A2-4BAA-B59C-E1236B3BB2E8} -DAT 1694699456 -int -1 - - - - -152C041C-8055-4496-8FAC-EE2C0B4C71A7 -Identifier_1 -Identifier_1 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {163D491F-2152-41B8-858D-E426CDD6C796} -DAT 1694699473 -ORG {D576B4B0-6F75-4F46-B2ED-0D702CBB8989} -DAT 1694699456 - - - - - - - -D678B7FD-2E39-48B9-A13B-D49C5C7E3FC6 -VS_result_PK -VS_result_PK -1694699473 -榨菜 -1694699473 -榨菜 -1 - - - - - -7FC68923-9659-41AA-A121-9B8E2D266D4B -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - -ECE62167-EBF7-48F3-ACA3-D3628EDEFF04 -VS_result_FK -VS_result_FK -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -DA95C5C0-C2D6-49A5-8D14-AB5F9FEDB85D -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - - - - - - -64AC5EDC-AF7B-4F48-8C98-500D7905C317 -保卫结果 -defence_result -1694699472 -榨菜 -1694700372 -榨菜 -ORG {6FC453D9-A79E-4304-8803-C68F93610098} -DAT 1694699473 -ORG {34F0C72B-684B-4F7C-AD9A-996476DF1B22} -DAT 1694699456 - - - -E9E9CDAB-DD1B-4502-BAD7-7FCD4D395D87 -结果编号 -result_No -1694699472 -榨菜 -1694700372 -榨菜 -ORG {6496C20B-6A43-4E4C-85C7-30D3BB0196DD} -DAT 1694699473 -ORG {903FE77B-63DC-47B4-B2CF-E22092737C2E},{34F0C72B-684B-4F7C-AD9A-996476DF1B22} -DAT 1694699456 -int -1 - - -60F50BB5-C701-4485-8D9D-CA0968B5AFE8 -保卫者ID -defence_ID -1694699472 -榨菜 -1694699472 -榨菜 -ORG {9B661812-2C5C-49A0-984A-8733C0B0B44C} -DAT 1694699473 -ORG {3E08BC56-5FCA-45EC-8D37-9402585A7B1F},{34F0C72B-684B-4F7C-AD9A-996476DF1B22} -DAT 1694699456 -int -1 - - - - -BA879867-7457-48C5-A6C5-B8CCB5AEACD1 -Identifier_1 -Identifier_1 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {7D1F753C-373B-4A76-B504-CD3C5171EA63} -DAT 1694699473 - - - - - - - - -4DEC9418-0C76-434F-BFF3-EF70F82ADC96 -defence_result_PK -defence_result_PK -1694699473 -榨菜 -1694699473 -榨菜 -1 - - - - - -1CDC5D07-FD22-45DC-925A-72A4C5AC0A62 -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -284C0EE1-8ABC-4E55-B066-23F019A11D51 -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - -DF847003-A466-4714-B309-3F4D3A4CE395 -defence_result2_FK -defence_result2_FK -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -E871E50D-95F4-40F1-92CD-6B1617ABE3BD -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - - - - - - -6BC429AF-938C-47D9-BB90-4351D705F28D -潜伏结果 -aggressor_result -1694699472 -榨菜 -1694700377 -榨菜 -ORG {FF5AF82F-6E33-4BBD-87EC-F3697D948D0A} -DAT 1694699473 -ORG {86D565B6-338B-4776-BE7D-F01BD31E0E4B} -DAT 1694699456 - - - -A247BD9E-78EA-4883-9575-9179BC62FA65 -结果编号 -result_No -1694699472 -榨菜 -1694700377 -榨菜 -ORG {29030088-C665-4C90-AC8C-EA846D942788} -DAT 1694699473 -ORG {903FE77B-63DC-47B4-B2CF-E22092737C2E},{86D565B6-338B-4776-BE7D-F01BD31E0E4B} -DAT 1694699456 -int -1 - - -2BB4A254-73F6-4DDC-85AC-3D7F33000D85 -潜伏者ID -aggressor_ID -1694699472 -榨菜 -1694699472 -榨菜 -ORG {4C164414-7CDE-4AF0-B94D-4590403A67BD} -DAT 1694699473 -ORG {95E1F7CB-DC1E-4920-8B45-7250F3625A8E},{86D565B6-338B-4776-BE7D-F01BD31E0E4B} -DAT 1694699456 -int -1 - - - - -9F8B87DE-82BA-46BA-A3BE-0A282921BFE7 -Identifier_1 -Identifier_1 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {F11A3C04-F0FD-4E73-9346-9166A8EBA432} -DAT 1694699473 - - - - - - - - -B9A851A9-F614-4FFA-93D8-1C4597DBD9ED -aggressor_result_PK -aggressor_result_PK -1694699473 -榨菜 -1694699473 -榨菜 -1 - - - - - -51901FAF-FBF3-4781-9B67-1A83AAF487F1 -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -BDE68F5A-0E43-422A-B394-AEDC9E10A626 -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - -B93A8B70-2939-4D1F-AEDC-A337A57C37EF -aggressor_result2_FK -aggressor_result2_FK -1694699473 -榨菜 -1694699473 -榨菜 - - - - - -0D25A36A-7DF2-485B-9132-1A7C7A6B9D0B -1694699473 -榨菜 -1694699473 -榨菜 - - - - - - - - - - - - - - -3DD5439E-C1B2-448F-86A9-1EFC9F99D9EA -保卫角色 -defence_character -1694699472 -榨菜 -1694699472 -榨菜 -ORG {2E63DDE2-C39E-4A8D-8A38-FA5ECA56CA14} -DAT 1694699473 -ORG {472B5A5E-9344-4667-969F-AA20EB2780B2} -DAT 1694699456 -0..* -1 -1 - - - - - - - - - - - -62E73052-83EE-476B-B084-67E5B4D8CF7D -1694699472 -榨菜 -1694699472 -榨菜 -ORG {56152D3D-A923-4887-94E9-92E455B66C0F} -DAT 1694699473 - - - - - - - - - - -B84B414B-A8A9-4646-A7D5-1099E1BD731C -保卫枪械 -defence_firearms -1694699472 -榨菜 -1694699472 -榨菜 -ORG {79363DB4-04FC-466E-B22B-1487802D2C78} -DAT 1694699473 -ORG {8DDD6E34-F60E-421A-AB47-AE92B6AEAD79} -DAT 1694699456 -0..* -1 -1 - - - - - - - - - - - -E80F8C1C-9110-42F5-A9B8-5ECCBCC97983 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {0F2C51A8-71D4-42AC-BAF4-402A824C01A4} -DAT 1694699473 - - - - - - - - - - -CAAD1C53-D785-4142-8ADF-A6F842AA2DA4 -潜伏角色 -aggressor_character -1694699472 -榨菜 -1694699472 -榨菜 -ORG {C2C86B42-F979-41AB-A272-B49A4C96ACAA} -DAT 1694699473 -ORG {D4C3B6A3-ED20-4447-AE57-C7C53E38B6DD} -DAT 1694699456 -0..* -1 -1 - - - - - - - - - - - -B9A89CCB-E5B0-44C1-9361-7B172C8378DD -1694699472 -榨菜 -1694699472 -榨菜 -ORG {9961C060-00B9-4C3D-943D-AA18977F5763} -DAT 1694699473 - - - - - - - - - - -430DF0C8-68C1-441E-86C6-2463BD0361CD -潜伏枪械 -aggressor_firearms -1694699472 -榨菜 -1694699472 -榨菜 -ORG {7D2B6874-91C7-49F4-948C-6301061D0B9D} -DAT 1694699473 -ORG {A850D229-531B-4735-A4A5-524D705C91DB} -DAT 1694699456 -0..* -1 -1 - - - - - - - - - - - -D0BDEA57-0873-45A1-A412-8E811F5BA6F7 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {3C0ACB58-3244-440A-9272-0511A7FC6B8C} -DAT 1694699473 - - - - - - - - - - -82E6EA1C-8360-41D5-B032-EE9DA363E562 -选模式 -choose_model -1694699472 -榨菜 -1694699472 -榨菜 -ORG {E8F93C18-AEA6-462C-95D7-A5BEA01A2641} -DAT 1694699473 -ORG {A3E36BFA-BBE8-4CB3-8424-C6F685981F86} -DAT 1694699456 -0..* -1 -1 - - - - - - - - - - - -2ECE6FF0-2B37-4800-AD1A-29BE918E4272 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {9EC87D3C-D843-4F92-BDD0-86DCF0978A89} -DAT 1694699473 - - - - - - - - - - -06BFC83D-684A-4281-BEE5-D7B3C466C413 -选地图 -choose_map -1694699472 -榨菜 -1694699472 -榨菜 -ORG {9E132309-36C4-47C2-9B1B-A78DF54B67DF} -DAT 1694699473 -ORG {E623B725-EAC6-4C64-9AE4-98A38D87BE30} -DAT 1694699456 -0..* -1 -1 - - - - - - - - - - - -70D11F1D-FE1B-4211-B10E-CFA91BFA991A -1694699472 -榨菜 -1694699472 -榨菜 -ORG {D8E68253-1B96-444C-A496-74F13469658D} -DAT 1694699473 - - - - - - - - - - -D67A7B31-781A-40D5-A55A-4C3E2DD6F365 -对抗 -defence_VS -1694699472 -榨菜 -1694699472 -榨菜 -ORG {C4590F99-B33E-4F2B-BB1F-167EE314FD7C} -DAT 1694699473 -ORG {D83A37F7-FC3B-4930-927D-A442E22262F2} -DAT 1694699456 -0..* -1 -1 - - - - - - - - - - - -4B33BFA1-643F-4B74-9D11-9C2E4627ADDF -1694699472 -榨菜 -1694699472 -榨菜 -ORG {ECA0EB94-020A-46F0-8F69-44ADECB5E987} -DAT 1694699473 - - - - - - - - - - -E7F5779A-9C3C-42BF-A616-F04E9132711C -对抗 -aggressor_VS -1694699472 -榨菜 -1694699472 -榨菜 -ORG {9050E7FF-644E-4404-8159-10424B408BD2} -DAT 1694699473 -ORG {E2C0E3EF-9E32-43E9-B1A7-72D7D10FE3C3} -DAT 1694699456 -0..* -1 -1 - - - - - - - - - - - -B3C2FDDC-8309-475B-B73D-6FEA63330170 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {ACC362EB-B9E9-4EB8-9962-2378945CCBB1} -DAT 1694699473 - - - - - - - - - - -9C0BB945-3A29-4CEB-AD5E-C991366323C4 -对抗结果 -VS_result -1694699472 -榨菜 -1694699472 -榨菜 -ORG {58DE069C-5D35-44D3-B666-B6C43B4ABC56} -DAT 1694699473 -ORG {B40AD1A1-05E2-4E84-9244-07AA66BF23C8} -DAT 1694699456 -0..* -1 -1 - - - - - - - - - - - -D22F0494-0E01-49AD-8325-5BF81507DC90 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {328C481F-ACFE-472E-971F-6EB8CE2C1C32} -DAT 1694699473 - - - - - - - - - - -9C441CCC-1ECF-4A5B-BE4F-3BEB8391573E -保卫结果 -defence_result2 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {9C5D84FF-65C1-48C2-A188-3976852B876F} -DAT 1694699473 -ORG {34F0C72B-684B-4F7C-AD9A-996476DF1B22} -DAT 1694699456 -1..* -1 -1 - - - - - - - - - - - -5188A393-C859-4545-80E1-857305091685 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {D35CECCB-83C4-4FE1-83A2-58E3DC28F14A} -DAT 1694699473 - - - - - - - - - - -8F17D260-580B-4E13-BFE7-E3E65D1F4615 -保卫结果 -defence_result -1694699472 -榨菜 -1694700372 -榨菜 -ORG {43C7F1D2-C7D6-4B42-B615-AFA37B808462} -DAT 1694699473 -ORG {34F0C72B-684B-4F7C-AD9A-996476DF1B22} -DAT 1694699456 -1..* -1 -1 - - - - - - - - - - - -47E589EF-8A15-436B-BE5C-3F4C3821557F -1694699472 -榨菜 -1694699472 -榨菜 -ORG {723206D6-0511-410A-A520-16FA7F1E8375} -DAT 1694699473 - - - - - - - - - - -88C4C320-E427-47C2-8E65-5D0CC543C888 -潜伏结果 -aggressor_result2 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {48954F4F-24B1-4705-A79E-00F419064263} -DAT 1694699473 -ORG {86D565B6-338B-4776-BE7D-F01BD31E0E4B} -DAT 1694699456 -1..* -1 -1 - - - - - - - - - - - -56F76FEC-003D-42B7-A753-B7F39CA87F15 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {BFC7AE84-DF2B-4267-AE43-8A9D7234191B} -DAT 1694699473 - - - - - - - - - - -05A53765-2B5F-4776-8093-9598E463270C -潜伏结果 -aggressor_result -1694699472 -榨菜 -1694700377 -榨菜 -ORG {865B1904-C8F3-4FBA-BACB-1881B860E137} -DAT 1694699473 -ORG {86D565B6-338B-4776-BE7D-F01BD31E0E4B} -DAT 1694699456 -1..* -1 -1 - - - - - - - - - - - -826CB393-1C91-48A9-80CB-ADFB2716D467 -1694699472 -榨菜 -1694699472 -榨菜 -ORG {3AB4B5C6-79C2-42DF-9052-842B8A5801EA} -DAT 1694699473 - - - - - - - - - - - - -A3DB3B5B-C2DA-44F7-AD95-13A19DD517EA -PUBLIC -PUBLIC -1694699470 -榨菜 -1694699470 -榨菜 - - - - -08C8590B-749B-407F-BAF9-0166EE310579 -MySQL 5.0 -MYSQL50 -1694699470 -榨菜 -1694699470 -榨菜 -file:///%_DBMS%/mysql50.xdb -F4F16ECD-F2F1-4006-AF6F-638D5C65F35E -4BA9F647-DAB1-11D1-9944-006097355D9B -1276524678 - - - - - -172BFBCA-9353-45EA-BBFE-B66AFB045717 -ConceptualDataModel_1 -ConceptualDataModel_1 -1694699473 -榨菜 -1694700777 -榨菜 -file:///E|/数据库-高级进阶/database-advanced/53 周厚辰/20230914 第七次作业 CF数据库/ConceptualDataModel_1.ldm -97B017EB-1881-45B3-A485-C7DDA54BDE63 -5F45F978-C4F3-4E35-A3FC-AF3318663A0F -1694700778 - - - - - - - - - - \ No newline at end of file diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230923 \347\254\254\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232 \351\242\204\344\271\240/\350\247\206\345\233\276\344\270\216\345\207\275\346\225\260.md" "b/53 \345\221\250\345\216\232\350\276\260/20230923 \347\254\254\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232 \351\242\204\344\271\240/\350\247\206\345\233\276\344\270\216\345\207\275\346\225\260.md" deleted file mode 100644 index 3ff46cab9bc53fb114465db4509433945e4220ca..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230923 \347\254\254\345\215\201\344\272\214\346\254\241\344\275\234\344\270\232 \351\242\204\344\271\240/\350\247\206\345\233\276\344\270\216\345\207\275\346\225\260.md" +++ /dev/null @@ -1,21 +0,0 @@ -# 预习 - -## 视图与函数 - -### 关于数据库视图(Views): - -1. 视图是基于一个或多个表的查询结果集的虚拟表。 -2. 视图可以被认为是一个存储的查询,通过它可以方便地重用和简化常用的数据查询操作。 -3. 创建视图时,可以指定筛选条件和列的子集,从而实现数据的隐藏和限制访问。 -4. 视图的数据并不是存储在数据库中,而是根据其定义和查询结果动态生成的。 -5. 视图提供了一种逻辑上组织和分离数据的方式,使得数据的修改和查询操作更加灵活和简化。 - -### 关于数据库函数(Functions): - -1. 函数是一段可重用的代码,用于执行特定的操作并返回结果。 -2. MySQL提供了各种内置的函数,如数学函数(如ABS、ROUND),字符串函数(如CONCAT、SUBSTRING),日期和时间函数(如NOW、DATE_FORMAT)等。 -3. 函数可以通过给定参数来接收输入,并根据逻辑进行计算和操作。 -4. 函数可以用于查询语句的SELECT子句、WHERE子句、HAVING子句等部分,以及存储过程和触发器中。 -5. 在创建函数时,可以指定参数的数量和类型,也可以定义函数的返回值类型。 -6. 用户可以根据自己的需求创建自定义的函数,以满足特定的业务逻辑和计算需求。 - diff --git "a/53 \345\221\250\345\216\232\350\276\260/20230926 \347\254\254\345\215\201\344\270\211\346\254\241\344\275\234\344\270\232 \350\247\206\345\233\276/\350\247\206\345\233\276.md" "b/53 \345\221\250\345\216\232\350\276\260/20230926 \347\254\254\345\215\201\344\270\211\346\254\241\344\275\234\344\270\232 \350\247\206\345\233\276/\350\247\206\345\233\276.md" deleted file mode 100644 index e9a43572f754804d0ed9114cde995df8706845e6..0000000000000000000000000000000000000000 --- "a/53 \345\221\250\345\216\232\350\276\260/20230926 \347\254\254\345\215\201\344\270\211\346\254\241\344\275\234\344\270\232 \350\247\206\345\233\276/\350\247\206\345\233\276.md" +++ /dev/null @@ -1,154 +0,0 @@ -# 2023年9月26日 视图 - ---- - -## 知识点 - -check 用于检查字段值 - -视图依靠于基表,基表被删除视图也随着被删除,但是删除视图,基表不受影响 - -视图是一种虚拟表,他不存储数据 - -在UTF-8字符集中,一个汉字占一个字符,一个汉字占3个字符集(byte) - ---- - -创建视图的语法 - -```mysql -create view [视图名] as [select查询语句] -create or replace view as [select查询语句] -``` - -修改视图的语法 - -```mysql -alter view [视图名] as [select查询语句] -- 使用此语法的前提是:要修改的视图存在,如果不存在将会报错 -create or replace view as [select查询语句] -- 此语法的意思是:如果存在此视图就修改,不存在则创建 -``` - -删除视图的语法 - -```mysql -drop view [视图名] -- 使用此语法的前提是:要修改的视图存在,如果不存在将会报错 -``` - - - -#### **视图本身是不可插入**、更新、或删除的。 就像我们不能向Excel中的函数查询结果插入数据一样,MySQL视图也是一个只读的虚拟表格,它只是将查询语句的结果封装成一个新的表格而已。 因此,无法通过直接向MySQL视图中插入数据的方式,对基础表格进行修改。 - ---- - -### 以下知识点来自网络 - -$$ -MySQL数据库中的视图是基于一个或多个表的查询结果集,可以像表一样进行查询操作。以下是关于MySQL数据库中视图的一些知识和语法: - -1. 创建视图: - CREATE VIEW view_name AS SELECT column1, column2, ... FROM table_name WHERE condition; - -2. 修改视图: - ALTER VIEW view_name AS SELECT column1, column2, ... FROM table_name WHERE condition; - -3. 删除视图: - DROP VIEW view_name; - -4. 查看视图: - SHOW CREATE VIEW view_name; - -5. 使用视图: - SELECT * FROM view_name; - -6. 更新视图: - UPDATE view_name SET column1 = value1, column2 = value2, ... WHERE condition; - -7. 删除视图中的数据: - DELETE FROM view_name WHERE condition; - -8. 视图可以嵌套使用,即一个视图可以基于另一个视图进行创建。 - -9. 视图可以包含聚合函数、子查询和连接操作。 - -10. 视图可以简化复杂的查询操作,提高查询效率。 - -11. 视图可以被用作数据安全性的控制,通过限制用户对视图的访问来实现数据的保护。 - -12. 视图的更新操作受到一些限制,例如视图不能包含GROUP BY子句、HAVING子句和子查询。 - -13. 视图可以被索引,以提高查询性能。 - -14. 视图的定义可以被修改,但是如果视图被其他对象引用,修改可能会失败。 - -15. 视图可以被用于数据的分层和组织,使得数据的访问更加灵活和方便。 - -注意:以上是MySQL数据库中视图的一些常见知识和语法,具体的使用方法和限制可能会根据不同的数据库版本和配置有所不同。请参考MySQL官方文档或其他相关资料获取更详细和准确的信息。 -$$ - - - ---- - -## 代码: - -```mysql - --- --- #第14章_视图的课后练习 --- --- USE dbtest14; --- #练习1: --- #1. 使用表emps创建视图employee_vu, --- #其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -create view employee_vu as select * from employees; --- --- --- --- --- #2. 显示视图的结构 -describe employee_vu; --- --- #3. 查询视图中的全部内容 --- --- -select * from employee_vu; --- #4. 将视图中的数据限定在部门号是80的范围内 -select * from employee_vu where department_id=80; --- --- #练习2: --- --- --- #1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -create view emp_v1 as select last_name,salary, email from employees WHERE phone_number like "011%"; --- --- --- --- #2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符的员工姓名和邮箱、电话号码,工资 -alter view emp_v1 as select last_name,salary, email from employees WHERE phone_number like "011%" && email like "%e%"; --- --- --- #3. 向 emp_v1 插入一条记录,是否可以? -可以; --- --- #4. 修改emp_v1中员工的工资,每人涨薪1000 -update emp_v1 set salary=salary+1000; --- --- #5. 删除emp_v1中姓名为Olsen的员工 -delete from emp_v1 where last_name="Olsen"; --- #6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create view emp_v2(部门ID,最高工资) as select department_id,max(salary) from employees GROUP BY department_id; --- -select * from emp_v2; -select * from employees; --- --- --- #7. 向 emp_v2 中插入一条记录,是否可以? -可以; - --- --- --- --- #8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v2,emp_v1; -``` - diff --git "a/54 \345\217\266\345\255\220\350\261\252/9.12\344\275\234\344\270\232.md" "b/54 \345\217\266\345\255\220\350\261\252/9.12\344\275\234\344\270\232.md" deleted file mode 100644 index 603755cd9a8f09dbc4856229a84ca9622379ca21..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/9.12\344\275\234\344\270\232.md" +++ /dev/null @@ -1,124 +0,0 @@ -```mysql - -CREATE DATABASE aa; -use aa; -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 11:28:33 */ -/*==============================================================*/ - - -drop table if exists a; - -drop table if exists dianying; - -drop table if exists doubandianying; - -drop table if exists xieyingping; - -drop table if exists yanyuanxinxi; - -drop table if exists ²é¿´ÆÀÂÛ; - -/*==============================================================*/ -/* Table: a */ -/*==============================================================*/ -create table a -( - imdb_id varchar(20) not null, - IMDb varchar(20) not null, - dy_name varchar(20) not null, - primary key (imdb_id, IMDb) -); - -/*==============================================================*/ -/* Table: dianying */ -/*==============================================================*/ -create table dianying -( - IMDb varchar(20) not null, - wz varchar(20), - dy_name varchar(20) not null, - dy_lx varchar(20) not null, - zpgj varchar(20) not null, - dy_language varchar(20) not null, - sy_time date not null, - time time not null, - dy_ym varchar(20), - primary key (IMDb) -); - -/*==============================================================*/ -/* Table: doubandianying */ -/*==============================================================*/ -create table doubandianying -( - wz varchar(20) not null, - mc varchar(20) not null, - primary key (wz) -); - -/*==============================================================*/ -/* Table: xieyingping */ -/*==============================================================*/ -create table xieyingping -( - re_id int not null auto_increment, - IMDb varchar(20), - re_evaluate varchar(20) not null, - re_headline varchar(20) not null, - re_text varchar(999) not null, - primary key (re_id) -); - -/*==============================================================*/ -/* Table: yanyuanxinxi */ -/*==============================================================*/ -create table yanyuanxinxi -( - imdb_id varchar(20) not null, - name varchar(20) not null, - sex char(1) not null, - constellation varchar(20) not null, - birthday varchar(20) not null, - birthplace varchar(20) not null, - occupation varchar(20) not null, - more_name varchar(20) not null, - family varchar(20) not null, - introduction varchar(200) not null, - primary key (imdb_id) -); - -/*==============================================================*/ -/* Table: ²é¿´ÆÀÂÛ */ -/*==============================================================*/ -create table ²é¿´ÆÀÂÛ -( - re_id1 char(10) not null, - IMDb varchar(20), - re_evaluate varchar(20) not null, - re_name char(10) not null, - re_time char(10) not null, - re_text1 char(10) not null, - reply char(10) not null, - primary key (re_id1) -); - -alter table a add constraint FK_Relationship_2 foreign key (imdb_id) - references yanyuanxinxi (imdb_id) on delete restrict on update restrict; - -alter table a add constraint FK_Relationship_5 foreign key (IMDb) - references dianying (IMDb) on delete restrict on update restrict; - -alter table dianying add constraint FK_Relationship_1 foreign key (wz) - references doubandianying (wz) on delete restrict on update restrict; - -alter table xieyingping add constraint FK_Relationship_3 foreign key (IMDb) - references dianying (IMDb) on delete restrict on update restrict; - -alter table ²é¿´ÆÀÂÛ add constraint FK_Relationship_4 foreign key (IMDb) - references dianying (IMDb) on delete restrict on update restrict; - - -``` - diff --git "a/54 \345\217\266\345\255\220\350\261\252/9.13\344\275\234\344\270\232.md" "b/54 \345\217\266\345\255\220\350\261\252/9.13\344\275\234\344\270\232.md" deleted file mode 100644 index d733fafe29f75361b63e426e5a055aea1bed992d..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/9.13\344\275\234\344\270\232.md" +++ /dev/null @@ -1,106 +0,0 @@ -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 21:45:21 */ -/*==============================================================*/ - - -drop table if exists department; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists guahao; - -drop table if exists patient; - -drop table if exists warehouse; - -/*==============================================================*/ -/* Table: department */ -/*==============================================================*/ -create table department -( - department_id int not null auto_increment, - department_name varchar(20) not null, - department_address varchar(50) not null, - primary key (department_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - department_id int, - doctor_name varchar(10) not null, - doctor_age int not null, - doctor_sex varchar(10) not null, - illness varchar(20) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - drug_name varchar(20) not null, - treatment varchar(50) not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: guahao */ -/*==============================================================*/ -create table guahao -( - patient_id int not null, - doctor_id int not null, - primary key (patient_id, doctor_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(20) not null, - patient_age int not null, - patient_sex varchar(20) not null, - symptom varchar(100) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: warehouse */ -/*==============================================================*/ -create table warehouse -( - drug_id int not null, - doctor_id int not null, - primary key (drug_id, doctor_id) -); - -alter table doctor add constraint FK_Relationship_3 foreign key (department_id) - references department (department_id) on delete restrict on update restrict; - -alter table guahao add constraint FK_guahao foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table guahao add constraint FK_guahao2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table warehouse add constraint FK_warehouse foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -alter table warehouse add constraint FK_warehouse2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - - -``` - diff --git "a/54 \345\217\266\345\255\220\350\261\252/9.15\344\275\234\344\270\232.md" "b/54 \345\217\266\345\255\220\350\261\252/9.15\344\275\234\344\270\232.md" deleted file mode 100644 index 60013c6914d3dd606412202aabbe8e0d95c19b59..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/9.15\344\275\234\344\270\232.md" +++ /dev/null @@ -1,119 +0,0 @@ -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:43:09 */ -/*==============================================================*/ -create database che charset utf8; -use che; - -drop table if exists car; - -drop table if exists client; - -drop table if exists salesman; - -drop table if exists sell; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - car_name varchar(10) not null, - car_brand varchar(5) not null, - car_price int not null, - primary key (car_id) -); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - client_id int not null auto_increment, - client_name varchar(4) not null, - client_sex char(1) not null, - primary key (client_id) -); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id char(5) not null, - salesman_name varchar(4) not null, - salesman_age char(2) not null, - primary key (salesman_id) -); - -/*==============================================================*/ -/* Table: sell */ -/*==============================================================*/ -create table sell -( - sell_id int not null auto_increment, - client_id int, - car_id int, - salesman_id char(5), - sell_date date not null, - sell_price int not null, - primary key (sell_id) -); - -alter table sell add constraint FK_car_sell foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table sell add constraint FK_market foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - -alter table sell add constraint FK_purchase foreign key (client_id) - references client (client_id) on delete restrict on update restrict; - -#汽车 -insert into car values -(1,"RS7","奥迪",900000), -(2,"A6","奥迪",500000), -(3,"E300","奔驰",1000000), -(4,"X5","宝马",600000); -#顾客 -insert into client values -(1,"王","男"), -(2,"六","男"), -(3,"花","女"); -#销售员 -insert into salesman values -(10001,"小李","男"), -(10002,"小刘","女"), -(10003,"小梁","女"); -#售卖记录 -insert into sell values -(1,1,2,10003,"2023-11-11",666666), -(2,1,4,10003,"2023-11-22",600999), -(3,2,1,10002,"2023-11-16",888888), -(4,2,4,10003,"2023-11-12",500999), -(5,3,3,10001,"2023-11-26",1008611); - - -- 1.查询特定销售员的销售记录 - select * from sell a join salesman b on a.salesman_id=b.salesman_id where salesman_name = "小梁"; - -- 2.查找销售记录中销售价格最高的汽车 - select car.car_name from sell join car on sell.car_id = car.car_id where sell_price = (select max(sell_price) from sell); - -- 3.统计某个销售员的销售总额 - select b.salesman_name,sum(a.sell_price) from sell a join salesman b on a.salesman_id = b.salesman_id where b.salesman_name = "小梁"; - -- 4.根据客户信息查询其购买过的汽车 - select a.client_name 客户,c.car_brand 购买过的汽车 from client a - left join sell b on a.client_id = b.client_id - left join car c on b.car_id = c.car_id; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - select a.car_brand 品牌,count(car_brand) 销售数量,sum(sell_price) 总销售额 from car a - left join sell b on a.car_id = b.car_id - where car_brand = "宝马"; - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - select a.car_brand 品牌,b.sell_date 销售历史 from car a - left join sell b on a.car_id = b.car_id - where car_brand = "宝马"; - -- 8.统计每个销售员的销售数量 - select a.salesman_name 销售员,count(b.salesman_id) 销售数量 from salesman a - left join sell b on a.salesman_id = b.salesman_id group by salesman_name; diff --git "a/54 \345\217\266\345\255\220\350\261\252/9.19\344\275\234\344\270\232.md" "b/54 \345\217\266\345\255\220\350\261\252/9.19\344\275\234\344\270\232.md" deleted file mode 100644 index 9ad9768a16e57ec7021427f6de40096d8d408321..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/9.19\344\275\234\344\270\232.md" +++ /dev/null @@ -1,827 +0,0 @@ -~~~mysql -create database ab charset utf8; -use ab; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -CREATE DATABASE lx charset utf8; -use lx; - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- - --- Table structure for countries - --- ---------------------------- - -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of countries - --- ---------------------------- - -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- - --- Table structure for departments - --- ---------------------------- - -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of departments - --- ---------------------------- - -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- - --- Table structure for employees - --- ---------------------------- - -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of employees - --- ---------------------------- - -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- - --- Table structure for job_grades - --- ---------------------------- - -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of job_grades - --- ---------------------------- - -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- - --- Table structure for job_history - --- ---------------------------- - -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of job_history - --- ---------------------------- - -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- - --- Table structure for jobs - --- ---------------------------- - -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of jobs - --- ---------------------------- - -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- - --- Table structure for locations - --- ---------------------------- - -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of locations - --- ---------------------------- - -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- - --- Table structure for order - --- ---------------------------- - -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of order - --- ---------------------------- - -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- - --- Table structure for regions - --- ---------------------------- - -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- - --- Records of regions - --- ---------------------------- - -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- - --- View structure for emp_details_view - --- ---------------------------- - -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - - - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 -SELECT sum(salary*12) 基本工资 FROM employees; - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 - -SELECT (sum(salary)+sum(commission_pct*salary))*12 FROM employees; - -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的job_id以后的数据 - -#去除重复 distinct - -SELECT DISTINCT job_id FROM employees; - -# 3.查询工资大于12000的员工姓名和工资 - -SELECT first_name 员工姓名,salary 工资 FROM employees where salary>12000; - - -# 4.查询员工号为176的员工的姓名和部门号 - -SELECT first_name 姓名,department_id 部门号 FROM employees where employee_id = 176; -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - -DESC departments; - -SELECT * FROM departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -SELECT first_name 姓名,salary 工资 FROM employees where salary not BETWEEN 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -SELECT first_name 姓名,department_id 部门号 from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -SELECT first_name,job_id from employees where manager_id is null; - - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - - -SELECT first_name 员工姓名,salary 工资,j.grade_level 奖金级别 FROM employees e LEFT JOIN job_grades j on e.commission_pct*salary BETWEEN j.lowest_sal and j.highest_sal; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -SELECT * from employees WHERE first_name like '__尔'; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -SELECT * from employees WHERE last_name like '%特%' and last_name like '%尔%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -SELECT * FROM employees where first_name like '%尔'; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -SELECT first_name 姓名, j.job_title 工种 FROM employees e LEFT JOIN jobs j on e.job_id=j.job_id where e.department_id BETWEEN 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -SELECT first_name 员工姓名, salary 工资,manager_id 管理者id from employees where manager_id in (100,101,110); - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - -SELECT first_name 姓名 ,department_id 部门号,salary*12 年薪 from employees ORDER BY 年薪 DESC; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -SELECT first_name 姓名 ,salary 工资 from employees where salary not BETWEEN 8000 and 17000 ORDER BY salary desc LIMIT 0,20; - - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -SELECT * FROM employees where email like '%e%' ORDER BY LENGTH(email) desc , department_id asc; - - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 - -SELECT e.first_name 姓名,d.department_id 部门号, d.department_name 部门名称 FROM employees e LEFT JOIN departments d on d.department_id=e.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -SELECT job_id,location_id FROM employees e LEFT JOIN departments d on d.department_id=e.department_id where d.department_id=90; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -SELECT e.last_name , d.department_name , l.location_id,l.city FROM employees e LEFT JOIN departments d on d.department_id=e.department_id LEFT JOIN locations l on l.location_id=d.location_id where commission_pct is not null; - - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -SELECT e.last_name , e.job_id , d.department_id , d.department_name FROM employees e LEFT JOIN departments d on d.department_id=e.department_id LEFT JOIN locations l on l.location_id=d.location_id where l.city='多伦多'; - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -SELECT department_name 部门名称, city 部门地址, e.last_name 姓名, j.job_title 工作, e.salary 工资 FROM employees e,departments d,locations l,jobs j where e.department_id=d.department_id and d.location_id=l.location_id and j.job_id=e.job_id; - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 - --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -SELECT b.first_name 员工姓名,b.department_id 员工编号,a.last_name 上级姓名,a.manager_id 上级的员工编号 FROM employees a JOIN employees b where a.department_id=b.department_id; - - -# 7.查询哪些部门没有员工 - -SELECT * FROM departments d LEFT JOIN employees e on d.department_id=e.department_id where e.department_id is null; - -# 8. 查询哪个城市没有部门 - -SELECT * FROM departments d LEFT JOIN locations l on d.location_id=l.location_id where state_province is null ; - - - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -SELECT * FROM employees e JOIN departments d ON e.department_id = d.department_id WHERE d.department_name like '销售部' or d.department_name like '信息技术部'; - - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - -SELECT MAX(salary) 最大值,MIN(salary) 最小值,AVG(salary) 平均值,SUM(salary) 总和 FROM employees; -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -SELECT MAX(salary) 最大值,MIN(salary) 最小值,AVG(salary) 平均值,SUM(salary) 总和,job_id FROM employees GROUP BY job_id; -#4.选择各个job_id的员工人数 - -SELECT count(job_id) FROM employees GROUP BY job_id; - -# 5.查询员工最高工资和最低工资的差距 - -SELECT MAX(salary) - MIN(salary) 差距 FROM employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - - SELECT MAX(salary) 最大值,MIN(salary) 最小值 FROM employees WHERE salary>6000 and manager_id is not null GROUP BY manager_id; - - -​ - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - - -SELECT d.department_name,AVG(salary),count(job_id) FROM employees e JOIN departments d ON e.department_id = d.department_id GROUP BY d.department_name ORDER BY AVG(salary) DESC; - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -SELECT job_title,department_name,min_salary FROM jobs j JOIN employees e on j.job_id=e.job_id join departments d on e.department_id=d.department_id - - - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - - -SELECT last_name,salary FROM employees WHERE department_id= (SELECT department_id FROM employees WHERE last_name like '兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - - -SELECT employee_id,last_name,salary FROM employees WHERE salary>(SELECT AVG(salary) FROM employees); -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary -SELECT last_name, job_id, salary FROM employees WHERE salary>(SELECT MAX(salary) FROM employees WHERE JOB_ID = 'SA_MAN'); - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -SELECT employee_id FROM employees where first_name like "%u%"; -SELECT employee_id 员工号,first_name 姓名 FROM employees where employee_id = (SELECT employee_id FROM employees where first_name like "%u%"); - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -SELECT location_id FROM departments where location_id = 1700; -SELECT first_name,department_id FROM employees where department_id in (SELECT department_id FROM departments where location_id = 1700); - - -#6.查询管理者是 金 的员工姓名和工资 -SELECT last_name FROM employees WHERE last_name='金'; - -SELECT first_name 员工姓名,salary 工资 FROM employees where last_name in (SELECT last_name FROM employees WHERE last_name='金'); -#7.查询工资最低的员工信息: last_name, salary - -SELECT last_name,salary FROM employees WHERE salary =(SELECT MIN(salary) FROM employees); - - -#8.查询平均工资最低的部门信息 -#方式1: - -# 部门最低工资=全司最低 - -#方式2 - -# 部门平均<= 公司所有平均 - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - - # 连表查 - - # 子查询 - s - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 - - -#11.查询平均工资高于公司平均工资的部门有哪些? - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - -#16. 选择所有没有管理者的员工的last_name - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - - -#方式2: - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - -#方式2:在FROM中声明子查询 - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - -``` - -``` - - -~~~ - - - diff --git "a/54 \345\217\266\345\255\220\350\261\252/9.21\344\275\234\344\270\232.md" "b/54 \345\217\266\345\255\220\350\261\252/9.21\344\275\234\344\270\232.md" deleted file mode 100644 index c315dffece2884eebdeb6a91810ffddc6e370899..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/9.21\344\275\234\344\270\232.md" +++ /dev/null @@ -1,139 +0,0 @@ -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/21 19:33:27 */ -/*==============================================================*/ - - -drop table if exists shangpinleixing; - -drop table if exists shangpinshuxing; - -drop table if exists sku; - -drop table if exists spu; - -drop table if exists zhongjian; - -/*==============================================================*/ -/* Table: shangpinleixing */ -/*==============================================================*/ -create table shangpinleixing -( - lx_id int not null auto_increment, - lx_name varchar(20) not null, - primary key (lx_id) -); - -/*==============================================================*/ -/* Table: shangpinshuxing */ -/*==============================================================*/ -create table shangpinshuxing -( - sx_id int not null auto_increment, - sx_name varchar(50) not null, - primary key (sx_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price float(8,2) not null, - kucun varchar(20) not null, - primary key (stu_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(50) not null, - spu_jieshao varchar(50) not null, - primary key (spu_id) -); - -/*==============================================================*/ -/* Table: zhongjian */ -/*==============================================================*/ -create table zhongjian -( - zj_id int not null auto_increment, - sku_id int, - sx_id int, - lx_id int, - primary key (zj_id) -); - -insert into spu values -(null,'iPhone XR','一机改三代,人走机还在'); - -insert into shangpinshuxing values -(null,'颜色'), -(null,'容量'); - -insert into shangpinleixing values -(null,'黑色'), -(null,'白色'), -(null,'红色'), -(null,'64G'), -(null,'128G'), -(null,'256G'); - - -insert into zhongjian values -(null,1,1,1), -(null,1,2,4), -(null,2,1,2), -(null,2,2,4), -(null,3,1,3), -(null,3,2,4), -(null,4,1,1), -(null,4,2,5), -(null,5,1,2), -(null,5,2,5), -(null,6,1,1), -(null,6,2,6), -(null,7,1,2), -(null,7,2,6), -(null,8,1,3), -(null,8,2,6); - -insert into sku values -(null,1,'iPhone XR 64G 黑色',1200,0), -(null,1,'iPhone XR 64G 白色',1200,5), -(null,1,'iPhone XR 64G 红色',1200,5), -(null,1,'iPhone XR 128G 黑色',1500,10), -(null,1,'iPhone XR 128G 白色',1500,20), -(null,1,'iPhone XR 128G 红色'1500,20) -(null,1,'iPhone XR 256G 黑色',1999,30), -(null,1,'iPhone XR 256G 白色',1999,30), -(null,1,'iPhone XR 256G 红色',1999,30); - - -select * from shangpinleixing lx,shangpinshuxing sx,sku s,spu sp,zhongjian zj -where lx.lx_id=zj.lx_id and sx.sx_id=zj.sx_id,s.sku_id=zj.sku_id,s.spu_id=sp.spu_id; - - - -alter table sku add constraint FK_Relationship_1 foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -alter table zhongjian add constraint FK_Relationship_2 foreign key (stu_id) - references sku (stu_id) on delete restrict on update restrict; - -alter table zhongjian add constraint FK_Relationship_3 foreign key (sx_id) - references shangpinshuxing (sx_id) on delete restrict on update restrict; - -alter table zhongjian add constraint FK_Relationship_4 foreign key (lx_id) - references shangpinleixing (lx_id) on delete restrict on update restrict; - - -``` - diff --git "a/54 \345\217\266\345\255\220\350\261\252/9.6\344\275\234\344\270\232.md" "b/54 \345\217\266\345\255\220\350\261\252/9.6\344\275\234\344\270\232.md" deleted file mode 100644 index 8caa9d71e81a2aac6088edb1541426a85f729a23..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/9.6\344\275\234\344\270\232.md" +++ /dev/null @@ -1,84 +0,0 @@ -```mysql -create database md charset utf8; - -use md; - -##院系表 -create table yxb( - d_id int primary key, - d_name varchar(20) -); - -##专业表 -create table zyb( - s_id int primary key, - s_name varchar(20), - d_id int, - foreign key (d_id) references yxb(d_id) -); - -##教室表 -create table jsb( -r_id int PRIMARY KEY, -r_name varchar(10) -); - -##班级表 -create table bjb( - c_id int primary key, - c_name varchar(20), - s_id int, - foreign key (s_id) references zyb(s_id) -); - -##课程 -CREATE TABLE kc( - couseId int PRIMARY key, - courseName varchar(10), - credit int, - c_id int, - r_id int, - foreign key (c_id) references bjb(c_id), - foreign key (r_id) references jsb(r_id) -); - -##教师表 -create table teacher( - t_id int primary key, - t_name varchar(20), - sex varchar(20), - d_id int, - couseId int, - foreign key (d_id) references yxb(d_id), - foreign key (couseId) references kc(couseId) -); - -##课程表 -create table kcb ( - selectId int primary key, - couseId int, - time varchar(20), - t_id int, - r_id int, - foreign key (couseId) references kc(couseId), - foreign key (t_id) references teacher(t_id), - foreign key (r_id) references jsb(r_id) -); - -##学生表 -create table student ( - id int primary key, - name varchar(20), - sex varchar(10), - age int, - address varchar(20), - d_id int, - c_id int, - selectId int, - foreign key (d_id) references yxb(d_id), - foreign key (c_id) references bjb(c_id), - foreign key (selectId) references kcb(selectId) -); - -``` - diff --git "a/54 \345\217\266\345\255\220\350\261\252/9.8\344\275\234\344\270\232 .md" "b/54 \345\217\266\345\255\220\350\261\252/9.8\344\275\234\344\270\232 .md" deleted file mode 100644 index 51f084d1cbad498320fc82e4ee47afb1cb11da68..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/9.8\344\275\234\344\270\232 .md" +++ /dev/null @@ -1,108 +0,0 @@ -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 13:47:42 */ -/*==============================================================*/ - - -drop table if exists chubanshe; - -drop table if exists guanliyuan; - -drop table if exists jieyuebiao; - -drop table if exists tushufenlei; - -drop table if exists tushuguan; - -drop table if exists xuesheng; - -/*==============================================================*/ -/* Table: chubanshe */ -/*==============================================================*/ -create table chubanshe -( - cbs_id int not null, - ts_id int, - cbs_name varchar(20) not null, - cbs_address varchar(50) not null, - cbs_emal varchar(20) not null, - primary key (cbs_id) -); - -/*==============================================================*/ -/* Table: guanliyuan */ -/*==============================================================*/ -create table guanliyuan -( - gly_id int not null, - gly_name varchar(20) not null, - gly_sex varchar(20) not null, - primary key (gly_id) -); - -/*==============================================================*/ -/* Table: jieyuebiao */ -/*==============================================================*/ -create table jieyuebiao -( - xs_id int not null, - ts_id int not null, - jy_time datetime not null, - gh_time datetime not null, - primary key (xs_id, ts_id) -); - -/*==============================================================*/ -/* Table: tushufenlei */ -/*==============================================================*/ -create table tushufenlei -( - ts_id int not null, - tsg_id int, - ts_name varchar(20) not null, - primary key (ts_id) -); - -/*==============================================================*/ -/* Table: tushuguan */ -/*==============================================================*/ -create table tushuguan -( - tsg_id int not null, - gly_id int, - tsg_name varchar(20) not null, - primary key (tsg_id) -); - -/*==============================================================*/ -/* Table: xuesheng */ -/*==============================================================*/ -create table xuesheng -( - xs_id int not null, - xs_name varchar(20) not null, - xs_age int not null, - xs_class varchar(20) not null, - xs_sex varchar(10) not null, - primary key (xs_id) -); - -alter table chubanshe add constraint FK_Relationship_4 foreign key (ts_id) - references tushufenlei (ts_id) on delete restrict on update restrict; - -alter table jieyuebiao add constraint FK_Relationship_3 foreign key (xs_id) - references xuesheng (xs_id) on delete restrict on update restrict; - -alter table jieyuebiao add constraint FK_Relationship_5 foreign key (ts_id) - references tushufenlei (ts_id) on delete restrict on update restrict; - -alter table tushufenlei add constraint FK_Relationship_2 foreign key (tsg_id) - references tushuguan (tsg_id) on delete restrict on update restrict; - -alter table tushuguan add constraint FK_Relationship_1 foreign key (gly_id) - references guanliyuan (gly_id) on delete restrict on update restrict; - - -``` - diff --git "a/54 \345\217\266\345\255\220\350\261\252/\347\254\224\350\256\260 (2).md" "b/54 \345\217\266\345\255\220\350\261\252/\347\254\224\350\256\260 (2).md" deleted file mode 100644 index 9056a68deb0573cf5d1e239a441adf1a0b5929ed..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/\347\254\224\350\256\260 (2).md" +++ /dev/null @@ -1,20 +0,0 @@ -一.事务 - - 什么是事务:为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - -事务的四个特性 - -- 原子性:事务包含的这一系列操作,要么全部成功,要么全部失败。 -- 一致性:事务完成之后,不会将非法的数据写入数据库。 -- 隔离性:多个事务可以在一定程度上并发执行。 -- 持久性:事务完成之后,数据要永久保存(一般会保存在硬盘上)。 - -隔离级别: - -1.读未提交:一个事务可以读取到另外一个事务尚未提交的数据。该隔离级别可能会产生“脏读”、“不可重复读取”和“幻影读取”问题。 - -2.读已提交:一个事务只能读取到另外一个事务已经提交的数据。该隔离级别解决了“脏读”问题,但是仍然可能会发生“不可重复读取”和“幻影读取”问题。 - -3.可重复读取:在同一个事务当中,多次读取同一份数据,结果一样。该隔离级别解决了“脏读”和“不可重复读取”问题,但是仍然有可能会产生“幻影读取问题”(虚读)。 - -序列化:多个同务只能排队执行,即只有一个事务结束之后,另外一个事务才能开始执行。该隔离级别解决了“脏读”,“不可重复读取”和“幻影读取”问题,但是程序性能会下降。所以只有必要的时候(比如在银行系统里面)才会使用。 \ No newline at end of file diff --git "a/54 \345\217\266\345\255\220\350\261\252/\347\254\224\350\256\260 (3).md" "b/54 \345\217\266\345\255\220\350\261\252/\347\254\224\350\256\260 (3).md" deleted file mode 100644 index 3298eda46549cbd0c60ec0a15de34043397db1c2..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/\347\254\224\350\256\260 (3).md" +++ /dev/null @@ -1,29 +0,0 @@ -视图是一种虚拟表,本身是不具有数据的。 - -可以把查的临时表数据保存在视图里方便查询 - -create view 名称 as 查询语句 - -concat(“字段名”,“字段名”)(可以把字段结合在一起) - -查视图对象 - -show tables - -查看创建视图的语句 - -show create view 视图名称 - -当视图和基表是一对一的时候可以更新。 - -修改视图语句 - -1.create or replace view 视图名称 as 查询语句 (有就更新 没有就创建) - -2.alter view 视图名称 as 查询语句 (一定要存在被修改的视图) - -删除视图 - -drop view 视图名称 - -drop view if exists 视图名称(有就删除没有就跳过) \ No newline at end of file diff --git "a/54 \345\217\266\345\255\220\350\261\252/\347\254\224\350\256\260.md" "b/54 \345\217\266\345\255\220\350\261\252/\347\254\224\350\256\260.md" deleted file mode 100644 index 99f49d6051e80b9b4554084556cf411b028bdb8c..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/\347\254\224\350\256\260.md" +++ /dev/null @@ -1,5 +0,0 @@ -RBAC:基于角色的访问权限管制模型 - -RBAC的概念:一种数据库设计思想,目前开发系统的主流设计思想 - -RBAC的核心是角色 \ No newline at end of file diff --git "a/54 \345\217\266\345\255\220\350\261\252/\347\254\254\344\270\200\345\244\251\347\254\224\350\256\260.md" "b/54 \345\217\266\345\255\220\350\261\252/\347\254\254\344\270\200\345\244\251\347\254\224\350\256\260.md" deleted file mode 100644 index 96e20d2cf61433ba0569e51520dda8fb44730e75..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/\347\254\254\344\270\200\345\244\251\347\254\224\350\256\260.md" +++ /dev/null @@ -1,13 +0,0 @@ -数据库高级 (MySQL) - -JavaScript (Ajax) - -MVC 框架 (Maven,spring,springMvc,Mybatis)java经典框架 俗称SSM - -node.js - -vue.js 简化开发 有UI框架配合 - -springboot (Redis,webAPI) - -node.js 和 vue.js 属于前端 \ No newline at end of file diff --git "a/54 \345\217\266\345\255\220\350\261\252/\347\254\254\344\270\211\345\244\251\347\254\224\350\256\260.md" "b/54 \345\217\266\345\255\220\350\261\252/\347\254\254\344\270\211\345\244\251\347\254\224\350\256\260.md" deleted file mode 100644 index affa112b67893fe34a1c676a66f0e6b8da99b6ea..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/\347\254\254\344\270\211\345\244\251\347\254\224\350\256\260.md" +++ /dev/null @@ -1,7 +0,0 @@ -# 数据库的范式 - -第一范式:要求字段的内容,不可再分割为保证数据的原子性 - -第二范式:要求在满足第一范式的基础上要求非主键字段要完全依赖主键(非主键要依赖整个联合主键)而不能只依赖部分 - -第三范式:满足第二范式的前提下要求非主键属性要直接依赖于主键 \ No newline at end of file diff --git "a/54 \345\217\266\345\255\220\350\261\252/\347\254\254\344\272\214\345\244\251\347\254\224\350\256\260.md" "b/54 \345\217\266\345\255\220\350\261\252/\347\254\254\344\272\214\345\244\251\347\254\224\350\256\260.md" deleted file mode 100644 index 124a48990362e0472c1e038fc81ed744c226aa68..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/\347\254\254\344\272\214\345\244\251\347\254\224\350\256\260.md" +++ /dev/null @@ -1,19 +0,0 @@ -# 表与表之间的关系: - -一对一的关系:将其中任意表的主键放到另一个表当外键 - -一对多的关系:将一所在的表的主键放到多的表当外键 - -多对多的关系:必须建立第三张表,将前两个表主键当外键 - - - -# E-R图 - -概念: - -ER图:实体关系图,指**实体,关系,属性**三个具体概念的概括 - -要素: - -3要素:实体(表),属性(字段)和关系(类似外键) \ No newline at end of file diff --git "a/54 \345\217\266\345\255\220\350\261\252/\347\254\254\345\205\255\345\244\251\347\254\224\350\256\260.md" "b/54 \345\217\266\345\255\220\350\261\252/\347\254\254\345\205\255\345\244\251\347\254\224\350\256\260.md" deleted file mode 100644 index c474662cccc732c7a1cfd5fc81373c4b9985813a..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/\347\254\254\345\205\255\345\244\251\347\254\224\350\256\260.md" +++ /dev/null @@ -1 +0,0 @@ -如果一个主体的属性有多个值那这个属性就可以拆成一个新的主体 \ No newline at end of file diff --git "a/54 \345\217\266\345\255\220\350\261\252/\347\254\254\345\233\233\345\244\251\347\254\224\350\256\260.md" "b/54 \345\217\266\345\255\220\350\261\252/\347\254\254\345\233\233\345\244\251\347\254\224\350\256\260.md" deleted file mode 100644 index 49c2e3cc961b7855d16631cbfd56a45b5427bcfe..0000000000000000000000000000000000000000 --- "a/54 \345\217\266\345\255\220\350\261\252/\347\254\254\345\233\233\345\244\251\347\254\224\350\256\260.md" +++ /dev/null @@ -1,11 +0,0 @@ - - -# Power Designer: - -第一步:创建概念模型(类似ER图)CDM - -第二步:转换成逻辑模型 LDM - -第三步:转换成物理模型 PDM - -第四步:生成 DDL \ No newline at end of file diff --git "a/56 \350\265\265\346\225\217/20230905 \346\225\260\346\215\256\345\272\223.md" "b/56 \350\265\265\346\225\217/20230905 \346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index f52ee2e7f2c0c61fbc5616015f501e36578de3ee..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/20230905 \346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,54 +0,0 @@ -``` -1.MySQL高级课程 - -2.InnoDB储存引擎 - -3.Spring 是最流行的企业Java应用程序开发框架,易于快速开发健壮的Java应用程序,提供全面的基础架构支持。易于测试和可重用的代码。【特点:最流行,开源,轻量级(Spring框架基本版仅约2MB)】 - -4.SpringCloud 是一组即用型组件,可用于企业中构建分布式应用程序,主要用于为分布式环境中观察到的问题(如负载平衡,服务发现,断路等)提供即用型解决方案,易于集成到现有的Spring项目中。 - -5.Spring Boot Java开源框架,用于创建微服务,轻松创建独立且可用于生产的Spring应用程序。包含用于开发为服务的全面基础支持,能够开发出可以直接运行的企业级应用程序。 - -6.Spring MVC 开源Java平台,易于快速开发健壮的基于Java的web应用程序提供全面的基础框架支持。 - -7.MoNgoDB 基于分布式文件存储数据库,旨在为web应用提供可扩展的高性能数据存储解决方案【介于关系型数据库和非关系型数据库之间】 - -8.JavaScript(JS)具有函数优先的轻量级,作为web页面的脚本语言而出名,V8引擎出世后,也被用于非浏览器环境中,JavaScript程序在V8引擎下运行速度媲美二进制程序。 - -9.redis 在Java web中的应用:①存储缓存用的数据 - -​ ②需要高速读写的场合使用它快速读写 - -10.mybatis 优秀的持久层框架,支持自定义SQL,存储及高级映射 - -11.MVC(model view controller 模型视图控制器) - -12.SSM (Spring、SpringMVC、MyBatis) - -13.maven 服务于Java平台的自动化构建工具 - -14.Node.js 基于chrome JavaScript运行时建立的平台,Node.js是服务端的js,后端可部署一些高性能的服务。 - -15.vue.js 基于HTML,css,js构建,帮助开发者开发复杂的单页面应用 - -16.webAPi 网页应用接口:存储服务、消息服务、计算服务、信息服务、web2.0服务 - -17.Nginx 高效能的HTTP和反向代理的web服务器 - -18.中间件、签 中间件——分布式环境下支撑应用开发和集成的平台 - -​ 数据传输、数据访问、应用调度、系统构建、系统集成、远程管理 - -19.小程序 - -20.Linux服务器的部署 - -21.技术栈和技能树的关系: - -技术栈:一个项目多个方案中所需求的那个方案所需技术 - -技能树:个人本身所掌握的技术。 - -技能树>技术栈 -``` - diff --git "a/56 \350\265\265\346\225\217/20230905\347\254\224\350\256\260.md" "b/56 \350\265\265\346\225\217/20230905\347\254\224\350\256\260.md" deleted file mode 100644 index f4fdf3a2357f531a62a4829ba1b97107615e8d2a..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/20230905\347\254\224\350\256\260.md" +++ /dev/null @@ -1,13 +0,0 @@ -## mysql第二课的笔记 - -建表:多对多的时候,引用第三张表,将前面两张表的主键拿来当第三张表的外键、 - -​ 一对多的时候,将一所在的表的主键放在多的表当外键 - -​ 一对一的时候,将一张表的主键放在另一张表当外键 - -## ER图 - -概念:实体关系图, 是指以实体,关系,属性三个基本概念概括数据的基本结构,从而描述静态数据结构的概念格式 - -要素:实体(表),属性(字段),和关系(类似外键) \ No newline at end of file diff --git "a/56 \350\265\265\346\225\217/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" "b/56 \350\265\265\346\225\217/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" deleted file mode 100644 index f446b4fb3637886a6bc96a9361b943d8730970bc..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" +++ /dev/null @@ -1,88 +0,0 @@ -# 笔记 - - ### - - - -​ 表与表之间的关系有三种 - -​ 1.一对一的关系:任意一张表的主键,放到另一张表当外键。 - -​ 2.一对多的关系:将一所在的表的主键,放到多的表当外键。 - -​ 3.多对多的关系:必须引入第三张表,做为中转,将前面两个表的主键放进来当做外键。 - -​ 数据库的设计方式: - -​ 1.直观设计法 2.规范设计法 3.计算机辅助设计法 - -#### E-R图概念 - -​ 1.三要素 - -​ 1.实体(表) - -​ 2.属性(字段) - -​ 3关系(类似外键与主键的关系) - - - -# 作业 - -```mysql -create DATABASE school charset utf8; -use school ; -CREATE table yx( -yx_id int primary key auto_increment, -yx_name varchar(10) -); - -create table zy( -zy_id int primary key auto_increment, -zy_name varchar(10), -yx_id int , -FOREIGN KEY (yx_id) REFERENCES yx(yx_id) -); - - -create table bj( - bj_id int primary key auto_increment, - bj_name varchar(10), - zy_id int, - FOREIGN key (zy_id) REFERENCES zy(zy_id) -); - -create table student( - stu_id int primary key auto_increment, - stu_name varchar(10), - sex varchar(2), - bj_id int, - FOREIGN key (bj_id) REFERENCES bj(bj_id) -); - -create table xk( - xk_id int primary key auto_increment, - xk_name varchar(10), - xk_sum int , - stu_id int, - FOREIGN key (stu_id) REFERENCES student(stu_id) -); - - -create table teachar( - t_id int primary key auto_increment, - t_name varchar(10), - xk_id int, - FOREIGN key (xk_id) REFERENCES xk(xk_id) -); - - - - - - - - -``` - diff --git "a/56 \350\265\265\346\225\217/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" "b/56 \350\265\265\346\225\217/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" deleted file mode 100644 index 9c79d93a7a1b011289a78dc64d87857f57b967dd..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" +++ /dev/null @@ -1,93 +0,0 @@ -笔记 - -``` - 数据库第一范式:要求字段的内容,不可在分割,为的是保证数据的原子性。 - -​ 数据库第二范式:要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键,要依赖整个联合主键)而不能只能依赖部分。 - -​ 数据库第三范式:满足第二范式的前提上,要求,非主键属性要直接依赖于主键。 -``` - -作业 - -```mysql -#创建数据库 -create DATABASE school char set utf8; -#使用数据库 -use school; -#创建院系表 -create table yx ( -yx_id int PRIMARY key auto_increment, -yx_name char(10), -yx_address VARCHAR(255) -); -#创建专业表 -create table zy( -zy_id int PRIMARY key auto_increment, -zy_name char(10), -yx_id int, -FOREIGN key (yx_id) REFERENCES yx(yx_id) -); -#创建班级表 -create table bj( -bj_id int PRIMARY key auto_increment, -bj_name char(10), -zy_id int, -FOREIGN key (zy_id) REFERENCES zy(zy_id) -); -#创建学生表 -CREATE table student ( -st_id int PRIMARY key auto_increment, -st_name char(10), -st_address varchar(255) -); -#创建课程表 -create table kc ( -kc_id int PRIMARY key auto_increment, -kc_name char(10) -); -#创建学生和课程的中间表 -create table ks( -ks_id int PRIMARY key auto_increment, -st_id int, -kc_id int, -FOREIGN key (st_id) REFERENCES student (st_id), -FOREIGN key (kc_id) REFERENCES kc(kc_id) -); -#创建教师表 -create table teacher( -te_id int PRIMARY key auto_increment, -te_name char(10), -te_adress varchar(255) -); -#创建课程表 -create table kcb ( -kcb_id int PRIMARY key auto_increment , -kcb_name char(10), -kcb_address varchar(255), -te_id int, -FOREIGN key (te_id) REFERENCES teacher(te_id) -); -#创建教室表 -create table clazz( -cl_id int primary key auto_increment, -cl_name char(10), -cl_address varchar(255), -kcb_id int, -FOREIGN key (kcb_id) REFERENCES kcb(kcb_id) -); - - - - - - - - - - - - - -``` - diff --git "a/56 \350\265\265\346\225\217/20230910 \345\233\276\344\271\246\351\246\206/20230910 \345\233\276\344\271\246\351\246\206.md" "b/56 \350\265\265\346\225\217/20230910 \345\233\276\344\271\246\351\246\206/20230910 \345\233\276\344\271\246\351\246\206.md" deleted file mode 100644 index de4344c7006c0eb0509d5527bc7b0d302dddd95b..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/20230910 \345\233\276\344\271\246\351\246\206/20230910 \345\233\276\344\271\246\351\246\206.md" +++ /dev/null @@ -1,180 +0,0 @@ -笔记 - -``` -1 创建改建模型 cdm 以用户的角度 -2 转成逻辑模式 ldm 计算机角度 -3 转成物理模型 pdm 数据库角度 -4 生成ddl -``` - -作业 - -```MySQL - -/*==============================================================*/ -/* DBMS name: Sybase SQL Anywhere 12 */ -/* Created on: 2023-09-09 20:38:17 */ -/*==============================================================*/ - - --- if exists(select 1 from sys.sysforeignkey where role='FK_RELATION_RELATIONS_BOOK') then --- alter table Relationship_3 --- delete foreign key FK_RELATION_RELATIONS_BOOK --- end if; --- --- if exists(select 1 from sys.sysforeignkey where role='FK_RELATION_RELATIONS_USER') then --- alter table Relationship_3 --- delete foreign key FK_RELATION_RELATIONS_USER --- end if; --- --- if exists(select 1 from sys.sysforeignkey where role='FK_BOOK_RELATIONS_AUTHOR') then --- alter table book --- delete foreign key FK_BOOK_RELATIONS_AUTHOR --- end if; - -drop index if exists Relationship_3.Relationship_3_FK; - -drop index if exists Relationship_3.Relationship_4_FK; - -drop index if exists Relationship_3.Relationship_3_PK; - -drop table if exists Relationship_3; - -drop index if exists author.author_PK; - -drop table if exists author; - -drop index if exists book.Relationship_2_FK; - -drop index if exists book.book_PK; - -drop table if exists book; - -drop index if exists "user".user_PK; - -drop table if exists "user"; -create DATABASE z charset utf8; -use z; - -/*==============================================================*/ -/* Table: Relationship_3 */ -/*==============================================================*/ -create table Relationship_3 -( - bo_id integer not null, - us_id integer not null, - bor_time datetime not null, - bor_id integer not null, - repay datetime not null, - fact datetime not null, - constraint PK_RELATIONSHIP_3 primary key (bo_id, us_id) -); - -/*==============================================================*/ -/* Index: Relationship_3_PK */ -/*==============================================================*/ -create unique index Relationship_3_PK on Relationship_3 ( -bo_id ASC, -us_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_4_FK */ -/*==============================================================*/ -create index Relationship_4_FK on Relationship_3 ( -us_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_3_FK */ -/*==============================================================*/ -create index Relationship_3_FK on Relationship_3 ( -bo_id ASC -); - -/*==============================================================*/ -/* Table: author */ -/*==============================================================*/ -create table author -( - au_id integer not null, - au_name varchar(10) not null, - constraint PK_AUTHOR primary key (au_id) -); - -/*==============================================================*/ -/* Index: author_PK */ -/*==============================================================*/ -create unique index author_PK on author ( -au_id ASC -); - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - bo_id integer not null, - au_id integer not null, - bo_name varchar(50) not null, - bo_price float not null, - bo_press varchar(20) not null, - - constraint PK_BOOK primary key (bo_id) -); - -/*==============================================================*/ -/* Index: book_PK */ -/*==============================================================*/ -create unique index book_PK on book ( -bo_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_2_FK */ -/*==============================================================*/ -create index Relationship_2_FK on book ( -au_id ASC -); - -/*==============================================================*/ -/* Table: "user" */ -/*==============================================================*/ -create table `user` -( - us_id integer not null, - us_name varchar(10) not null, - us_bj varchar(10) not null, - us_gender char(2) null, - constraint PK_USER primary key (us_id) -); - -/*==============================================================*/ -/* Index: user_PK */ -/*==============================================================*/ -create unique index user_PK on "user" ( -us_id ASC -); - -alter table Relationship_3 - add constraint FK_RELATION_RELATIONS_BOOK foreign key (bo_id) - references book (bo_id) - on update restrict - on delete restrict; - -alter table Relationship_3 - add constraint FK_RELATION_RELATIONS_USER foreign key (us_id) - references `user` (us_id) - on update restrict - on delete restrict; - -alter table book - add constraint FK_BOOK_RELATIONS_AUTHOR foreign key (au_id) - references author (au_id) - on update restrict - on delete restrict; - - - -``` - diff --git "a/56 \350\265\265\346\225\217/20230910 \345\233\276\344\271\246\351\246\206/ConceptualDataModel_2.ldm" "b/56 \350\265\265\346\225\217/20230910 \345\233\276\344\271\246\351\246\206/ConceptualDataModel_2.ldm" deleted file mode 100644 index 1d3a3fcb225966e53039c8d643e1f0857d3c1458..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/20230910 \345\233\276\344\271\246\351\246\206/ConceptualDataModel_2.ldm" +++ /dev/null @@ -1,2265 +0,0 @@ - - - - - - - - - -D317A94E-F940-4682-9598-F2CEEC683DB3 -ConceptualDataModel_2 -ConceptualDataModel_2 -1694176218 -Administrator -1694176632 -Administrator -ORG {22D0FD72-C789-4115-8694-AF0D1D05934B} -DAT 1694176225 -ATT MOPT -DLD {A8D7A9DB-47E8-479E-9A21-A1352C788668} -DLD {013C6BCD-6815-4153-B320-20E47EAE0D9D} -DLD {03ADA42C-E8B1-4F45-8185-3F84D3CFEF94} -DLD {78CFF787-E351-4F61-B098-1AE4A70C4553} -DLD {CC4E7E43-E647-4746-B2C6-F73BD83BA074} -DLD {A64BCEC8-F331-4AF0-B49C-E4ECDDD6B720} -DLD {934C007A-1F82-4A87-AF0E-C8B772C3E1C2} -DLD {0BE22D0D-CF79-43D1-8E90-6CE6E7AF4C5A} -ATT FOPT -[FolderOptions] - -[FolderOptions\Common] -GenerationCheckModel=Yes -GenerationPath= -GenerationOptions= -GenerationTasks= -GenerationTargets= -GenerationSelections= - -[FolderOptions\CheckModel] - -[FolderOptions\CheckModel\Package] - -[FolderOptions\CheckModel\Package\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\CheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\DefaultCheckPackageMissTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\GenrCircularityYes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\GenrCircularityNo] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Package\ShortcutUniqCode] -CheckSeverity=Yes -FixRequested=No -CheckRequested=No - -[FolderOptions\CheckModel\Package\ChildShortcut] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain] - -[FolderOptions\CheckModel\Domain\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckOtherDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Domain\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity] - -[FolderOptions\CheckModel\Entity\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\MaxLen - NAME] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\MaxLen - CODE] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EmptyColl - PENTCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttNbSerials] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EmptyColl - IDTFCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EmptyCollYesYes] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttSamePrnt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttMultInhr] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\EnttSevInhr] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity\PidtfInhrAtt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute] - -[FolderOptions\CheckModel\Entity.Entity Attribute\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\AttrDiffDomn] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckNumParam] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckPrecSupLng] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckUndefDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckOtherDttp] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Entity Attribute\CheckDttpIncompatibleFormat] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier] - -[FolderOptions\CheckModel\Entity.Identifier\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\EmptyColl - PENTCOL] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\CheckIncludeColl - Entt] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Entity.Identifier\IdtfChildPIdtf] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship] - -[FolderOptions\CheckModel\Relationship\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshReflexiveDeptYes] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshReflexiveDeptNo] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshBject] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Relationship\RlshMany] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance] - -[FolderOptions\CheckModel\Inheritance\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\EmptyColl - CHILDCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Inheritance\InhrComplete] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Replication] - -[FolderOptions\CheckModel\Replication\PartialReplication] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule] - -[FolderOptions\CheckModel\Business Rule\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Business Rule\EmptyColl - OBJCOL] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object] - -[FolderOptions\CheckModel\Extended Object\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Object\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link] - -[FolderOptions\CheckModel\Extended Link\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Extended Link\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File] - -[FolderOptions\CheckModel\File\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\File\CheckPathExists] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format] - -[FolderOptions\CheckModel\Data Format\CheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseOnlyTerms] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\DefaultCheckUseTermBySynonym] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\NotApprovedTerms] -CheckSeverity=Yes -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueName] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\UniqueCode] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes - -[FolderOptions\CheckModel\Data Format\CheckDataFormatNullExpression] -CheckSeverity=No -FixRequested=No -CheckRequested=Yes -[ModelOptions] - -[ModelOptions\Logical options] -CaseSensitive=No -DisplayName=Yes -EnableTrans=No -UseTerm=No -EnableRequirements=No -EnableFullShortcut=Yes -Notation=0 -RlshUnique=Yes -DefaultDttp= -DomnCopyDttp=Yes -DomnCopyChck=No -DomnCopyRule=No -DomnCopyExat=No -DomnCopyMand=No -DttpFullName=Yes -RlshMigrateDomain=Yes -RlshMigrateCheck=Yes -RlshMigrateRule=Yes -RlshMigrateExtd=Yes -RlshAllowNN=No -RlshGenNN=No -FKNameTemplate=%.3:PARENT%_%ATTRIBUTE% -FKNameTemplateUsage=No -RlshAsstTmpl=Each %Entity1.Name%[CRLF].if %Entity1ToEntity2RoleMandatory%[CRLF] must[CRLF].else[CRLF] may[CRLF].endif[CRLF].if %Entity1ToEntity2Role%[CRLF] %.L:Entity1ToEntity2Role%[CRLF].else[CRLF] have[CRLF].endif[CRLF].if %Entity1ToEntity2RoleMaximumCardinality%==1[CRLF].if %Entity1ToEntity2RoleMandatory%[CRLF] one and only one[CRLF].else[CRLF] at most one[CRLF].endif[CRLF].else[CRLF] one or more[CRLF].endif[CRLF].if %Entity1%==%Entity2%[CRLF] other[CRLF].endif[CRLF] %Entity2.Name%.[CRLF]Each %Entity2.Name%[CRLF].if %Entity2ToEntity1RoleMandatory%[CRLF] must[CRLF].else[CRLF] may[CRLF].endif[CRLF].if %Entity2ToEntity1Role%[CRLF] %.L:Entity2ToEntity1Role%[CRLF].else[CRLF] have[CRLF].endif[CRLF].if %Entity2ToEntity1RoleMaximumCardinality%==1[CRLF].if %Entity2ToEntity1RoleMandatory%[CRLF] one and only one[CRLF].else[CRLF] at most one[CRLF].endif[CRLF].else[CRLF] one or more[CRLF].endif[CRLF].if %Entity1%==%Entity2%[CRLF] other[CRLF].endif[CRLF] %Entity1.Name%. -RlshAsstExt= - -[ModelOptions\Logical options\NamingOptionsTemplates] - -[ModelOptions\Logical options\ClssNamingOptions] - -[ModelOptions\Logical options\ClssNamingOptions\FILO] - -[ModelOptions\Logical options\ClssNamingOptions\FILO\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FILO\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FRMEOBJ] - -[ModelOptions\Logical options\ClssNamingOptions\FRMEOBJ\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FRMEOBJ\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FRMELNK] - -[ModelOptions\Logical options\ClssNamingOptions\FRMELNK\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\FRMELNK\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\DefaultClass] - -[ModelOptions\Logical options\ClssNamingOptions\DefaultClass\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\DefaultClass\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMPCKG] - -[ModelOptions\Logical options\ClssNamingOptions\LDMPCKG\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMPCKG\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMDOMN] - -[ModelOptions\Logical options\ClssNamingOptions\LDMDOMN\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMDOMN\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMENTT] - -[ModelOptions\Logical options\ClssNamingOptions\LDMENTT\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMENTT\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMPROP] - -[ModelOptions\Logical options\ClssNamingOptions\LDMPROP\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMPROP\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMIDTF] - -[ModelOptions\Logical options\ClssNamingOptions\LDMIDTF\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMIDTF\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMRLSH] - -[ModelOptions\Logical options\ClssNamingOptions\LDMRLSH\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMRLSH\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMINHR] - -[ModelOptions\Logical options\ClssNamingOptions\LDMINHR\Name] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Logical options\ClssNamingOptions\LDMINHR\Code] -Template= -MaxLen=254 -Case=M -ValidChar= -InvldChar= -AllValid=Yes -NoAccent=No -DefaultChar= -Script= -ConvTable= -ConvTablePath=%_HOME%\Resource Files\Conversion Tables - -[ModelOptions\Generate] - -[ModelOptions\Generate\Cdm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No - -[ModelOptions\Generate\Pdm] -CheckModel=Yes -SaveLinks=Yes -NameToCode=No -BuildTrgr=No -TablePrefix= -IndxPKName=%TABLE%_PK -IndxAKName=%TABLE%_AK -IndxFKName=%REFR%_FK -IndxThreshold= -PreserveMode=Yes - - -EC58841B-AB6C-4A0F-B1C0-D871762A7789 -ConceptualDataModel_2 -ConceptualDataModel_2 -1694176632 -Administrator -1694176632 -Administrator - -0D8DA866-BD5A-489B-9297-3A0206983EBB -CDE44E21-9669-11D1-9914-006097355D9B - - - - -FFC9273F-AF16-48A1-996B-4C35619AF7AE -ConceptualDataModel_1 -ConceptualDataModel_1 -1694176226 -Administrator -1694176226 -Administrator - -22D0FD72-C789-4115-8694-AF0D1D05934B -1E597170-9350-11D1-AB3C-0020AF71E433 - - - - -84D5F1C1-7A84-4021-B4D0-3A8009192641 -Diagram_1 -Diagram_1 -1694176225 -Administrator -1694176605 -Administrator -ORG {4CA67BEE-3BE0-4E93-8EF0-458F6A190C63} -DAT 1694176225 -[DisplayPreferences] - -[DisplayPreferences\LDM] - -[DisplayPreferences\General] -Adjust to text=Yes -Snap Grid=No -Constrain Labels=Yes -Display Grid=No -Show Page Delimiter=Yes -Show Links intersections=Yes -Activate automatic link routing=Yes -Grid size=0 -Graphic unit=2 -Window color=255, 255, 255 -Background image= -Background mode=8 -Watermark image= -Watermark mode=8 -Show watermark on screen=No -Gradient mode=0 -Gradient end color=255, 255, 255 -Show Swimlane=No -SwimlaneVert=Yes -TreeVert=No -CompDark=0 - -[DisplayPreferences\Object] -Show Icon=No -Mode=2 -Trunc Length=40 -Word Length=40 -Word Text=!"#$%&')*+,-./:;=>?@\]^_`|}~ -Shortcut IntIcon=Yes -Shortcut IntLoct=Yes -Shortcut IntFullPath=No -Shortcut IntLastPackage=Yes -Shortcut ExtIcon=Yes -Shortcut ExtLoct=No -Shortcut ExtFullPath=No -Shortcut ExtLastPackage=Yes -Shortcut ExtIncludeModl=Yes -EObjShowStrn=Yes -ExtendedObject.Comment=No -ExtendedObject.IconPicture=No -ExtendedObject.TextStyle=No -ExtendedObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Object Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -ELnkShowStrn=Yes -ELnkShowName=Yes -ExtendedLink_SymbolLayout=<Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Source" >[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> -FileObject.Stereotype=No -FileObject.DisplayName=Yes -FileObject.LocationOrName=No -FileObject.IconPicture=No -FileObject.TextStyle=No -FileObject.IconMode=Yes -FileObject_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <ExclusiveChoice Name="Exclusive Choice" Mandatory="Yes" Display="HorizontalRadios" >[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Location" Attribute="LocationOrName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] </ExclusiveChoice>[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Package.Stereotype=Yes -Package.Comment=No -Package.IconPicture=No -Package.TextStyle=No -Package_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Display Model Version=Yes -Entity.Stereotype=Yes -Entity.Attributes=Yes -Entity.Attributes._Filter="All attributes" CDMPENTALL -Entity.Attributes._Columns=Stereotype IdentifierIndicator DomainOrDataType NullIndicator -Entity.Attributes._Limit=-5 -Entity.Identifiers=Yes -Entity.Identifiers._Columns=Stereotype IdentifierIndicator -Entity.Comment=No -Entity.IconPicture=No -Entity.TextStyle=No -Entity_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" Filters="&quot;All attributes&quot; CDMPENTALL &quot;&quot;\r\n&quot;Primary attributes&quot; CDMPENTPK &quot;\&quot;PIDTF \&quot;TRUE\&quot; TRUE\&quot;&quot;\r\n&quot;Identifying attributes&quot; CDMPENTIDTF &quot;\&quot;AIDF \&quot;TRUE\&quot; TRUE\&quot;&quot;" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Identifiers" Collection="Identifiers" Columns="Stereotype No\r\nDisplayName Yes\r\nIdentifierIndicator No &quot;Identifier indicators&quot;" HasLimit="No" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Relationship.Entity1ToEntity2Role=Yes -Relationship.Entity2ToEntity1RoleCardinality=No -Relationship.Entity1ToEntity2RoleDominant=Yes -Relationship.Stereotype=Yes -Relationship.DisplayName=Yes -Relationship.JoinExpression=No -Relationship.Entity2ToEntity1Role=Yes -Relationship.Entity1ToEntity2RoleCardinality=No -Relationship.Entity2ToEntity1RoleDominant=Yes -Relationship_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity1ToEntity2Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity2ToEntity1RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity1ToEntity2RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] <StandardAttribute Name="Role" Attribute="Entity2ToEntity1Role" Prefix="" Suffix="" Caption="Role" Mandatory="No" />[CRLF] <StandardAttribute Name="Cardinality" Attribute="Entity1ToEntity2RoleCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] <StandardAttribute Name="Dominance" Attribute="Entity2ToEntity1RoleDominant" Prefix="" Suffix="" Caption="Dominance" Mandatory="No" />[CRLF] </Form>[CRLF]</Form> -Inheritance.Stereotype=Yes -Inheritance.DisplayName=Yes -Inheritance.IconPicture=No -Inheritance.TextStyle=No -Inheritance_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -Association.Stereotype=Yes -Association.Comment=No -Association.Attributes=Yes -Association.Attributes._Columns=Stereotype DataType NullIndicator -Association.Attributes._Limit=-5 -Association.IconPicture=No -Association.TextStyle=No -Association_SymbolLayout=<Form>[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Alignment="CNTR" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Name" Attribute="DisplayName" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <Separator Name="Separator" />[CRLF] <StandardAttribute Name="Comment" Attribute="Comment" Prefix="" Suffix="" Alignment="LEFT" Caption="" Mandatory="No" />[CRLF] <StandardCollection Name="Attributes" Collection="Attributes" Columns="Stereotype No\r\nDisplayName Yes\r\nDataType No\r\nDomainOrDataType No &quot;Domain or Data type&quot;\r\nDomain No\r\nNullIndicator No Mandatory" HasLimit="Yes" HideEmpty="No" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Icon" Attribute="IconPicture" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF] <StandardAttribute Name="Force top align" Attribute="TextStyle" Prefix="" Suffix="" Alignment="CNTR" Caption="" Mandatory="Yes" />[CRLF]</Form> -AssociationLink.SymbolCardinality=Yes -AssociationLink.Stereotype=Yes -AssociationLink.Role=Yes -AssociationLink_SymbolLayout=<Form>[CRLF] <Form Name="Source" >[CRLF] <StandardAttribute Name="Cardinality" Attribute="SymbolCardinality" Prefix="" Suffix="" Caption="Cardinality" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Center" >[CRLF] <StandardAttribute Name="Stereotype" Attribute="Stereotype" Prefix="&lt;&lt;" Suffix="&gt;&gt;" Caption="" Mandatory="No" />[CRLF] <StandardAttribute Name="Role" Attribute="Role" Prefix="" Suffix="" Caption="" Mandatory="No" />[CRLF] </Form>[CRLF] <Form Name="Destination" >[CRLF] </Form>[CRLF]</Form> - -[DisplayPreferences\Symbol] - -[DisplayPreferences\Symbol\FRMEOBJ] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=6000 -Height=2000 -Brush color=255 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=64 -Brush gradient color=192 192 192 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 255 128 128 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FRMELNK] -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\FILO] -OBJSTRNFont=新宋体,8,N -OBJSTRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LCNMFont=新宋体,8,N -LCNMFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3600 -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMENTT] -STRNFont=新宋体,8,N -STRNFont color=0 0 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0 0 0 -AttributesFont=新宋体,8,N -AttributesFont color=0 0 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0, 0, 0 -EntityForeignAttributeFont=新宋体,8,N -EntityForeignAttributeFont color=0, 0, 0 -IdentifiersFont=新宋体,8,N -IdentifiersFont color=0 0 0 -LABLFont=新宋体,8,N -LABLFont color=0 0 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=176 186 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 88 74 181 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMRLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 88 74 181 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=Yes -Width=1600 -Height=1000 -Brush color=176 186 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LDMLINH] -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\USRDEPD] -OBJXSTRFont=新宋体,8,N -OBJXSTRFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=2 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\Free Symbol] -Free TextFont=新宋体,8,N -Free TextFont color=0, 0, 0 -Line style=0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 0 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMPCKG] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=255 255 192 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 178 178 178 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ENTT] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -AttributesFont=新宋体,8,N -AttributesFont color=0, 0, 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0, 0, 0 -IdentifiersFont=新宋体,8,N -IdentifiersFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=4000 -Brush color=176 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 170 170 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\RLSH] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -DESTINATIONFont=新宋体,8,N -DESTINATIONFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 0 170 170 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\ASSC] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -LABLFont=新宋体,8,N -LABLFont color=0, 0, 0 -AttributesFont=新宋体,8,N -AttributesFont color=0, 0, 0 -EntityPrimaryAttributeFont=新宋体,8,U -EntityPrimaryAttributeFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Width=4800 -Height=3000 -Brush color=208 208 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINK] -SOURCEFont=新宋体,8,N -SOURCEFont color=0, 0, 0 -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\CDMINHR] -STRNFont=新宋体,8,N -STRNFont color=0, 0, 0 -DISPNAMEFont=新宋体,8,N -DISPNAMEFont color=0, 0, 0 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=Yes -Width=1600 -Height=1000 -Brush color=176 255 255 -Fill Color=Yes -Brush style=6 -Brush bitmap mode=12 -Brush gradient mode=65 -Brush gradient color=255 255 255 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\Symbol\LINH] -CENTERFont=新宋体,8,N -CENTERFont color=0, 0, 0 -Line style=1 -AutoAdjustToText=Yes -Keep aspect=No -Keep center=No -Keep size=No -Brush color=255 255 255 -Fill Color=Yes -Brush style=1 -Brush bitmap mode=12 -Brush gradient mode=0 -Brush gradient color=118 118 118 -Brush background image= -Custom shape= -Custom text mode=0 -Pen=1 0 128 128 255 -Shadow color=192 192 192 -Shadow=0 - -[DisplayPreferences\CDM] -(8500, 11000) -((315,354), (433,354)) --29257 --29257 - - -((17215,-2428), (23064,6200)) -((20139,5213),(20139,-2028)) -1 -5138 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((-15294,4913), (-2937,6713)) -((-14473,5813),(-3337,5813)) -1 -4632 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -((-3568,5018), (8521,6818)) -((-3168,5918),(7798,5918)) -1 -6162 -11184640 -12632256 -CENTER 0 新宋体,8,N -SOURCE 0 新宋体,8,N -DESTINATION 0 新宋体,8,N - - - - - - - - - - - -1694176632 --1 -((11475,-6226), (28803,-2028)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694176632 --1 -((-31801,1425), (-14473,7273)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694176632 --1 -((7605,4800), (25319,12298)) -11184640 -16777136 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - -1694176632 --1 -((-10265,2064), (3588,9562)) -11184640 -16759472 -12632256 -STRN 0 新宋体,8,N -DISPNAME 0 新宋体,8,N -Attributes 0 新宋体,8,N -EntityPrimaryAttribute 0 新宋体,8,U -EntityForeignAttribute 0 新宋体,8,N -Identifiers 0 新宋体,8,N -LABL 0 新宋体,8,N -6 -65 -16777215 - - - - - - - - - - - - -1599D880-90CA-4417-8E3C-C91AF7E89256 -作者 -author -1694176225 -Administrator -1694176225 -Administrator -ORG {3A6F285B-2DF9-4531-817F-55D134BCA6CE} -DAT 1694176225 - - -07FAC81E-D193-4AFD-A515-2052EBA70910 -Identifier_1 -Identifier_1 -1694176225 -Administrator -1694176225 -Administrator -ORG {189D135F-CBD6-482B-AD64-59A75D775772} -DAT 1694176225 - - - - - - - - - - -B8116BE0-A06D-4930-A97E-E19EB72B135A -作者编号 -au_id -1694176225 -Administrator -1694176225 -Administrator -ORG {8E0ACD66-5AD3-4492-8843-B6A2FC446162} -DAT 1694176225 -I -1 - - -D03B96B2-B527-4C58-A2C1-F7610488EFF7 -作者名称 -au_name -1694176225 -Administrator -1694176225 -Administrator -ORG {C146E24B-35ED-4D7C-BB6C-967E88D8F9E0} -DAT 1694176225 -VA10 -10 -1 - - - - -7C512278-0714-414E-AC19-25CEDF74FD60 -用户 -user -1694176225 -Administrator -1694176225 -Administrator -ORG {B05B3FA1-B2F9-4A3E-820F-3B76BAAD9FFA} -DAT 1694176225 - - -CC815D4C-66F0-4927-B98B-3E119833ACC3 -Identifier_1 -Identifier_1 -1694176225 -Administrator -1694176225 -Administrator -ORG {6840F484-DF6D-47AF-B154-27871BCDAB67} -DAT 1694176225 - - - - - - - - - - -78B87358-127D-4E95-80EB-8AEAF4F3F211 -用户编号 -us_id -1694176225 -Administrator -1694176225 -Administrator -ORG {5CC94E98-1F15-49D1-A832-9DEFFF2A122A} -DAT 1694176225 -I -1 - - -AAF61206-FBB8-45F8-8C87-6DC26101A4D0 -用户姓名 -us_name -1694176225 -Administrator -1694176225 -Administrator -ORG {CEA151C5-8C87-4A46-87E7-24479A79B428} -DAT 1694176225 -VA10 -10 -1 - - -382B135A-4F67-462B-B033-AEC8920D8560 -用户班级 -us_bj -1694176225 -Administrator -1694176225 -Administrator -ORG {24DC2086-BF59-4EEB-9DF3-CED8406F3A11} -DAT 1694176225 -VA10 -10 -1 - - -5016E201-BACD-4D31-A440-D9B9E31E88B9 -用户性别 -us_gender -1694176225 -Administrator -1694176225 -Administrator -ORG {FBB0ED54-5CDB-4F4D-8F6B-EFC263902B76} -DAT 1694176225 -A2 -2 - - - - -E8D6A36A-ACB5-4D63-A0B1-FD5DE7257984 -图书 -book -1694176225 -Administrator -1694176225 -Administrator -ORG {B8122D21-56DA-4998-942B-6E5A082217E0} -DAT 1694176225 - - -2A250752-C94F-4AD9-A519-25A637D6BC4D -Identifier_1 -Identifier_1 -1694176225 -Administrator -1694176225 -Administrator -ORG {2DAB6B2F-E933-4452-99D1-38DC657DA3FC} -DAT 1694176225 - - - - - - - - - - -A480BB37-4995-469E-B932-55D6B4EB7A61 -图书编号 -bo_id -1694176225 -Administrator -1694176225 -Administrator -ORG {73657BAA-3FB8-4FD1-A6C0-07D75FDE2172} -DAT 1694176225 -I -1 - - -A5490689-B72C-4351-986C-05C7BF3B632F -作者编号2 -au_id -1694176225 -Administrator -1694176225 -Administrator -ORG {8E0ACD66-5AD3-4492-8843-B6A2FC446162},{8A14DCAF-4460-4B3B-8DEC-2AC779222558} -DAT 1694176225 -I -1 - - -F506A435-E1CE-47F9-A4AF-F0910D051D7B -图书名 -bo_name -1694176225 -Administrator -1694176225 -Administrator -ORG {3CEACAF0-DA34-4858-B90B-54DC2880D8F5} -DAT 1694176225 -VA50 -50 -1 - - -7F810369-833F-4389-9744-BDF456010118 -图书价格 -bo_price -1694176225 -Administrator -1694176225 -Administrator -ORG {3CFFEABF-AA32-4719-BBED-A589C83D07A9} -DAT 1694176225 -F -1 - - -58596796-B2B1-49E9-BCFA-92646D8D71BC -出版社 -bo_press -1694176225 -Administrator -1694176225 -Administrator -ORG {33D625E7-7E91-4202-82B9-E6DB1F051664} -DAT 1694176225 -VA20 -20 -1 - - -E5AD8C65-23FD-4C3A-BD04-C553CB2ECBEA -作者编号 -au_id. -1694176225 -Administrator -1694176225 -Administrator -ORG {C7086670-9B99-4C35-AE38-48410F61ED40} -DAT 1694176225 -I -1 - - - - -FCF6AF5C-0806-4012-A8AA-B0FBA08E58E9 -Relationship_3 -Relationship_3 -0 - -1694176576 -Administrator -ORG {F4CF9BE6-3086-4E9E-98C1-8BDB41F657D9} -DAT 1694176225 - - -66ACA092-CCD2-412D-AEDC-37BD874E4ED2 -Identifier_1 -Identifier_1 -1694176225 -Administrator -1694176225 -Administrator - - - - - - - - - - - -8B9E21EF-75E7-4A0C-A86F-CE405A6F6A3A -图书编号 -bo_id -1694176225 -Administrator -1694176225 -Administrator -ORG {73657BAA-3FB8-4FD1-A6C0-07D75FDE2172},{F4CF9BE6-3086-4E9E-98C1-8BDB41F657D9} -DAT 1694176225 -I -1 - - -DA2AE28C-C270-4FA4-A9D6-98EFE263FEFD -用户编号 -us_id -1694176225 -Administrator -1694176225 -Administrator -ORG {5CC94E98-1F15-49D1-A832-9DEFFF2A122A},{F4CF9BE6-3086-4E9E-98C1-8BDB41F657D9} -DAT 1694176225 -I -1 - - -BA929B82-3A2F-4AC6-8843-3B0001EC3B69 -借阅时间 -bor_time -1694176233 -Administrator -1694176576 -Administrator -DT -1 - - -710D5118-C1A5-4AE8-B8D0-68F0208BD47A -借阅编号 -bor_id -1694176233 -Administrator -1694176576 -Administrator -I -1 - - -3F95E244-EC8E-42B5-B37C-B9F2DAEE7808 -应还时间 -repay -1694176233 -Administrator -1694176576 -Administrator -DT -1 - - -B29871C4-C98A-4923-88F5-6256F040FB63 -实还时间 -fact -1694176233 -Administrator -1694176576 -Administrator -DT -1 - - - - - - -AA76F798-B93F-4250-AB94-E7D99B452474 -Relationship_2 -Relationship_2 -1694176225 -Administrator -1694176225 -Administrator -ORG {8A14DCAF-4460-4B3B-8DEC-2AC779222558} -DAT 1694176225 -1,1 -1,n - - - - - - - - -DF0ED5C4-7097-4DAA-8F05-CA66A9D80A61 -1694176225 -Administrator -1694176225 -Administrator - - - - - - - - - - - - - -E0DE5A69-410E-41D5-81DF-566F9EE5952B -Relationship_3 -Relationship_4 -0 - -0 - -ORG {F4CF9BE6-3086-4E9E-98C1-8BDB41F657D9} -DAT 1694176225 -B -1,n -1,1 - - - - - - - - -FD40BAA9-CFE2-4CA3-9401-F0E98C6B87B2 -1694176225 -Administrator -1694176225 -Administrator - - - - - - - - - - - - - -CF4591AB-4F33-479B-AAC2-D65485F05F89 -Relationship_3 -Relationship_3 -0 - -0 - -ORG {F4CF9BE6-3086-4E9E-98C1-8BDB41F657D9} -DAT 1694176225 -A -1,1 -1,n - - - - - - - - -54D0BC06-E38E-4AD5-9BCC-51B7FBE216ED -1694176225 -Administrator -1694176225 -Administrator - - - - - - - - - - - - - - - -8846D7B1-E509-4CA7-A547-7213F6ED17DC -ConceptualDataModel_1 -ConceptualDataModel_1 -1694176225 -Administrator -1694177357 -Administrator -file:///F|/照烧鸡扒饭/图书/ConceptualDataModel_1.cdm -22D0FD72-C789-4115-8694-AF0D1D05934B -1E597170-9350-11D1-AB3C-0020AF71E433 -1694177365 - - - - - -07036B3D-5C27-4EF0-9624-34A2E68D0B7C -ConceptualDataModel_2 -ConceptualDataModel_2 -1694176632 -Administrator -1694177365 -Administrator -file:///F|/照烧鸡扒饭/图书/ConceptualDataModel_2.pdm -0D8DA866-BD5A-489B-9297-3A0206983EBB -CDE44E21-9669-11D1-9914-006097355D9B -1694177366 - - - - - - - - - - \ No newline at end of file diff --git "a/56 \350\265\265\346\225\217/20230914\345\214\273\351\231\242.md" "b/56 \350\265\265\346\225\217/20230914\345\214\273\351\231\242.md" deleted file mode 100644 index d2409b94c1ab2dcad64f444729b57ea875ab4539..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/20230914\345\214\273\351\231\242.md" +++ /dev/null @@ -1,143 +0,0 @@ -作业 - -``` -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 9:47:40 */ -/*==============================================================*/ - -CREATE DATABASE z CHARSET utf8; -use z; -drop table if exists diagnose2; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists patient; - -drop table if exists pharmacy; - -drop table if exists prescription; - -drop table if exists registration; - -drop table if exists type; - -/*==============================================================*/ -/* Table: diagnose2 */ -/*==============================================================*/ -create table diagnose2 -( - patient_id int not null, - doctor_id int not null, - illness varchar(255) not null, - primary key (patient_id, doctor_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - type_id int, - doctor_name varchar(10) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - drug_name varchar(20) not null, - drug_intro varchar(200) not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(5) not null, - patient_sex char(1) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: pharmacy */ -/*==============================================================*/ -create table pharmacy -( - pharmacy int not null auto_increment, - pharmacy_name varchar(10) not null, - primary key (pharmacy) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - prescription_id int not null, - doctor_id int, - patient_id int, - drug_id int, - pharmacy int, - primary key (prescription_id) -); - -/*==============================================================*/ -/* Table: registration */ -/*==============================================================*/ -create table registration -( - reg_id char(10) not null, - doctor_id int not null, - patient_id int not null, - primary key (reg_id, doctor_id, patient_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name varchar(5) not null, - primary key (type_id) -); - -alter table diagnose2 add constraint FK_diagnose foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table diagnose2 add constraint FK_diagnose2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table doctor add constraint FK_Relationship_5 foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_Relationship_6 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_Relationship_7 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_Relationship_8 foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_Relationship_9 foreign key (pharmacy) - references pharmacy (pharmacy) on delete restrict on update restrict; - -alter table registration add constraint FK_registration foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table registration add constraint FK_registration2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -``` - diff --git "a/56 \350\265\265\346\225\217/20230917 \350\275\246.md" "b/56 \350\265\265\346\225\217/20230917 \350\275\246.md" deleted file mode 100644 index 602a177f77d1d88d1eda76b2053e06e9786da4e8..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/20230917 \350\275\246.md" +++ /dev/null @@ -1,122 +0,0 @@ -作业 - -```MySQL -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:59:53 */ -/*==============================================================*/ - - -CREATE DATABASE c CHARSET utf8; -use c; -drop table if exists car; - -drop table if exists customer; - -drop table if exists sale; - -drop table if exists sale2; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ - - -create table car -( - car_id int not null auto_increment, - car_name varchar(50) not null, - car_type varchar(20) not null, - primary key (car_id) -); -INSERT into car VALUES -(null,"五菱宏光","豪车"), -(null,"拖拉机","顶级豪车"), -(null,"叉车","越野"), -(null,"兰博基尼","小轿车"); - -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - cu_id int not null auto_increment, - cu_name varchar(50) not null, - cu_address varchar(50) not null, - cu_phone varchar(20) not null, - vip char(10) not null, - primary key (cu_id) -); -insert into customer VALUES -(null,"赵敏","汤臣一品","1236659","svip"), -(null,"赵敏大美女","地球村","1236459","vip"), -(null,"赵敏美女","浣花溪府","66956659","尊贵svip"), -(null,"赵小敏","闽西职业技术学院","6662359","普通"); - -/*==============================================================*/ -/* Table: sale */ -/*==============================================================*/ -create table sale -( - sa_id int not null auto_increment, - sa_name varchar(20) not null, - sa_phone varchar(50) not null, - primary key (sa_id) -); -insert into sale values -(null,"小花","9963"), -(null,"小红","9863"), -(null,"小明","9763"); -/*==============================================================*/ -/* Table: sale2 */ -/*==============================================================*/ -create table sale2 -( - cu_id int not null, - sa_id int not null, - se_id int not null auto_increment, - car_id int, - datatime datetime not null, - price float(8,2) not null, - primary key (se_id) -); -insert into sale2 VALUES -(1,2,null,4,"2023-12-9",99639.28), -(2,2,null,3,"2022-9-8",9699.28), -(3,1,null,2,"2021-5-20",99639.89), -(1,3,null,1,"2023-5-3",99839.28); - - - -alter table sale2 add constraint FK_Relationship_3 foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table sale2 add constraint FK_sale foreign key (cu_id) - references customer (cu_id) on delete restrict on update restrict; - -alter table sale2 add constraint FK_sale2 foreign key (sa_id) - references sale (sa_id) on delete restrict on update restrict; - - - - - - -- 1.查询特定销售员的销售记录 - select * from sale2 where se_id=2; - -- 2.查找销售记录中销售价格最高的汽车 - SELECT * from sale2 ORDER BY price desc limit 1; - -- 3.统计某个销售员的销售总额 - select s1.sa_id,SUM(price) from sale s1,sale2 s2 where s1.sa_id=s2.sa_id and s1.sa_id=2 GROUP BY s1.sa_id; - -- 4.根据客户信息查询其购买过的汽车 - select cu_name,c2.* from customer c,sale2 s,car c2 where c.cu_id=s.cu_id and s.car_id=c2.car_id and cu_name='赵敏'; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - select car_name,COUNT(car_name),SUM(price) from car c,sale2 s where c.car_id=s.car_id and c.car_id=1 GROUP BY car_name; - -- 6.检索特定日期范围内的销售了哪些汽车 - select * from car c,sale2 s where c.car_id=s.car_id and datatime<"2023-1-1"; - -- 7.查找某车型的销售历史。 - select * from car c,sale2 s where c.car_id=s.car_id and car_type='越野'; - -- 8.统计每个销售员的销售数量 - select s1.sa_id,COUNT(s1.sa_id) from sale s1,sale2 s2 where s1.sa_id=s2.sa_id group by sa_id; - -``` - diff --git "a/56 \350\265\265\346\225\217/20230919 \346\237\245\350\257\242.md" "b/56 \350\265\265\346\225\217/20230919 \346\237\245\350\257\242.md" deleted file mode 100644 index cc54f25fbbcb780a5dc0bd7116c40e00d2257914..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/20230919 \346\237\245\350\257\242.md" +++ /dev/null @@ -1,776 +0,0 @@ -作业 - -```MySQL -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -CREATE DATABASE lx charset utf8; -use lx; - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - - - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 -SELECT sum(salary*12) 基本工资 FROM employees; - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 - -SELECT (sum(salary)+sum(commission_pct*salary))*12 FROM employees; - -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct - -SELECT DISTINCT job_id FROM employees; - -# 3.查询工资大于12000的员工姓名和工资 -SELECT first_name 员工姓名,salary 工资 FROM employees where salary>12000; - - -# 4.查询员工号为176的员工的姓名和部门号 - -SELECT first_name 姓名,department_id 部门号 FROM employees where employee_id = 176; -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 - -DESC departments; - -SELECT * FROM departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -SELECT first_name 姓名,salary 工资 FROM employees where salary not BETWEEN 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -SELECT first_name 姓名,department_id 部门号 from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -SELECT first_name,job_id from employees where manager_id is null; - - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - - -SELECT first_name 员工姓名,salary 工资,j.grade_level 奖金级别 FROM employees e LEFT JOIN job_grades j on e.commission_pct*salary BETWEEN j.lowest_sal and j.highest_sal; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -SELECT * from employees WHERE first_name like '__尔'; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -SELECT * from employees WHERE last_name like '%特%' and last_name like '%尔%'; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -SELECT * FROM employees where first_name like '%尔'; -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -SELECT first_name 姓名, j.job_title 工种 FROM employees e LEFT JOIN jobs j on e.job_id=j.job_id where e.department_id BETWEEN 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -SELECT first_name 员工姓名, salary 工资,manager_id 管理者id from employees where manager_id in (100,101,110); - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - -SELECT first_name 姓名 ,department_id 部门号,salary*12 年薪 from employees ORDER BY 年薪 DESC; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -SELECT first_name 姓名 ,salary 工资 from employees where salary not BETWEEN 8000 and 17000 ORDER BY salary desc LIMIT 0,20; - - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -SELECT * FROM employees where email like '%e%' ORDER BY LENGTH(email) desc , department_id asc; - - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 - -SELECT e.first_name 姓名,d.department_id 部门号, d.department_name 部门名称 FROM employees e LEFT JOIN departments d on d.department_id=e.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -SELECT job_id,location_id FROM employees e LEFT JOIN departments d on d.department_id=e.department_id where d.department_id=90; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -SELECT e.last_name , d.department_name , l.location_id,l.city FROM employees e LEFT JOIN departments d on d.department_id=e.department_id LEFT JOIN locations l on l.location_id=d.location_id where commission_pct is not null; - - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -SELECT e.last_name , e.job_id , d.department_id , d.department_name FROM employees e LEFT JOIN departments d on d.department_id=e.department_id LEFT JOIN locations l on l.location_id=d.location_id where l.city='多伦多'; - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - -SELECT department_name 部门名称, city 部门地址, e.last_name 姓名, j.job_title 工作, e.salary 工资 FROM employees e,departments d,locations l,jobs j where e.department_id=d.department_id and d.location_id=l.location_id and j.job_id=e.job_id; - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -SELECT b.first_name 员工姓名,b.department_id 员工编号,a.last_name 上级姓名,a.manager_id 上级的员工编号 FROM employees a JOIN employees b where a.department_id=b.department_id; - - -# 7.查询哪些部门没有员工 -SELECT * FROM departments d LEFT JOIN employees e on d.department_id=e.department_id where e.department_id is null; - -# 8. 查询哪个城市没有部门 -SELECT * FROM departments d LEFT JOIN locations l on d.location_id=l.location_id where state_province is null ; - - - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -SELECT * FROM employees e JOIN departments d ON e.department_id = d.department_id WHERE d.department_name like '销售部' or d.department_name like '信息技术部'; - - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 - -SELECT MAX(salary) 最大值,MIN(salary) 最小值,AVG(salary) 平均值,SUM(salary) 总和 FROM employees; -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -SELECT MAX(salary) 最大值,MIN(salary) 最小值,AVG(salary) 平均值,SUM(salary) 总和,job_id FROM employees GROUP BY job_id; -#4.选择各个job_id的员工人数 - -SELECT count(job_id) FROM employees GROUP BY job_id; - -# 5.查询员工最高工资和最低工资的差距 -SELECT MAX(salary) - MIN(salary) 差距 FROM employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - - SELECT MAX(salary) 最大值,MIN(salary) 最小值 FROM employees WHERE salary>6000 and manager_id is not null GROUP BY manager_id; - - - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - - -SELECT d.department_name,AVG(salary),count(job_id) FROM employees e JOIN departments d ON e.department_id = d.department_id GROUP BY d.department_name ORDER BY AVG(salary) DESC; - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -SELECT job_title,department_name,min_salary FROM jobs j JOIN employees e on j.job_id=e.job_id join departments d on e.department_id=d.department_id - - - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - - -SELECT last_name,salary FROM employees WHERE department_id= (SELECT department_id FROM employees WHERE last_name like '兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - - -SELECT employee_id,last_name,salary FROM employees WHERE salary>(SELECT AVG(salary) FROM employees); -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary -SELECT last_name, job_id, salary FROM employees WHERE salary>(SELECT MAX(salary) FROM employees WHERE JOB_ID = 'SA_MAN'); - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -SELECT employee_id FROM employees where first_name like "%u%"; -SELECT employee_id 员工号,first_name 姓名 FROM employees where employee_id = (SELECT employee_id FROM employees where first_name like "%u%"); - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 - -SELECT location_id FROM departments where location_id = 1700; -SELECT first_name,department_id FROM employees where department_id in (SELECT department_id FROM departments where location_id = 1700); - - -#6.查询管理者是 金 的员工姓名和工资 -SELECT last_name FROM employees WHERE last_name='金'; - -SELECT first_name 员工姓名,salary 工资 FROM employees where last_name in (SELECT last_name FROM employees WHERE last_name='金'); -#7.查询工资最低的员工信息: last_name, salary - -SELECT last_name,salary FROM employees WHERE salary =(SELECT MIN(salary) FROM employees); - - -#8.查询平均工资最低的部门信息 -#方式1: -# 部门最低工资=全司最低 - -#方式2 -# 部门平均<= 公司所有平均 - -SELECT department_id FROM employees GROUP BY department_id ORDER BY avg(salary) LIMIT 0,1; - -SELECT DISTINCT d.* FROM employees e LEFT JOIN departments d on e.department_id=d.department_id where d.department_id = (SELECT department_id FROM employees GROUP BY department_id ORDER BY avg(salary) LIMIT 0,1); - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - # 连表查 - select d.*,avg(e.salary) 平均工资 from departments d right join employees e on d.department_id = e.department_id group by d.department_id order by 平均工资 limit 0,1; - # 子查询 - select d.*,a.平均工资 from departments d right join - (select department_id,avg(salary) 平均工资 from employees group by department_id having avg(salary) = - (select avg(salary) 平均工资 from employees group by department_id order by 平均工资 limit 0,1)) a - on d.department_id = a.department_id; - - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 -#方式2:平均工资>=所有平均工资 - select j.*,avg(e.salary) 平均工资 - from jobs j right join employees e on j.job_id = e.job_id group by j.job_id order by 平均工资 desc limit 0,1; - -#11.查询平均工资高于公司平均工资的部门有哪些? - select d.department_name 部门名,avg(e.salary) 平均工资 - from departments d right join employees e on d.department_id = e.department_id - group by d.department_id having 平均工资 > (select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - select * from employees where employee_id in - (select distinct(a.employee_id) from - (select e2.* from employees e1 left join employees e2 on e1.manager_id = e2.employee_id) a); - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - select * from employees where employee_id in - (select distinct manager_id from employees); - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - select min(e.salary) 最低工资 from employees e right join - (select department_id,max(salary) 最高工资 from employees group by department_id order by 最高工资 limit 0,1) a - on e.department_id = a.department_id ; - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - select last_name, department_id, email, salary from employees where employee_id = - (select employee_id from employees e right join - (select department_id,avg(salary) 平均工资 from employees group by department_id order by 平均工资 desc limit 0,1) a - on e.department_id = a.department_id limit 0,1); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - select job_id from jobs where job_id != 'ST_CLERK'; - -#16. 选择所有没有管理者的员工的last_name - select last_name from employees where manager_id is null; - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - select * from employees where last_name = 'De Haan' - -#方式2: - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - select e.employee_id 员工号,e.last_name 姓名,e.salary 工资,a.平均工资 from employees e left join - (select department_id,avg(salary) 平均工资 from employees group by department_id) a - on e.department_id = a.department_id and e.salary > a.平均工资; - -#方式2:在FROM中声明子查询 - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - select department_name from departments where department_id in - (select distinct department_id from employees where employee_id in - (select manager_id from employees group by manager_id having count(manager_id)>5)); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - select country_id from locations where location_id in - (select location_id from departments group by location_id having count(location_id) > 2); -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` - diff --git "a/56 \350\265\265\346\225\217/20230924 \347\254\224\350\256\260.md" "b/56 \350\265\265\346\225\217/20230924 \347\254\224\350\256\260.md" deleted file mode 100644 index 8d55c4e24da5c512d2fbfdb25acc88fa0c7451df..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/20230924 \347\254\224\350\256\260.md" +++ /dev/null @@ -1,38 +0,0 @@ -#### **笔记** - - - - 为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - -#### 四个特性 - - 1.原子性:事务包含的这一系列操作,要么全部成功,要么全部失败 - - 2.一致性:事务完成之后,不会将非法的数据写入数据库。 - - 3.隔离性:多个事务可以在一定程度上并发执行 - - 4.持久性:事务完成之后,数据要永久保存 - -#### 视图 - - 在已有的表或者视图上创建的虚拟表 - - 创建视图: create view 视图名 asselect - - 可以对(单表)视图进行一些增删改查的操作,这些操作会影响到原始的表 - - 删除视图:drop view 视图名 - -#### 索引 - - 为了提高查询的速度而在数据库断创建的一种排序的数据结构 - -#### 储存过程 - - 存储在数据库端的一组为了完成特点功能的sql语句 - - 存储过程:create procedure 存储过程名 - - 参数格式(参数类型 参数名 数据类型) - diff --git "a/56 \350\265\265\346\225\217/20230926 \350\247\206\345\233\276.md" "b/56 \350\265\265\346\225\217/20230926 \350\247\206\345\233\276.md" deleted file mode 100644 index 0d4e0e138f1d335b7c7f3acb071e469f60f7562d..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/20230926 \350\247\206\345\233\276.md" +++ /dev/null @@ -1,103 +0,0 @@ -## 新增约束 - -check 作用:检查某个字段的值是否符合xx要求。 - -一般是指范围(age,int,age>0) - -格式 check (字段名 in ('男','女')) - -在utf8中一个汉字等于一个字符等于3个字节。 - -## 视图 - -视图是一种虚拟表,本身是不具有数据的。 - -可以把查的临时表数据保存在视图里方便查询 - -create view 名称 as 查询语句 - -concat(“字段名”,“字段名”)(可以把字段结合在一起) - -查视图对象 - -show tables - -查看创建视图的语句 - -show create view 视图名称 - -当视图和基表是一对一的时候可以更新。 - -修改视图语句 - -1.create or replace view 视图名称 as 查询语句 (有就更新 没有就创建) - -2.alter view 视图名称 as 查询语句 (一定要存在被修改的视图) - -删除视图 - -drop view 视图名称 - -drop view if exists 视图名称(有就删除没有就跳过) - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -CREATE VIEW employee_vu(姓名,员工号,部门号) as SELECT LAST_NAME,EMPLOYEE_ID,DEPARTMENT_ID FROM employees; - - -#2. 显示视图的结构 -desc employee_vu; - - -#3. 查询视图中的全部内容 -SELECT * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 - -ALTER view employee_vu as SELECT LAST_NAME,EMPLOYEE_ID,DEPARTMENT_ID FROM employees WHERE DEPARTMENT_ID<=80; -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 -SELECT * from emp_v1; -CREATE view emp_v1(员工姓名,工资,邮箱) as SELECT last_name,salary,email from employees where phone_number like "011%"; - - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -SELECT * from emp_v1; - -ALTER view emp_v1 as SELECT last_name,salary,email,phone_number from employees where phone_number like "011%" and email like "%e%"; -#3. 向 emp_v1 插入一条记录,是否可以? - - - - - - -#4. 修改emp_v1中员工的工资,每人涨薪1000 -update emp_v1 set salary = salary + 1000; - -#5. 删除emp_v1中姓名为Olsen的员工 -DELETE from emp_v1 where last_name like "Olsen"; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -SELECT max(salary) 最高工资 from employees a LEFT JOIN departments b on a.department_id=b.department_id GROUP BY department_name; - -CREATE view cmp_v2 as SELECT max(salary) 最高工资,department_id from employees WHERE salary >12000 GROUP BY department_id; - - - - - -#7. 向 emp_v2 中插入一条记录,是否可以? - - - -#8. 删除刚才的emp_v2 和 emp_v1 -DROP view if exists cmp_v2; -DROP view emp_v1; \ No newline at end of file diff --git "a/56 \350\265\265\346\225\217/20290913 \347\224\265\345\275\261.md" "b/56 \350\265\265\346\225\217/20290913 \347\224\265\345\275\261.md" deleted file mode 100644 index 5ad00db611d940645e2be3be583ffd9665332b62..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/20290913 \347\224\265\345\275\261.md" +++ /dev/null @@ -1,416 +0,0 @@ -作业 - -```MySQL -/*==============================================================*/ -/* DBMS name: Sybase SQL Anywhere 12 */ -/* Created on: 2023/9/13 9:34:30 */ -/*==============================================================*/ - - -if exists(select 1 from sys.sysforeignkey where role='FK_RELATION_RELATIONS_MOVIE') then - alter table Relationship_1 - delete foreign key FK_RELATION_RELATIONS_MOVIE -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_RELATION_RELATIONS_WEBSITE') then - alter table Relationship_1 - delete foreign key FK_RELATION_RELATIONS_WEBSITE -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_RELATION_RELATIONS_CREW') then - alter table Relationship_3 - delete foreign key FK_RELATION_RELATIONS_CREW -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_RELATION_RELATIONS_MAIN') then - alter table Relationship_3 - delete foreign key FK_RELATION_RELATIONS_MAIN -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_RELATION_RELATIONS_WEBSITE') then - alter table Relationship_4 - delete foreign key FK_RELATION_RELATIONS_WEBSITE -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_RELATION_RELATIONS_USER') then - alter table Relationship_4 - delete foreign key FK_RELATION_RELATIONS_USER -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_MAIN_RELATIONS_MOVIE') then - alter table main - delete foreign key FK_MAIN_RELATIONS_MOVIE -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_VIEW_RELATIONS_USER') then - alter table "view" - delete foreign key FK_VIEW_RELATIONS_USER -end if; - -if exists(select 1 from sys.sysforeignkey where role='FK_VIEW_RELATIONS_MOVIE') then - alter table "view" - delete foreign key FK_VIEW_RELATIONS_MOVIE -end if; - -drop index if exists Relationship_1.Relationship_1_FK; - -drop index if exists Relationship_1.Relationship_7_FK; - -drop index if exists Relationship_1.Relationship_1_PK; - -drop table if exists Relationship_1; - -drop index if exists Relationship_3.Relationship_3_FK; - -drop index if exists Relationship_3.Relationship_8_FK; - -drop index if exists Relationship_3.Relationship_3_PK; - -drop table if exists Relationship_3; - -drop index if exists Relationship_4.Relationship_4_FK; - -drop index if exists Relationship_4.Relationship_9_FK; - -drop index if exists Relationship_4.Relationship_4_PK; - -drop table if exists Relationship_4; - -drop index if exists crew.crew_PK; - -drop table if exists crew; - -drop index if exists main.Relationship_2_FK; - -drop index if exists main.main_PK; - -drop table if exists main; - -drop index if exists movie.movie_PK; - -drop table if exists movie; - -drop index if exists "user".user_PK; - -drop table if exists "user"; - -drop index if exists "view".Relationship_6_FK; - -drop index if exists "view".Relationship_5_FK; - -drop table if exists "view"; - -drop index if exists website.website_PK; - -drop table if exists website; - -if exists(select 1 from sys.syssequence s - where sequence_name='S_crew') then - drop sequence S_crew -end if; - -if exists(select 1 from sys.syssequence s - where sequence_name='S_main') then - drop sequence S_main -end if; - -if exists(select 1 from sys.syssequence s - where sequence_name='S_movie') then - drop sequence S_movie -end if; - -if exists(select 1 from sys.syssequence s - where sequence_name='S_user') then - drop sequence S_user -end if; - -create sequence S_crew; - -create sequence S_main; - -create sequence S_movie; - -create sequence S_user; - -/*==============================================================*/ -/* Table: Relationship_1 */ -/*==============================================================*/ - -create database z charset utf8; -use z; -create table Relationship_1 -( - mo_id integer not null, - we_id char(10) not null, - constraint PK_RELATIONSHIP_1 primary key (mo_id, we_id) -); - -/*==============================================================*/ -/* Index: Relationship_1_PK */ -/*==============================================================*/ -create unique index Relationship_1_PK on Relationship_1 ( -mo_id ASC, -we_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_7_FK */ -/*==============================================================*/ -create index Relationship_7_FK on Relationship_1 ( -we_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_1_FK */ -/*==============================================================*/ -create index Relationship_1_FK on Relationship_1 ( -mo_id ASC -); - -/*==============================================================*/ -/* Table: Relationship_3 */ -/*==============================================================*/ -create table Relationship_3 -( - cr_id integer not null, - main_id integer not null, - constraint PK_RELATIONSHIP_3 primary key (cr_id, main_id) -); - -/*==============================================================*/ -/* Index: Relationship_3_PK */ -/*==============================================================*/ -create unique index Relationship_3_PK on Relationship_3 ( -cr_id ASC, -main_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_8_FK */ -/*==============================================================*/ -create index Relationship_8_FK on Relationship_3 ( -main_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_3_FK */ -/*==============================================================*/ -create index Relationship_3_FK on Relationship_3 ( -cr_id ASC -); - -/*==============================================================*/ -/* Table: Relationship_4 */ -/*==============================================================*/ -create table Relationship_4 -( - we_id char(10) not null, - us_id integer not null, - constraint PK_RELATIONSHIP_4 primary key (we_id, us_id) -); - -/*==============================================================*/ -/* Index: Relationship_4_PK */ -/*==============================================================*/ -create unique index Relationship_4_PK on Relationship_4 ( -we_id ASC, -us_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_9_FK */ -/*==============================================================*/ -create index Relationship_9_FK on Relationship_4 ( -us_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_4_FK */ -/*==============================================================*/ -create index Relationship_4_FK on Relationship_4 ( -we_id ASC -); - -/*==============================================================*/ -/* Table: crew */ -/*==============================================================*/ -create table crew -( - cr_id integer not null default (S_crew.nextval), - cr_address varchar(225) not null, - cr_staff varchar(225) not null, - constraint PK_CREW primary key (cr_id) -); - -/*==============================================================*/ -/* Index: crew_PK */ -/*==============================================================*/ -create unique index crew_PK on crew ( -cr_id ASC -); - -/*==============================================================*/ -/* Table: main */ -/*==============================================================*/ -create table main -( - director varchar(10) not null, - scriptwriter varchar(10) not null, - Starring varchar(10) not null, - main_id integer not null default (S_main.nextval), - mo_id integer not null, - constraint PK_MAIN primary key (main_id) -); - -/*==============================================================*/ -/* Index: main_PK */ -/*==============================================================*/ -create unique index main_PK on main ( -main_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_2_FK */ -/*==============================================================*/ -create index Relationship_2_FK on main ( -mo_id ASC -); - -/*==============================================================*/ -/* Table: movie */ -/*==============================================================*/ -create table movie -( - mo_name varchar(20) not null, - mo_id integer not null default (S_movie.nextval), - mo_type varchar(225) not null, - mo_language varchar(225) not null, - datetime timestamp not null, - mo_time time not null, - constraint PK_MOVIE primary key (mo_id) -); - -/*==============================================================*/ -/* Index: movie_PK */ -/*==============================================================*/ -create unique index movie_PK on movie ( -mo_id ASC -); - -/*==============================================================*/ -/* Table: "user" */ -/*==============================================================*/ -create table "user" -( - us_id integer not null default (S_user.nextval), - us_name char(10) not null, - constraint PK_USER primary key (us_id) -); - -/*==============================================================*/ -/* Index: user_PK */ -/*==============================================================*/ -create unique index user_PK on "user" ( -us_id ASC -); - -/*==============================================================*/ -/* Table: "view" */ -/*==============================================================*/ -create table "view" -( - us_id integer not null, - mo_id integer not null, - vi_film char(255) null, - vi_short char(255) null -); - -/*==============================================================*/ -/* Index: Relationship_5_FK */ -/*==============================================================*/ -create index Relationship_5_FK on "view" ( -us_id ASC -); - -/*==============================================================*/ -/* Index: Relationship_6_FK */ -/*==============================================================*/ -create index Relationship_6_FK on "view" ( -mo_id ASC -); - -/*==============================================================*/ -/* Table: website */ -/*==============================================================*/ -create table website -( - we_id char(10) not null, - we_address char(10) not null, - we_name char(10) not null, - constraint PK_WEBSITE primary key (we_id) -); - -/*==============================================================*/ -/* Index: website_PK */ -/*==============================================================*/ -create unique index website_PK on website ( -we_id ASC -); - -alter table Relationship_1 - add constraint FK_RELATION_RELATIONS_MOVIE foreign key (mo_id) - references movie (mo_id) - on update restrict - on delete restrict; - -alter table Relationship_1 - add constraint FK_RELATION_RELATIONS_WEBSITE foreign key (we_id) - references website (we_id) - on update restrict - on delete restrict; - -alter table Relationship_3 - add constraint FK_RELATION_RELATIONS_CREW foreign key (cr_id) - references crew (cr_id) - on update restrict - on delete restrict; - -alter table Relationship_3 - add constraint FK_RELATION_RELATIONS_MAIN foreign key (main_id) - references main (main_id) - on update restrict - on delete restrict; - -alter table Relationship_4 - add constraint FK_RELATION_RELATIONS_WEBSITE foreign key (we_id) - references website (we_id) - on update restrict - on delete restrict; - -alter table Relationship_4 - add constraint FK_RELATION_RELATIONS_USER foreign key (us_id) - references "user" (us_id) - on update restrict - on delete restrict; - -alter table main - add constraint FK_MAIN_RELATIONS_MOVIE foreign key (mo_id) - references movie (mo_id) - on update restrict - on delete restrict; - -alter table "view" - add constraint FK_VIEW_RELATIONS_USER foreign key (us_id) - references "user" (us_id) - on update restrict - on delete restrict; - -alter table "view" - add constraint FK_VIEW_RELATIONS_MOVIE foreign key (mo_id) - references movie (mo_id) - on update restrict - on delete restrict; - - -``` - diff --git "a/56 \350\265\265\346\225\217/RBAC\347\254\224\350\256\260.md" "b/56 \350\265\265\346\225\217/RBAC\347\254\224\350\256\260.md" deleted file mode 100644 index 969a816d860b5061d9763f1dc1ebc35f0fb33da1..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/RBAC\347\254\224\350\256\260.md" +++ /dev/null @@ -1,8 +0,0 @@ -### RBAC:基于角色的访问权限管理控制模型 - -RBAC的概念:一种数据库的设计思想,目前开发系统的主流设计思想。 - -用户—>角色—>权限 - -RBAC的核心是角色 - diff --git "a/56 \350\265\265\346\225\217/mysql\345\244\215\344\271\240.md" "b/56 \350\265\265\346\225\217/mysql\345\244\215\344\271\240.md" deleted file mode 100644 index d656a8bcc4ada23d3f1751305e4677865b68872d..0000000000000000000000000000000000000000 --- "a/56 \350\265\265\346\225\217/mysql\345\244\215\344\271\240.md" +++ /dev/null @@ -1,759 +0,0 @@ -CREATE DATABASE xiaoche charset utf8; -use xiaoche; -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 -SELECT sum(salary*12) ,(sum(salary)+sum(commission_pct*salary))*12 奖金 from employees; - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct -SELECT distinct job_id from employees; - - -# 3.查询工资大于12000的员工姓名和工资 -SELECT last_name,salary from employees WHERE salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 -SELECT last_name,department_id from employees WHERE employee_id=176; - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -SELECT * from departments; -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -SELECT last_name,salary from employees WHERE salary not BETWEEN 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -SELECT last_name,department_id from employees WHERE department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id - -SELECT last_name,job_id from employees WHERE manager_id is null; - - - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -SELECT last_name,salary,b.grade_level 奖金等级,commission_pct*salary from employees a LEFT JOIN job_grades b on a.commission_pct*salary BETWEEN b.lowest_sal and b.highest_sal WHERE a.commission_pct is not null ; - - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -SELECT * from employees WHERE last_name like "__尔"; - - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -SELECT * from employees WHERE last_name like "%尔%" and last_name like "%特%"; - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -SELECT * from employees WHERE last_name like "%尔"; - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -SELECT last_name,job_id from employees WHERE department_id BETWEEN 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -SELECT last_name,salary,manager_id from employees where manager_id in (100,101,110); - - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc - SELECT last_name,department_id, salary*12 年薪 FROM employees ORDER BY 年薪 desc; -# - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -SELECT last_name,salary from employees WHERE salary not BETWEEN 8000 and 17000 order by salary desc LIMIT 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -SELECT * from employees WHERE email like "%e%" order by length(email) desc,department_id asc; - - - - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -SELECT a.last_name,a.department_id,b.department_name from employees a LEFT JOIN departments b on a.department_id=b.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id -SELECT job_id,location_id from employees a LEFT JOIN departments b on a.department_id=b.department_id WHERE a.department_id=90 ; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -SELECT a.last_name,b.department_name,c.location_id,c.city from employees a LEFT JOIN departments b on a.department_id = b.department_id LEFT JOIN locations c on b.location_id = c.location_id WHERE a.commission_pct is not null; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -SELECT a.last_name,a.job_id,b.department_id,b.department_name,city from employees a LEFT JOIN departments b on a.department_id = b.department_id LEFT JOIN locations c on b.location_id = c.location_id WHERE city = "多伦多"; - -#sql92语法(自然连接): - -SELECT * from employees a , departments b WHERE a.department_id=b.department_id; - - -# 5.查询行政部门员工的、、、、 - - -SELECT a.last_name 姓名,b.department_name 部门名称,city 部门地址,salary 工资,d.job_title 工作 from employees a LEFT JOIN departments b on a.department_id = b.department_id LEFT JOIN locations c on b.location_id = c.location_id LEFT JOIN jobs d on a.job_id = d.job_id WHERE b.department_name="行政部" ; - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - - -SELECT * from employees; - -# 7.查询哪些部门没有员工 -SELECT * FROM departments d left join employees l on l.department_id=d.department_id WHERE l.last_name is null; - -# 8. 查询哪个城市没有部门 -SELECT * FROM locations l left join departments d on d.location_id = l.location_id WHERE department_name is null; - - - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -SELECT * from employees a LEFT JOIN departments b on a.department_id = b.department_id where department_name= "销售部" or department_name="信息技术部"; - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的,,, - -SELECT max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees; -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -SELECT job_id, max(salary) 最大值,min(salary) 最小值,avg(salary) 平均值,sum(salary) 总和 from employees GROUP BY job_id; - -#4.选择各个job_id的 -SELECT job_id,count(employee_id) 员工人数 from employees GROUP BY job_id; -# 5.查询员工最高工资和最低工资的差距 - -SELECT max(salary)-min(salary) 最高工资和最低工资的差距 from employees; -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 -SELECT manager_id,min(salary) 最低工资 from employees GROUP BY manager_id HAVING 最低工资>=6000 and manager_id is not null; - - - - - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -SELECT b.department_name 部门名称,location_id,count(a.employee_id) 员工数量,avg(a.salary) 平均工资 from departments b LEFT JOIN employees a on a.department_id = b.department_id GROUP BY b.department_name desc,location_id; - - - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 -SELECT job_title 工种, department_name 部门名,min(salary) from employees a LEFT JOIN departments b on a.department_id = b.department_id LEFT JOIN jobs c on a.job_id=c.job_id GROUP BY job_title,department_name; - - - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -SELECT last_name,salary from employees a LEFT JOIN departments b on a.department_id = b.department_id WHERE department_name in (SELECT department_name from employees a LEFT JOIN departments b on a.department_id = b.department_id WHERE last_name="兹洛特基") -; - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -SELECT employee_id,last_name,salary from employees where salary>( -SELECT avg(salary) from employees) ; - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary -SELECT last_name, job_id, salary from employees WHERE salary >( -SELECT max(salary) FROM employees where job_id="SA_MAN"); - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -SELECT employee_id,last_name -FROM employees ; - - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -SELECT employee_id from employees a LEFT JOIN departments b on a.department_id = b.department_id WHERE location_id in( -SELECT location_id from locations WHERE location_id =1700); - - -#6.查询管理者是 金 的员工姓名和工资 -SELECT last_name,salary from employees where manager_id in ( -SELECT employee_id from employees where last_name = "金" and manager_id is null); - - - -#7.查询工资最低的员工信息: last_name, salary -SELECT last_name, salary from employees WHERE salary in ( -SELECT min(salary) from employees) ; - - -#8.查询平均工资最低的部门信息 -SELECT b.*,avg(salary) 平均工资 from employees a LEFT JOIN departments b on a.department_id = b.department_id GROUP BY b.department_id ORDER BY 平均工资 asc LIMIT 1; - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - - - -​ -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - - -#10.查询平均工资最高的 job 信息 -SELECT * FROM jobs WHERE job_id = ( SELECT job_id FROM employees GROUP BY job_id HAVING AVG( salary ) >= ALL ( SELECT AVG( salary ) FROM employees GROUP BY job_id ) );#方式1:平均工资=最大 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - - - - -#11.查询平均工资高于公司平均工资的部门有哪些? -SELECT department_id FROM employees WHERE department_id IS NOT NULL GROUP BY department_id HAVING AVG( salary ) > ( SELECT AVG( salary ) FROM employees ); - - - -#12.查询出公司中所有 manager 的详细信息 -SELECT employee_id, last_name, salary FROM employees WHERE employee_id IN ( SELECT DISTINCT manager_id FROM employees ); -#方式1:自连接 自己连自己 - - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - - - -​ -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - - - -#方式: -SELECT * FROM employees WHERE department_id = 10; - - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - -SELECT department_id FROM departments WHERE department_id NOT IN ( SELECT DISTINCT department_id FROM employees WHERE job_id = 'ST_CLERK' ); - - - -#16. 选择所有没有管理者的员工的last_name -SELECT last_name FROM employees e1 WHERE NOT EXISTS ( SELECT * FROM employees e2 WHERE e1.manager_id = e2.employee_id ); - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: -SELECT employee_id,last_name,hire_date,salary FROM employees WHERE manager_id = ( SELECT employee_id FROM employees WHERE last_name = 'De Haan' ); - -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) -SELECT department_name, department_id FROM departments d WHERE 5 < ( SELECT COUNT(*) FROM employees e WHERE d.department_id = e.department_id ); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) -SELECT country_id FROM locations l WHERE 2 < ( SELECT COUNT(*) FROM departments d WHERE l.`location_id` = d.`location_id` ); - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ \ No newline at end of file diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230905 \345\244\247\344\272\214\350\256\241\345\210\222.md" "b/57 \351\273\204\346\265\201\346\266\233/20230905 \345\244\247\344\272\214\350\256\241\345\210\222.md" deleted file mode 100644 index 8f6292591b25e63456942897c373fb335c8fd9c3..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230905 \345\244\247\344\272\214\350\256\241\345\210\222.md" +++ /dev/null @@ -1,26 +0,0 @@ -### 大二上 - -实际应用(实操)学习mysql高级 MVC框架等 - -### 大二下 - -Node.js(前端) vue.js(前端)简化开发 有UI框架配合 - -spping Boot (redis,webApi) - -### 实训 - - 1.Linux服务器 nginx - -2. 项目中可能实现的技术:中间件 ,签权 ,鉴别权限 -3. 小程序 uniapp移动端开发 - -### 课后知识 - -1.技术栈:一个技术要求用用什么技术实现,可以成为技术选型 - -2.技能树:一个人具备的技能,称为技能树 - -3.学会独立完成项目,在老师讲课的基础上,多利用空余时间学习别的知识 - -4.我们应该多关注招聘网站,多以我们学习的专业 招聘职位的岗位要求,为我们的学习目标 可以更好的适应今后的工作 \ No newline at end of file diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" "b/57 \351\273\204\346\265\201\346\266\233/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" deleted file mode 100644 index 298bc44c7b1149d67449b437238752b28b866d86..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230906 \346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.md" +++ /dev/null @@ -1,127 +0,0 @@ -# 笔记 - - ### 数据库设计 - -​ 关系是相互的 - -​ 表与表之间的关系有三种 - -​ 1.一对一的关系:任意一张表的主键,放到另一张表当外键。 - -​ 2.一对多的关系:将一所在的表的主键,放到多的表当外键。 - -​ 3.多对多的关系:必须引入第三张表,做为中转,将前面两个表的主键放进来当做外键。 - -​ 数据库的设计方式: - -​ 1.直观设计法 2.规范设计法 3.计算机辅助设计法 - -#### E-R图(实体关系图) - -​ 1.三要素 - -​ 1.实体(表) - -​ 2.属性(字段) - -​ 3关系(类似外键与主键的关系) - -​ 2.要素的表示 - -​ 实体:矩形表示,内写实体名 - -​ 属性:椭圆形表示,与实体连接 - -​ 关系:菱形表示,内写明联系的名称(联系也可以有自己的属性) - -​ 用线与实体相连,可标上联系的类型 - -# 作业 - -```mysql -CREATE DATABASE school charset utf8; -USE school; - --- 院系表 -CREATE TABLE faculties ( -faculties_id INT PRIMARY KEY, -- 院系编号 -faculties_name VARCHAR(255) -- 院系名称 -); - --- 专业表 -CREATE TABLE specialized( -faculties_id INT, -- 院系编号 -specialized_id INT PRIMARY KEY, -- 专业编号 -specialized_name VARCHAR(255), -- 专业名称 -FOREIGN KEY (faculties_id) REFERENCES faculties (faculties_id) -- 外键 -); - --- 班级表 -CREATE TABLE class ( -specialized_id INT, -- 专业编号 -class_id INT PRIMARY KEY, -- 班级编号 -class_name VARCHAR(255), -- 班级名称 -class_year int, -- 年段 -FOREIGN KEY (specialized_id) REFERENCES specialized (specialized_id) -- 外键 -); - --- 学生表 -CREATE TABLE student ( -class_id INT, -- 班级编号 -student_id INT PRIMARY KEY, -- 学号 -student_name VARCHAR(255), -- 姓名 -student_sex char(1), -- 性别 -FOREIGN KEY (class_id) REFERENCES class (class_id) -- 外键 -); - --- 教师表 -CREATE TABLE teacher( -teacher_id INT PRIMARY KEY, -- 教师工号 -teacher_name VARCHAR(255), -- 姓名 -teacher_sex char(1) -- 性别 -); - --- 课表 -CREATE TABLE schedul( -schedul_id INT PRIMARY KEY, -- 课表编号 -schedul_week VARCHAR(255), -- 星期 -schedul_section VARCHAR(255) -- 节次 -); - --- 课程表 -CREATE TABLE course( -teacher_id INT, -- 教师工号 -schedul_id INT, -- 课表编号 -course_id INT PRIMARY KEY, -- 课程编号 -course_name VARCHAR(255) -- 课程名称 -course_credits int, -- 学分 -FOREIGN KEY (teacher_id) REFERENCES teacher (teacher_id), -- 外键 -FOREIGN KEY (schedul_id) REFERENCES schedul (schedul_id) -- 外键 -); - --- 选课表 -CREATE TABLE CourseSelection( -CourseSelection_id INT PRIMARY KEY, -- 选课编号 -student_id INT, -- 学号 -course_id INT, -- 课程编号 -FOREIGN KEY (student_id) REFERENCES student (student_id), -- 外键 -FOREIGN KEY (course_id) REFERENCES course (course_id) -- 外键 -); - --- 教室表 -CREATE TABLE classroom( -classroom_id INT PRIMARY KEY, -- 教室编号 -classroom_name VARCHAR(255), -- 名称 -classroom_add VARCHAR(255) -- 地址 -); - --- 场所使用表 -CREATE TABLE location( -location_id INT PRIMARY KEY, -- 使用编号 -schedul_id INT, -- 课表编号 -classroom_id INT, -- 教室编号 -FOREIGN KEY (schedul_id) REFERENCES schedul (schedul_id), -- 外键 -FOREIGN KEY (classroom_id) REFERENCES classroom (classroom_id) -- 外键 -); -``` - diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" "b/57 \351\273\204\346\265\201\346\266\233/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" deleted file mode 100644 index 22e8898548dded1036642479e90e6de4f25f810e..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230907 \346\225\260\346\215\256\345\272\223\350\214\203\345\274\217.md" +++ /dev/null @@ -1,100 +0,0 @@ -# 笔记 - -### 数据库范式 - -​ 数据库第一范式:要求字段的内容,不可在分割,为的是保证数据的原子性。 - -​ 数据库第二范式:要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键,要依赖整个联合主键)而不能只能依赖部分。 - -​ 数据库第三范式:满足第二范式的前提上,要求,非主键属性要直接依赖于主键。 - - - -```mysql --- 建库 -CREATE DATABASE school charset utf8; --- 使用库 -use school; --- 院系表 -CREATE TABLE department( - dt_id INT PRIMARY key auto_increment, -- 院系编号 - dt_name char(10) -- 院系名称 -); - --- 专业表 -CREATE TABLE major ( - mj_id INT PRIMARY key auto_increment, -- 专业编号 - mj_name char(10), -- 专业名称 - dt_id INT, -- 院系编号 - foreign KEY (dt_id) references department (dt_id) -- 外键 -); - --- 班级表 -create table clas( - cl_id INT primary KEY auto_increment, -- 班级编号 - cl_name char(10), -- 班级名称 - cl_year char(6), -- 年段 - mj_id INT, -- 专业编号 - foreign KEY (mj_id) references major (mj_id) -- 外键 -); - --- 学生表 -create table student( - st_id int primary key auto_increment, -- 学生学号 - st_name char(10), -- 姓名 - st_sex char(1), -- 性别 - st_age int, -- 年龄 - cl_id INT, -- 班级编号 - foreign KEY (cl_id) references clas (cl_id) -- 外键 -); - --- 教师表 -create table teacher( - te_id int primary key auto_increment, -- 教师工号 - te_name char(10), -- 姓名 - te_sex char(1), -- 性别 - te_age int -- 年龄 -); - --- 课程表 -CREATE table course( - cs_id int primary key auto_increment, -- 课程编号 - cs_name char(10), -- 课程名称 - cs_credit int, -- 学分 - te_id int, -- 教师工号 - foreign KEY (te_id) references teacher (te_id) -- 外键 -); - --- 学生选课表 -create table selecourse( - sc_id int primary key auto_increment, -- 选课编号 - sc_score double(3,1), -- 成绩 - st_id int, -- 学生学号 - cs_id int, -- 课程编号 - foreign KEY (st_id) references student (st_id), -- 外键 - foreign KEY (cs_id) references course (cs_id) -- 外键 -); - --- 教室表 -CREATE table classroom( - cr_id int primary key auto_increment, -- 教室编号 - cr_name char(10), -- 教室名称 - cr_add varchar(255) -- 教室地址 -); - --- 上课表 -create table timetable( - tt_id int primary key auto_increment, -- 上课编号 - tt_week char(3), -- 星期 - tt_time char(10), -- 节次 - cl_id INT, -- 班级 - cs_id int, -- 课程 - cr_id int, -- 教室 - te_id int, -- 授课老师 - foreign KEY (cl_id) references clas (cl_id), -- 外键 - foreign KEY (cs_id) references course (cs_id), -- 外键 - foreign KEY (cr_id) references classroom (cr_id), -- 外键 - foreign KEY (te_id) references teacher (te_id) -- 外键 -); -``` - diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230910 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" "b/57 \351\273\204\346\265\201\346\266\233/20230910 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index 357afa16e3dd5a6d9926ce32d50ace0ac8c87643..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230910 \345\233\276\344\271\246\351\246\206\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,199 +0,0 @@ -# 笔记 - -### powerDesigner - -​ 第一步:创建概念模型(类似ER图) CDM (用户角度) - -​ 第二步:转换成逻辑模型 LDM (计算机角度) - -​ 第三步:转换成物理模型 PDM (数据库角度) - -​ 第四步:生成DDL - -### 数据库设计步骤 - -​ 1.需求分析,了解要开发的系统的需求,明确数据和格式 - -​ 2.概念结构设计:将需求分析得到的抽象成概念模型,将ER图向关系模型转化 - -​ 3.逻辑结构设计:将概念结构转化成DBMS所支持的数据模型 - -​ 4.物理结构设计:将概念模型,转换成选定数据库管理系统需要的物理模型 - -​ 5.数据库实施:根据物理模型生成对应的DDL - -​ 6.数据库维护 - -# 作业 - -## 图书管理数据库 - -​ 图书馆:图书馆编号,馆名,地址,联系电话 - -​ 书架:书架编号,书籍类型 - -​ 图书管理员:图书管理员工号,姓名,年龄,性别 - -​ 系统管理员:系统管理员编号,姓名,年龄,性别 - -​ 图书:图书编号,书名,作者,价格 - -​ 出版社:出版社编号,出版社名 - -​ 读者:学号,姓名,性别,联系电话 - -​ ![image-20230911034830127](https://s2.loli.net/2023/09/11/g63zoXdP4JTHxyS.png) - -![image-20230911035634156](https://s2.loli.net/2023/09/11/DrnxFSBvH9y6Z2t.png) - -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/11 4:12:35 */ -/*==============================================================*/ -CREATE DATABASE tushu charset utf8; -use tushu; - -drop table if exists Books; - -drop table if exists Borrowing; - -drop table if exists administrator; - -drop table if exists bookshelf; - -drop table if exists librarian; - -drop table if exists library; - -drop table if exists publishing; - -drop table if exists reader; - -/*==============================================================*/ -/* Table: Books */ -/*==============================================================*/ - - -create table Books -( - Books_id int not null auto_increment, - publishing_id int not null, - bookshelf_id int not null, - librarian_id char(10) not null, - Books_name char(20) not null, - Books_author char(10) not null, - Books_Price decimal(5,2) not null, - primary key (Books_id) -); - -/*==============================================================*/ -/* Table: Borrowing */ -/*==============================================================*/ -create table Borrowing -( - Books_id int not null, - reader_id char(10) not null, - borrowing_time datetime not null, - borrowing_tim datetime, - primary key (Books_id, reader_id) -); - -/*==============================================================*/ -/* Table: administrator */ -/*==============================================================*/ -create table administrator -( - administrator_id char(10) not null, - administrator_name char(4) not null, - administrator_age char(2) not null, - administrator_sex char(1) not null, - primary key (administrator_id) -); - -/*==============================================================*/ -/* Table: bookshelf */ -/*==============================================================*/ -create table bookshelf -( - bookshelf_id int not null auto_increment, - library_id int not null, - bookshelf_type char(10) not null, - primary key (bookshelf_id) -); - -/*==============================================================*/ -/* Table: librarian */ -/*==============================================================*/ -create table librarian -( - librarian_id char(10) not null, - administrator_id char(10) not null, - librarian_name char(4) not null, - librarian_age char(2) not null, - librarian_sex char(1) not null, - primary key (librarian_id) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - library_id int not null auto_increment, - library_name char(10) not null, - library_add varchar(255) not null, - library_tel char(11) not null, - primary key (library_id) -); - -/*==============================================================*/ -/* Table: publishing */ -/*==============================================================*/ -create table publishing -( - publishing_id int not null auto_increment, - publishing_name char(20) not null, - primary key (publishing_id) -); - -/*==============================================================*/ -/* Table: reader */ -/*==============================================================*/ -create table reader -( - reader_id char(10) not null, - administrator_id char(10) not null, - reader_name char(4) not null, - reader_sex char(1) not null, - reader_tel char(11) not null, - primary key (reader_id) -); - -alter table Books add constraint FK_have foreign key (bookshelf_id) - references bookshelf (bookshelf_id) on delete restrict on update restrict; - -alter table Books add constraint FK_manage foreign key (librarian_id) - references librarian (librarian_id) on delete restrict on update restrict; - -alter table Books add constraint FK_publication foreign key (publishing_id) - references publishing (publishing_id) on delete restrict on update restrict; - -alter table Borrowing add constraint FK_Borrowing foreign key (Books_id) - references Books (Books_id) on delete restrict on update restrict; - -alter table Borrowing add constraint FK_Borrowing2 foreign key (reader_id) - references reader (reader_id) on delete restrict on update restrict; - -alter table bookshelf add constraint FK_possess foreign key (library_id) - references library (library_id) on delete restrict on update restrict; - -alter table librarian add constraint "FK_Manage information" foreign key (administrator_id) - references administrator (administrator_id) on delete restrict on update restrict; - -alter table reader add constraint "FK_Manage reader" foreign key (administrator_id) - references administrator (administrator_id) on delete restrict on update restrict; - - -``` - diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230912 \347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" "b/57 \351\273\204\346\265\201\346\266\233/20230912 \347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index 018567c1911c4ae0bead2cc3b702f927c3bd0e57..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230912 \347\224\265\345\275\261\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,212 +0,0 @@ -# 作业 - -### 电影数据库设计 - -影片(编号,影名,上映时间,片长,评分,剧情简介) -类型表(编号,类型) -制片国家地区表(编号,国家) -语言表(编号,语言) -演员表(编号,姓名,年龄,性别) -影评(编号,评价,标题,正文) -片单(编号,片单名,豆列名,推荐语选填) - -![image-20230912112258740](https://s2.loli.net/2023/09/12/jmYw7k6tUfdEA3R.png) - -![image-20230912112346931](https://s2.loli.net/2023/09/12/MhJpcjiPSkfyFm8.png) - -![image-20230912112441142](https://s2.loli.net/2023/09/12/JTlnI2z4brV75St.png) - -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-12 11:37:46 */ -/*==============================================================*/ -create database dy charset utf8; -use dy; - -drop table if exists actor; - -drop table if exists "add"; - -drop table if exists director; - -drop table if exists film; - -drop table if exists filmily; - -drop table if exists filmreview; - -drop table if exists language; - -drop table if exists scriptwriter; - -drop table if exists sheet; - -drop table if exists staff; - -drop table if exists type; - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - film_id char(10) not null, - staff_id char(5) not null, - primary key (film_id, staff_id) -); - -/*==============================================================*/ -/* Table: "add" */ -/*==============================================================*/ -create table "add" -( - sheet_id int not null, - film_id char(10) not null, - add_time datetime not null, - primary key (sheet_id, film_id) -); - -/*==============================================================*/ -/* Table: director */ -/*==============================================================*/ -create table director -( - film_id char(10) not null, - staff_id char(5) not null, - primary key (film_id, staff_id) -); - -/*==============================================================*/ -/* Table: film */ -/*==============================================================*/ -create table film -( - film_id char(10) not null, - language_id int not null, - filmily_id int not null, - type_id int not null, - film_name varchar(10) not null, - film_date date not null, - film_time int not null, - film_score char(1) not null, - film_introduce varchar(255) not null, - primary key (film_id) -); - -/*==============================================================*/ -/* Table: filmily */ -/*==============================================================*/ -create table filmily -( - filmily_id int not null auto_increment, - filmily_name varchar(20) not null, - primary key (filmily_id) -); - -/*==============================================================*/ -/* Table: filmreview */ -/*==============================================================*/ -create table filmreview -( - filmreview_id int not null auto_increment, - film_id char(10) not null, - filmreview_evaluate char(1) not null, - filmreview_headline varchar(30) not null, - filmreview_text varchar(255) not null, - primary key (filmreview_id) -); - -/*==============================================================*/ -/* Table: language */ -/*==============================================================*/ -create table language -( - language_id int not null auto_increment, - language_name varchar(15) not null, - primary key (language_id) -); - -/*==============================================================*/ -/* Table: scriptwriter */ -/*==============================================================*/ -create table scriptwriter -( - film_id char(10) not null, - staff_id char(5) not null, - primary key (film_id, staff_id) -); - -/*==============================================================*/ -/* Table: sheet */ -/*==============================================================*/ -create table sheet -( - sheet_id int not null auto_increment, - sheet_name char(10) not null, - sheet_column char(10) not null, - sheet_recommend varchar(255), - primary key (sheet_id) -); - -/*==============================================================*/ -/* Table: staff */ -/*==============================================================*/ -create table staff -( - staff_id char(5) not null, - staff_name char(4) not null, - staff_age char(2) not null, - staff_sex char(1) not null, - primary key (staff_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name char(2) not null, - primary key (type_id) -); - -alter table actor add constraint FK_actor foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table actor add constraint FK_actor2 foreign key (staff_id) - references staff (staff_id) on delete restrict on update restrict; - -alter table "add" add constraint FK_add foreign key (sheet_id) - references sheet (sheet_id) on delete restrict on update restrict; - -alter table "add" add constraint FK_add2 foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table director add constraint FK_director foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table director add constraint FK_director2 foreign key (staff_id) - references staff (staff_id) on delete restrict on update restrict; - -alter table film add constraint FK_are foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table film add constraint FK_have foreign key (language_id) - references language (language_id) on delete restrict on update restrict; - -alter table film add constraint FK_make foreign key (filmily_id) - references filmily (filmily_id) on delete restrict on update restrict; - -alter table filmreview add constraint FK_evaluate foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table scriptwriter add constraint FK_scriptwriter2 foreign key (staff_id) - references staff (staff_id) on delete restrict on update restrict; - - -``` - diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230913 \345\214\273\351\231\242\346\225\260\346\215\256\345\272\223.md" "b/57 \351\273\204\346\265\201\346\266\233/20230913 \345\214\273\351\231\242\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index 23aa04653842cc8d19fc4838ccdb9080ead51b9f..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230913 \345\214\273\351\231\242\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,256 +0,0 @@ -# 笔记 - -#### 如果一个主体的属性有多个值,那这个属性就可以拆成一个新主体 - -# 作业 - -### 医院数据库设计 - - 需求分析 - -科室(科室编号,科室名,地址,联系电话) - -病人(病历号,姓名,年龄,性别) - -病房(病房编号,病房名) - -药品(药品编号,药品名称,价格,重量) - -药品分类(分类编号,分类名) - -药房 (药房编号,药房名) - -护士(工号,姓名,年龄,性别) - -![image-20230914011846375](https://s2.loli.net/2023/09/14/JgjkF7sh3MxXiqW.png) - -![image-20230914012312885](https://s2.loli.net/2023/09/14/X89l3YLiEfydJcx.png) - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 1:24:04 */ -/*==============================================================*/ -create database yy charset utf8; -use yy; - -drop table if exists assignment; - -drop table if exists department; - -drop table if exists diagnosis; - -drop table if exists doctor; - -drop table if exists nurse; - -drop table if exists patient; - -drop table if exists pharmaceuticals; - -drop table if exists pharmacy; - -drop table if exists prescription; - -drop table if exists type; - -drop table if exists ward; - -/*==============================================================*/ -/* Table: assignment */ -/*==============================================================*/ -create table assignment -( - ward_id int not null, - nurse_id char(10) not null, - assignment_date date not null, - primary key (ward_id, nurse_id) -); - -/*==============================================================*/ -/* Table: department */ -/*==============================================================*/ -create table department -( - departmen_id int not null auto_increment, - department_name varchar(10) not null, - department_add varchar(50) not null, - department_tel char(11) not null, - primary key (departmen_id) -); - -/*==============================================================*/ -/* Table: diagnosis */ -/*==============================================================*/ -create table diagnosis -( - patient_id char(10) not null, - doctor_id char(10) not null, - diagnosis_name varchar(255) not null, - diagnosis_time datetime not null, - primary key (patient_id, doctor_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id char(10) not null, - departmen_id int not null, - doctor_name varchar(4) not null, - doctor_age char(2) not null, - doctor_sex char(1) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: nurse */ -/*==============================================================*/ -create table nurse -( - nurse_id char(10) not null, - departmen_id int not null, - nurse_name varchar(4) not null, - nurse_age char(2) not null, - nurse_sex char(1) not null, - primary key (nurse_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id char(10) not null, - ward_id int not null, - patient_name varchar(4) not null, - patient_age char(2) not null, - patient_sex char(1) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: pharmaceuticals */ -/*==============================================================*/ -create table pharmaceuticals -( - pharmaceuticals_id int not null auto_increment, - pharmacy_id int not null, - type_id int not null, - pharmaceuticals_name varchar(10) not null, - pharmaceuticals_prrice int not null, - pharmaceuticals_wigat decimal(5,2) not null, - primary key (pharmaceuticals_id) -); - -/*==============================================================*/ -/* Table: pharmacy */ -/*==============================================================*/ -create table pharmacy -( - pharmacy_id int not null auto_increment, - pharmacy_name varchar(10) not null, - primary key (pharmacy_id) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - pharmaceuticals_id int not null, - patient_id char(10) not null, - prescription_say varchar(255) not null, - prescription_time time not null, - primary key (pharmaceuticals_id, patient_id) -); - -/*==============================================================*/ -/* Table: type */ -/*==============================================================*/ -create table type -( - type_id int not null auto_increment, - type_name varchar(3) not null, - primary key (type_id) -); - -/*==============================================================*/ -/* Table: ward */ -/*==============================================================*/ -create table ward -( - ward_id int not null auto_increment, - ward_name varchar(10) not null, - primary key (ward_id) -); - -alter table assignment add constraint FK_assignment foreign key (ward_id) - references ward (ward_id) on delete restrict on update restrict; - -alter table assignment add constraint FK_assignment2 foreign key (nurse_id) - references nurse (nurse_id) on delete restrict on update restrict; - -alter table diagnosis add constraint FK_diagnosis foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table diagnosis add constraint FK_diagnosis2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table doctor add constraint FK_belong foreign key (departmen_id) - references department (departmen_id) on delete restrict on update restrict; - -alter table nurse add constraint FK_belongs foreign key (departmen_id) - references department (departmen_id) on delete restrict on update restrict; - -alter table patient add constraint FK_live foreign key (ward_id) - references ward (ward_id) on delete restrict on update restrict; - -alter table pharmaceuticals add constraint FK_deposit foreign key (pharmacy_id) - references pharmacy (pharmacy_id) on delete restrict on update restrict; - -alter table pharmaceuticals add constraint FK_have foreign key (type_id) - references type (type_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription foreign key (pharmaceuticals_id) - references pharmaceuticals (pharmaceuticals_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription2 foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -#科室 -insert into department values -(1,"内科","2楼","12345678912"),(2,"外科","5楼","23456789123"); -#护士 -insert into nurse values -(101,1,"瓜文成","22","男"),(120,2,"周福","20","女"); -#医生 -insert into doctor values -(1001,1,"时雪安","22","男"),(1002,2,"夜只浩","20","男"); -#病房 -insert into ward values -(1,"一号病房"),(2,"二号病房"); -#病人 -insert into patient values -(10001,1,"时量涛","19","男"),(10002,2,"文贵文","20","女"); -#药品分类 -insert into type values -(1,"中药"),(2,"西药"); -#药房 -insert into pharmacy values -(1,"1号药房"),(2,"2号药房"); -#药品 -insert into pharmaceuticals values -(1,1,1,"安眠药",666,105.22),(2,2,2,"止泻药",888,110.11); -#分配 -insert into assignment values -(1,101,"2023-09-13"),(2,120,"2023-09-12"); -#诊断 -insert into diagnosis values -(10001,1001,"失眠症","2023-09-13 13:22:01"),(10002,1002,"结石","2023-09-12 16:13:11"); -#处方 -insert into prescription values -(1,10001,"注意休息","13:30:22"),(2,10002,"6666666","18:30:30"); -``` - diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230917 \346\261\275\350\275\246\346\225\260\346\215\256\345\272\223.md" "b/57 \351\273\204\346\265\201\346\266\233/20230917 \346\261\275\350\275\246\346\225\260\346\215\256\345\272\223.md" deleted file mode 100644 index b5c9887df697fe7514f4b21243eecc5c41a2ce2a..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230917 \346\261\275\350\275\246\346\225\260\346\215\256\345\272\223.md" +++ /dev/null @@ -1,132 +0,0 @@ -# 作业 - -#### 汽车数据库设计 - -![image-20230917174642173](https://s2.loli.net/2023/09/17/Y83cU6EIzVXPnMf.png) - -![image-20230917174727543](https://s2.loli.net/2023/09/17/FDcMNAhk5mzpC1O.png) - -![image-20230917174802230](https://s2.loli.net/2023/09/17/wSBi3xfduPRZoMh.png) - -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-15 08:43:09 */ -/*==============================================================*/ -create database che charset utf8; -use che; - -drop table if exists car; - -drop table if exists client; - -drop table if exists salesman; - -drop table if exists sell; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - car_name varchar(10) not null, - car_brand varchar(5) not null, - car_price int not null, - primary key (car_id) -); - -/*==============================================================*/ -/* Table: client */ -/*==============================================================*/ -create table client -( - client_id int not null auto_increment, - client_name varchar(4) not null, - client_sex char(1) not null, - primary key (client_id) -); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id char(5) not null, - salesman_name varchar(4) not null, - salesman_age char(2) not null, - primary key (salesman_id) -); - -/*==============================================================*/ -/* Table: sell */ -/*==============================================================*/ -create table sell -( - sell_id int not null auto_increment, - client_id int, - car_id int, - salesman_id char(5), - sell_date date not null, - sell_price int not null, - primary key (sell_id) -); - -alter table sell add constraint FK_car_sell foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table sell add constraint FK_market foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; - -alter table sell add constraint FK_purchase foreign key (client_id) - references client (client_id) on delete restrict on update restrict; - -#汽车 -insert into car values -(1,"RS7","奥迪",900000), -(2,"A6","奥迪",500000), -(3,"E300","奔驰",1000000), -(4,"X5","宝马",600000); -#顾客 -insert into client values -(1,"老王","男"), -(2,"老六","男"), -(3,"翠花","女"); -#销售员 -insert into salesman values -(10001,"小石","男"), -(10002,"小刘","女"), -(10003,"小梁","女"); -#售卖记录 -insert into sell values -(1,1,2,10003,"2023-11-11",666666), -(2,1,4,10003,"2023-11-22",600999), -(3,2,1,10002,"2023-11-16",888888), -(4,2,4,10003,"2023-11-12",500999), -(5,3,3,10001,"2023-11-26",1008611); - - -- 1.查询特定销售员的销售记录 - select * from sell a join salesman b on a.salesman_id=b.salesman_id where salesman_name = "小梁"; - -- 2.查找销售记录中销售价格最高的汽车 - select car.car_name from sell join car on sell.car_id = car.car_id where sell_price = (select max(sell_price) from sell); - -- 3.统计某个销售员的销售总额 - select b.salesman_name,sum(a.sell_price) from sell a join salesman b on a.salesman_id = b.salesman_id where b.salesman_name = "小梁"; - -- 4.根据客户信息查询其购买过的汽车 - select a.client_name 客户,c.car_brand 购买过的汽车 from client a - left join sell b on a.client_id = b.client_id - left join car c on b.car_id = c.car_id; - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - select a.car_brand 品牌,count(car_brand) 销售数量,sum(sell_price) 总销售额 from car a - left join sell b on a.car_id = b.car_id - where car_brand = "宝马"; - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - select a.car_brand 品牌,b.sell_date 销售历史 from car a - left join sell b on a.car_id = b.car_id - where car_brand = "宝马"; - -- 8.统计每个销售员的销售数量 - select a.salesman_name 销售员,count(b.salesman_id) 销售数量 from salesman a - left join sell b on a.salesman_id = b.salesman_id group by salesman_name; - -``` - diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230919 MySQL\345\244\215\344\271\240.md" "b/57 \351\273\204\346\265\201\346\266\233/20230919 MySQL\345\244\215\344\271\240.md" deleted file mode 100644 index a08e7d1cdda92e8ee393bec5b6f0addf75f6ee2d..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230919 MySQL\345\244\215\344\271\240.md" +++ /dev/null @@ -1,801 +0,0 @@ -# 作业 - -### 题目 - -``` mysql -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - -create database zz charset utf8; -use zz; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - -``` - -# 查询 - -``` mysql - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 - -#理解1:计算12月的基本工资 -select sum(salary*12) from employees; -#理解2:计算12月的基本工资和奖金 -select sum((salary*12)+(salary * 12 * ifnull (commission_pct,0))) from employees; -# 2.查询employees表中去除重复的job_id以后的数据 -select distinct job_id from employees; - -# 3.查询工资大于12000的员工姓名和工资 -select first_name,salary from employees where salary > 12000; - -# 4.查询员工号为176的员工的姓名和部门号 -select first_name,department_id from employees where employee_id = "176"; - -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 - -select first_name,salary from employees where salary not between 5000 and 12000; - -# 2.选择在20或50号部门工作的员工姓名和部门号 -select first_name,department_id from employees where department_id in (20,50); - -# 3.选择公司中没有管理者的员工姓名及job_id -select first_name,job_id from employees where manager_id is null; - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 - -select first_name,salary,commission_pct from employees where commission_pct is not null; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 - -select first_name from employees where first_name like "__尔"; - -# 6.选择姓名中有 特 字和 尔 字的员工姓名 - -select * from employees where last_name like "%特%" and last_name like "%尔%"; - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 - -select * from employees where first_name like "%尔"; - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 - -select first_name,job_id from employees where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id - -select first_name,salary,manager_id from employees where manager_id in (100,101,110); - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 --- order by 年薪 asc/desc -select first_name,department_id,salary*12 nx from employees order by nx desc; - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select first_name,salary from employees where salary not between 8000 and 17000 order by salary desc limit 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 - -select * from employees where email like "%e%" order by length(email) desc , department_id; - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 - -select first_name,a.department_id,b.department_name from employees a join departments b on a.department_id = b.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id - -select a.job_id,b.location_id from employees a -join departments b on a.department_id = b.department_id -where a.department_id = "90"; - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select a.last_name,b.department_id,b.location_id,c.city from employees a -join departments b on a.department_id = b.department_id -join locations c on b.location_id = c.location_id -where commission_pct is not null; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name - -select a.last_name,a.job_id,a.department_id,b.department_name from employees a -join departments b on a.department_id = b.department_id -join locations c on b.location_id = c.location_id -where c.city = "多伦多"; - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 - - -select department_name 部门名称, city 部门地址, e.last_name 姓名, j.job_title 工作, e.salary 工资 -from employees e,departments d,locations l,jobs j -where e.department_id=d.department_id -and d.location_id=l.location_id -and j.job_id=e.job_id; - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select a.first_name,a.department_id,b.manager_id,b.first_name from employees a join employees b on a.department_id = b.department_id; - -# 7.查询哪些部门没有员工 - -select * from employees where department_id is NULL; - -# 8. 查询哪个城市没有部门 - -select * from locations where state_province is null; - -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 - -select * from employees e -join departments d on e.department_id = d.department_id -where d.department_name like '销售部' or d.department_name like '信息技术部'; - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary),min(salary),avg(salary),sum(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 - - -select job_id,max(salary),min(salary),avg(salary),sum(salary) from employees group by job_id; -#4.选择各个job_id的员工人数 - -# 5.查询员工最高工资和最低工资的差距 - -select max(salary)-min(salary) from employees; - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - -select manager_id,min(salary) from employees -where salary > 6000 -group by manager_id -having manager_id is not null; - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 - -select count(a.department_id) 员工数量,avg(a.salary) 平均工资 from employees a -join departments b on a.department_id = b.department_id -group by location_id -order by 平均工资 desc - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - - -select min(a.salary) 最低工资,a.job_id 工种,c.job_title 工种名 from employees a -join departments b on a.department_id = b.department_id -join jobs c on a.job_id = c.job_id -group by a.job_id - - -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 - - -select last_name,salary from employees where department_id = (select department_id from employees where last_name = "兹洛特基"); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 - -select employee_id,last_name,salary from employees where salary > (select avg(salary) from employees) - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name,job_id,salary from employees where salary > (select min(salary) from employees where job_id = "sa_man") - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - -## 姓名中文 X -select employee_id,last_name from where department_id = (select department_id from employees where last_name like "%u%") - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -select a.employee_id 员工号 from employees a -join departments b on a.department_id = b.department_id -join locations c on b.location_id = c.location_id -where b.location_id = (select location_id from locations where location_id = 1700) - - - -#6.查询管理者是 金 的员工姓名和工资 -select last_name,salary from employees where manager_id = (select employee_id from employees where last_name = "金" and manager_id is null); - - -#7.查询工资最低的员工信息: last_name, salary - - -select last_name,salary from employees where salary = (select min(salary) from employees); - -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 -#方式2: -# 部门平均<= 公司所有平均 - - - -select b.* from employees a -join departments b on a.department_id = b. department_id -where b.department_id = (select department_id from employees group by department_id order by avg(salary) limit 0,1); - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 - --- 平均工资最低的部门 -select b.* from employees a -join departments b on a.department_id = b. department_id -where b.department_id = (select department_id from employees group by department_id order by avg(salary) limit 0,1); --- 该部门平均工资 -select department_id,avg(salary) from employees group by department_id order by avg(salary) limit 0,1 - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - -select b.* from employees a -join jobs b on a.job_id = b.job_id -where a.salary > (select avg(salary) from employees) -limit 0,1; - - - -#11.查询平均工资高于公司平均工资的部门有哪些? - - -select b.department_name,avg(salary) 平均工资 from employees a -join departments b on a.department_id = b.department_id -group by b.department_name -having 平均工资>(select avg(salary) from employees); - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 - -select distinct a.manager_id from employees a -join employees b on a.employee_id = b.employee_id -where a.manager_id is not null - - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - - - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - - - -#方式: - - - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - -select avg(salary) from employees -group by department_id -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - - - - - -#16. 选择所有没有管理者的员工的last_name - - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: - - -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - -select department_name from departments a join -(select count(department_id) 人数 from employees group by department_id having 人数>5) b - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -select a.country_name,count(country_name) 个数 from countries a -left join locations b on a.country_id = b.country_id -left join departments c on b.location_id = c.location_id -GROUP BY country_name -HAVING 个数 > 2 - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ - - - - -``` - diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230920 RBAC.md" "b/57 \351\273\204\346\265\201\346\266\233/20230920 RBAC.md" deleted file mode 100644 index 5d97240346d7f967465e9552e04a4b0b47463192..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230920 RBAC.md" +++ /dev/null @@ -1,293 +0,0 @@ -# 笔记 - -### RBAC (Role-Based Access Control) - -​ 基于角色的权限访问控制 - -​ 数据库能存:1.业务数据表 2.功能资源表 - -##### 权限的使用场景 - -1.菜单权限:不同的用户登录系统后,展现的菜单不一样 - -2.按钮权限:不同用户查看同一个对象时,展现的按钮不一样 - -3.数据权限:不同用户查看同一个对象时,可见的数据不一样 - -4.操作权限:能看到,但是操作不了 - - - -#### 基于角色的权限访问控制模型RBAC,目前权限控制的主流方案 - -![2023-09-20_172842](https://s2.loli.net/2023/09/20/JmiZG6XfqwIV85B.png) - -![2023-09-20_172929](https://s2.loli.net/2023/09/20/4TJD8Sx2vQwcoKU.png) - -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-20 15:24:03 */ -/*==============================================================*/ -create database tt charset utf8; -use tt; - -drop table if exists limits; - -drop table if exists role; - -drop table if exists role_limits; - -drop table if exists user; - -drop table if exists user_role; - -/*==============================================================*/ -/* Table: limits */ -/*==============================================================*/ -create table limits -( - limits_id int not null auto_increment, - limits_name varchar(20) not null, - limits_add varchar(255) not null, - primary key (limits_id) -); - -/*==============================================================*/ -/* Table: role */ -/*==============================================================*/ -create table role -( - role_id int not null auto_increment, - role_name varchar(5) not null, - primary key (role_id) -); - -/*==============================================================*/ -/* Table: role_limits */ -/*==============================================================*/ -create table role_limits -( - limits_id int not null, - role_id int not null, - primary key (limits_id, role_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id int not null auto_increment, - user_name varchar(20) not null, - user_pwd varchar(20) not null, - primary key (user_id) -); - -/*==============================================================*/ -/* Table: user_role */ -/*==============================================================*/ -create table user_role -( - role_id int not null, - user_id int not null, - primary key (role_id, user_id) -); - -alter table role_limits add constraint FK_role_limits foreign key (limits_id) - references limits (limits_id) on delete restrict on update restrict; - -alter table role_limits add constraint FK_role_limits2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - -alter table user_role add constraint FK_user_role2 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - - -insert into `user` values -(1,"张三","11111111"), -(2,"李四","22222222"), -(3,"王五","33333333"), -(4,"赵六","44444444"), -(5,"沈七","55555555"); - -insert into role values -(1,"超级会员"), -(2,"会员"), -(3,"普通用户"); - -insert into limits values -(1,"HDR画质杜比音效","666666"), -(2,"vip电影","666"), -(3,"免费电影","222"); - -insert into user_role values -(2,1), -(1,2), -(1,3), -(3,4), -(2,5); - -insert into role_limits values -(1,1), -(2,1), -(3,1), -(2,2), -(3,2), -(3,3); - -select a.user_name,e.limits_name from `user` a ,user_role b ,role c ,role_limits d ,limits e -where a.user_id= b.user_id -and b.role_id = c.role_id -and c.role_id= d.role_id -and d.limits_id = e.limits_id -and a.user_name = "张三" and a.user_pwd = "11111111"; - - -select a.user_name,e.limits_name from `user` a ,user_role b ,role c ,role_limits d ,limits e -where a.user_id= b.user_id -and b.role_id = c.role_id -and c.role_id= d.role_id -and d.limits_id = e.limits_id -and a.user_name = "李四" and a.user_pwd = "22222222"; - -select a.user_name,e.limits_name from `user` a ,user_role b ,role c ,role_limits d ,limits e -where a.user_id= b.user_id -and b.role_id = c.role_id -and c.role_id= d.role_id -and d.limits_id = e.limits_id -and a.user_name = "王五" and a.user_pwd = "33333333"; - -select a.user_name,e.limits_name from `user` a ,user_role b ,role c ,role_limits d ,limits e -where a.user_id= b.user_id -and b.role_id = c.role_id -and c.role_id= d.role_id -and d.limits_id = e.limits_id -and a.user_name = "赵六" and a.user_pwd = "44444444"; - -select a.user_name,e.limits_name from `user` a ,user_role b ,role c ,role_limits d ,limits e -where a.user_id= b.user_id -and b.role_id = c.role_id -and c.role_id= d.role_id -and d.limits_id = e.limits_id -and a.user_name = "沈七" and a.user_pwd = "55555555"; -``` - - - -## SKU预习 - -​ **spu** 指的是商品,spu 属性就是不会影响到库存和价格的属性,又叫**关键属性**,与商品是一对一的关系 - -​ **sku** 指的是具体规格单品,sku 属性就是会影响到库存和价格的属性,又叫**销售属性**,与商品是多对一的关系 - -#### 业务逻辑 - -1. 同一商品不同 SKU 库存和售价不同. - -2. 不同类型的商品具有不同的属性名和属性值 (如汽车和服饰), 所以属性需要支持后期添加和维护. - -3. 在某个商品分类下通过属性筛选商品. - -4. 商家某件商品的销量统计,该件商品内几个不同 SKU 的销量统计. - -5. 更多… - -##### 表设计 - -商品表 -(商品编号, 商品名称, 商品分类编号, 卖家编号, SPU销量, 评论数) - -(1, '裤子名', 2, 1, 0, 3) - -(2, '外套名', 3, 1, 0, 5) - -(3, '内裤名', 4, 1, 0, 2) - -(4, '袜子名', 5, 1, 0, 3) - -分类表 -(商品分类编号, 分类名称, 父分类编号) - -(1, 男装, 0) - -(2, 裤子, 1) - -(3, 外套, 1) - -(4, 内裤, 1) - -(5, 袜子, 1) - -SKU 表 (库存表) -(SKU编号, 商品编号, SKU属性, 价格, 库存, SKU销量) - -(1, 1, [1:1,2:3], 99, 400, 0) //其中 [1:1,2:3] 表示 "颜色为黑色,尺码为X" - -(2, 1, [1:1,2:4], 99, 200, 0) //其中 [1:1,2:4] 表示 "颜色为黑色,尺码为XL" - -(3, 1, [1:2,2:3], 99, 300, 0) //其中 [1:2,2:3] 表示 "颜色为白色,尺码为X" - -(4, 1, [1:2,2:4], 99, 100, 0) //其中 [1:2,2:4] 表示 "颜色为白色,尺码为XL" - -上面只列出商品1这个分类的4个SKU. - -属性名表 -(属性名编号, 属性名, 商品分类编号, 父属性编号) - -(1, 颜色, 2, 0) - -(2, 尺码, 2, 0) - -(3, 品牌, 2, 0) - -上面只列出裤子这个分类的3个属性名. - -属性值表 -(属性值编号, 属性值, 属性名编号) - -(1, 黑色, 1) - -(2, 白色, 1) - -(3, X, 2) - -(4, XL, 2) - -(5, 七匹狼, 3) - -(6, 九牧王, 3) - -上面只列出裤子这个分类的6个属性值. - -商品和属性关系表 -(自增编号, 商品编号, 属性名编号, 属性值编号) - -(1, 1, 1, 1) 商品1颜色为黑色 - -(2, 1, 1, 2) 商品1颜色为白色 - -(3, 1, 2, 3) 商品1尺码为X - -(4, 1, 2, 4) 商品1尺码为XL - - - -#### SPU和SKU数据库的设计原则 - -在进行SPU和SKU数据库的设计前,需要明确设计原则,以确保数据库的稳定性和可维护性。设计原则如下: - -1.合理划分字段和表结构 - -SPU和SKU的统一属性和可售卖属性在数据库中是通过表和字段进行表达的。需要合理设计表结构和字段,以避免冗余和不必要的数据存储。具体而言,可以将SPU和SKU的基本信息和统一属性信息存储在一个主表中,将SKU的可售卖属性信息存储在一个单独的子表中。这样可以有效地降低数据冗余,提高数据库性能。 - -2.规范数据类型和长度 - -在进行数据库设计时,应该规范数据类型和长度,以避免数据类型不匹配、长度超限等问题。尤其是在进行SKU的属性管理时,应该考虑到属性的分类、数据类型和长度等,否则可能会造成混乱和不必要的麻烦。因此,建议在数据库设计时,应该设计统一的数据类型和长度。 - -3.合理设置索引和约束 - -在进行数据库设计时,应该合理设置索引和约束,以便于优化查询性能和保障数据完整性。具体来说,可以为SPU和SKU的关键字段设置主键和外键约束,以避免数据逻辑上的混乱和不匹配。同时,也可以设计适当的索引,以提高查询性能。 \ No newline at end of file diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230921 SKU.md" "b/57 \351\273\204\346\265\201\346\266\233/20230921 SKU.md" deleted file mode 100644 index c7b9807c820974fc4e2027a81178aa0ec664c133..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230921 SKU.md" +++ /dev/null @@ -1,169 +0,0 @@ -# SKU - -​ spu(商品) - -​ sku(规格) 有多个属性 属性有属性的值 - -# 作业 - -![image-20230921171616768](https://s2.loli.net/2023/09/21/jKpglhnLx3fyGk2.png) - -![image-20230921171642677](https://s2.loli.net/2023/09/21/PIkJZ6oxhrRT2Xp.png) - -![image-20230921171655030](https://s2.loli.net/2023/09/21/Ew8QvrnI2pZ7Sls.png) - -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:17:57 */ -/*==============================================================*/ -create database jd charset utf8; -use jd; - -drop table if exists attribute; - -drop table if exists attribute_value; - -drop table if exists rele; - -drop table if exists sku; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table attribute -( - attribute_id int not null auto_increment, - attribute_name varchar(10) not null, - primary key (attribute_id) -); - -/*==============================================================*/ -/* Table: attribute_value */ -/*==============================================================*/ -create table attribute_value -( - value_id int not null auto_increment, - value_content varchar(50) not null, - primary key (value_id) -); - -/*==============================================================*/ -/* Table: rele */ -/*==============================================================*/ -create table rele -( - rele_id int not null auto_increment, - sku_id int, - attribute_id int, - value_id int, - primary key (rele_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price decimal(9,2) not null, - sku_stock int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(10) not null, - spu_test varchar(100) not null, - primary key (spu_id) -); - -alter table rele add constraint FK_attribute_rele foreign key (attribute_id) - references attribute (attribute_id) on delete restrict on update restrict; - -alter table rele add constraint FK_sku_rele foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table rele add constraint FK_value_rele foreign key (value_id) - references attribute_value (value_id) on delete restrict on update restrict; - -alter table sku add constraint FK_spu_sku foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - --- 商品 -insert into spu values (1,"iphone15","上岛"); - --- 规格 -insert into sku values -(1,1,"iphone15 黑色 256G",6999,66), -(2,1,"iphone15 白色 256G",6999,666), -(3,1,"iphone15 蓝色 256G",6999,0), -(4,1,"iPhone15 黑色 512G",7999,1), -(5,1,"iphone15 白色 512G",7999,2), -(6,1,"iphone15 蓝色 512G",7999,10); - --- 属性 -insert into attribute values -(1,"颜色"), -(2,"内存"); - --- 属性值 -insert into attribute_value values -(1,"黑色"), -(2,"白色"), -(3,"蓝色"), -(4,"256G"), -(5,"512G"); - --- 关联 -insert into rele values -(1,1,1,1), -(2,1,2,4), -(3,2,1,2), -(4,2,2,4), -(5,3,1,3), -(6,3,2,4), -(7,4,1,1), -(8,4,2,5), -(9,5,1,2), -(10,5,2,5), -(11,6,1,3), -(12,6,2,5); - --- 查询 -select a.spu_id,b.sku_id,b.sku_name,b.sku_price,b.sku_stock from - spu a,sku b,attribute c,attribute_value d,rele e -where -a.spu_id = b.spu_id -and b.sku_id = e.sku_id -and c.attribute_id = e.attribute_id -and d.value_id = e.value_id -and b.sku_id = "2"; - - --- 查询2 -select a.spu_id,b.sku_id,b.sku_name,b.sku_price,b.sku_stock from - spu a,sku b,attribute c,attribute_value d,rele e -where -a.spu_id = b.spu_id -and b.sku_id = e.sku_id -and c.attribute_id = e.attribute_id -and d.value_id = e.value_id -and b.sku_id = -( -select aa.sku_id from -(select sku_id from attribute, attribute_value , rele where attribute.attribute_id =rele.attribute_id and attribute_value.value_id = rele.value_id and value_content = "白色" ) aa -, -(select sku_id from attribute, attribute_value , rele where attribute.attribute_id =rele.attribute_id and attribute_value.value_id = rele.value_id and value_content = "256G" ) bb -where aa.sku_id = bb.sku_id -); -``` - diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230922 SKU\345\244\215\344\271\240\347\214\252\347\214\252.md" "b/57 \351\273\204\346\265\201\346\266\233/20230922 SKU\345\244\215\344\271\240\347\214\252\347\214\252.md" deleted file mode 100644 index 267d2ce709b016daec7c616e6bfe808c19e71bd7..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230922 SKU\345\244\215\344\271\240\347\214\252\347\214\252.md" +++ /dev/null @@ -1,123 +0,0 @@ -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-22 09:09:19 */ -/*==============================================================*/ -create database tt charset utf8; -use tt; - -drop table if exists attributes; - -drop table if exists attributes_values; - -drop table if exists rele; - -drop table if exists sku; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_id int not null auto_increment, - attributes_name varchar(10) not null, - primary key (attributes_id) -); - -/*==============================================================*/ -/* Table: attributes_values */ -/*==============================================================*/ -create table attributes_values -( - values_id int not null auto_increment, - values_test varchar(20) not null, - primary key (values_id) -); - -/*==============================================================*/ -/* Table: rele */ -/*==============================================================*/ -create table rele -( - rele_id int not null auto_increment, - sku_id int, - attributes_id int, - values_id int, - primary key (rele_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price decimal(6,2) not null, - sku_add varchar(20) not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(20) not null, - spu_text varchar(255) not null, - primary key (spu_id) -); - -alter table rele add constraint FK_attributes_rele foreign key (attributes_id) - references attributes (attributes_id) on delete restrict on update restrict; - -alter table rele add constraint FK_sku_rele foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table rele add constraint FK_values_rele foreign key (values_id) - references attributes_values (values_id) on delete restrict on update restrict; - -alter table sku add constraint FK_spu_sku foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -# 查询1 -select a.spu_id,b.sku_id,b.sku_name,b.sku_price,b.sku_add - from spu a,sku b,attributes c,attributes_values d,rele e -where - a.spu_id = b.spu_id - and b.sku_id = e.sku_id - and c.attributes_id = e.attributes_id - and d.values_id = e.values_id ; - -# 查询2 -select a.spu_id,b.sku_id,b.sku_name,b.sku_price,b.sku_add -from spu a,sku b,attributes c,attributes_values d,rele e -where - a.spu_id = b.spu_id - and b.sku_id = e.sku_id - and c.attributes_id = e.attributes_id - and d.values_id = e.values_id -and b.sku_id = -( -select aa.sku_id from -(select sku_id from attributes, attributes_values , rele where attributes.attributes_id =rele.attributes_id and attributes_values.values_id = rele.values_id and values_test = "黑猪" ) aa -, -(select sku_id from attributes, attributes_values , rele where attributes.attributes_id =rele.attributes_id and attributes_values.values_id = rele.values_id and values_test = "200g" ) bb -, -(select sku_id from attributes, attributes_values , rele where attributes.attributes_id =rele.attributes_id and attributes_values.values_id = rele.values_id and values_test = "1包" ) cc -where aa.sku_id = bb.sku_id -and bb.sku_id = cc.sku_id -); - -``` - -![image-20230924163547326](https://s2.loli.net/2023/09/24/Z2dPCAgzaEhxJ9D.png) - -![image-20230924163617602](https://s2.loli.net/2023/09/24/skBJgn37QxUcXWV.png) - -![image-20230924163634393](https://s2.loli.net/2023/09/24/YIxF2dmAqj751Zl.png) - diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230924 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" "b/57 \351\273\204\346\265\201\346\266\233/20230924 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" deleted file mode 100644 index 74c815d4708d4160edd09dae53af427e18a5b90c..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230924 \346\225\260\346\215\256\345\272\223\351\253\230\347\272\247\351\242\204\344\271\240.md" +++ /dev/null @@ -1,45 +0,0 @@ -# 数据库高级(预习) - -#### 1.事务 - -​ 为了完成某个业务而对数据库进行一系列操作,这些操作要么全部成功,要么全部失败。 - -#### 事务的四个特性 - -​ 1.原子性:事务包含的这一系列操作,要么全部成功,要么全部失败 - -​ 2.一致性:事务完成之后,不会将非法的数据写入数据库。 - -​ 3.隔离性:多个事务可以在一定程度上并发执行 - -​ 4.持久性:事务完成之后,数据要永久保存 - -#### 2.视图 - -​ 在已有的表或者视图上创建的虚拟表 - -​ 创建视图: create view 视图名 asselect - -​ 可以对(单表)视图进行一些增删改查的操作,这些操作会影响到原始的表 - -​ 删除视图:drop view 视图名 - -#### 3.索引 - -​ 为了提高查询的速度而在数据库断创建的一种排序的数据结构 - -#### 4.储存过程 - -​ 存储在数据库端的一组为了完成特点功能的sql语句 - -​ 存储过程:create procedure 存储过程名(【参数】) - -​ 参数格式(参数类型 参数名 数据类型) - -​ 参数类型有三种 - -​ IN:输入参数,改参数的值必须在调用该存储过程时指定,在存储过程内部使用,不能返回。缺省值是IN - -​ OUT:输出参数,该参数值的值可以在存储过程内部修改,并可返回。 - -​ INOUT:输入输出参数,该参数需要在调用时指定,并且可以返回 \ No newline at end of file diff --git "a/57 \351\273\204\346\265\201\346\266\233/20230926 check\347\272\246\346\235\237\344\270\216\350\247\206\345\233\276.md" "b/57 \351\273\204\346\265\201\346\266\233/20230926 check\347\272\246\346\235\237\344\270\216\350\247\206\345\233\276.md" deleted file mode 100644 index 15c72f10a9f81b180eb93ac6948557921c412997..0000000000000000000000000000000000000000 --- "a/57 \351\273\204\346\265\201\346\266\233/20230926 check\347\272\246\346\235\237\344\270\216\350\247\206\345\233\276.md" +++ /dev/null @@ -1,339 +0,0 @@ -# 笔记 - -### check约束(检查约束) - -​ 检查某个字段的值是否符合要求,一般指的是值的范围 - -​ 语法: check (表达式) 例:check(字段名 in ('男','女')) - -##### utf8中,一个汉字是一个字符,等于3个字节,使用 length()函数时注意 - - - -## 视图 - -​ 视图是一种虚拟表,本身不具有数据,占很小的内存空间 - -​ 视图建立在已有表的基础上,视图赖以建立的这些表称为基表 - -视图的优点:1.操作简单 2.减少数据冗余 3.数据安全 4.适应灵活多变的需求 - -```mysql -## 语法 - -- 创建视图 - create view 视图名称 as - create view 名称(1,2,3,4) as (小括号内字段个数与select中字段个数相同) - -- 查看视图 - show create view 视图名称; - -- 修改视图 - 1. create or replace view 名称 as (有就更新,没有就创建) - 2. alter view 名称 as (要存在才能修改) - -- 删除视图 - drop view (if exists) 视图名称 -``` - -##### 基于视图建视图,建好一个视图后,在视图基础上还可以在建一个 - -##### 函数:concat() 将字段名的内容拼接到一起 - -# 作业 - -``` mysql - -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db -********************************************************************* -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -``` - -``` mysql -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) -create view employee_vu as -select last_name 姓名,employee_id 员工号,department_id 部门号 from employees; - - -#2. 显示视图的结构 -show create view employee_vu; - -#3. 查询视图中的全部内容 -select * from employee_vu; - -#4. 将视图中的数据限定在部门号是80的范围内 -select * from employee_vu where 部门号 = 80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -create view emp_v1(员工姓名,工资,邮箱) as -select last_name,salary,email from employees where phone_number like "011%"; - - -select * from emp_v1; -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 - -alter view emp_v1 as -select last_name 姓名,email 邮箱,phone_number 电话号码,salary 工资 from employees where phone_number like "011%" and email like "%e%"; - -select * from emp_v1; -#3. 向 emp_v1 插入一条记录,是否可以? - --- 可以 - -#4. 修改emp_v1中员工的工资,每人涨薪1000 - -update emp_v1 set 工资 = 工资 + 1000; - -#5. 删除emp_v1中姓名为Olsen的员工 - -delete from emp_v1 where 姓名 = "Olsen"; - -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 - -create view emp_v2 as -select b.department_id 部门id,max(a.salary) 最高工资 from employees a,departments b where a.department_id = b.department_id and salary > 12000 group BY b.department_id; - -select * from emp_v2; -#7. 向 emp_v2 中插入一条记录,是否可以? - -insert into emp_v2 values (60,66666); - --- 不可以 - -#8. 删除刚才的emp_v2 和 emp_v1 - -drop view emp_v2,emp_v1; -``` - diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-05.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-05.md" deleted file mode 100644 index a0d045846fe3cee42b5cf7d8a89b731e96396758..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-05.md" +++ /dev/null @@ -1,20 +0,0 @@ -1. 未来学习计划 - -2. 辅助/自学的工具 - - ​ 1.github全球正版 - - ​ 2.gitee中国式版本 - - ​ 3.csdn - - ​ 4.bilibili - -3. 技术栈与技能树的含义 - - 1.技术栈:指的是实现一个软件的功能所需要的技术 - - 2.技能数:指的是一个人所掌握的技能 - - - diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-06.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-06.md" deleted file mode 100644 index c946e04d154cf9819c0a450651df3f9d4c6d919e..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-06.md" +++ /dev/null @@ -1,119 +0,0 @@ -## 笔记: - -##### 一.数据库设计: - -​ 1.表与表之间的关系 - -​ 多对多:引入第三张表 - -​ 一对多:主键放入多的表当外键 - -​ 一对一:将一个表的主键放入另一个表当外键 - -​ 2.E-R图 - -​ 实体(表) - -​ 属性(字段) - -​ 关系(联系) - -```mysql -create database school character set utf8; -use school; -#院系表 -create table department -( - department_id int auto_increment primary key, #学院编号 - department_name varchar(50) not null #学院名字 -); -insert into department -values (null, '软件工程学院'); -#专业表 -create table major -( - major_id int auto_increment primary key, #专业编号 - major_name varchar(20) not null, #专业名称 - department_id int, #所属学院编号 - constraint foreign key (department_id) references department (department_id) -); -insert into major -values (null, '软件技术', 1), - (null, '新媒体运营', 1); -#班级表 -create table grade -( - grade_id int auto_increment primary key, #班级编号 - grade_name varchar(20) not null, #班级名字 - major_id int not null, #所属专业编号 - constraint foreign key (major_id) references major (major_id) -); -insert into grade -values (null, '软件技术1班', 1), - (null, '软件技术2班', 1), - (null, '新媒体运营1班', 2); - -#学生表 -create table student -( - student_id int, #学生编号 - student_name varchar(20), #学生名字 - student_age int, #学生年龄 - student_number int primary key, #学生学号 - grade_id int, #所属班级编号 - constraint foreign key (grade_id) references grade (grade_id) -); -insert into student -values (1, 'kaixin', 20, 2044010111, 1), - (2, 'tianxin', 20, 2044010112, 1), - (3, 'xiaoxin', 21, 2044010123, 2); -#教师表 -create table teacher -( - teacher_num int not null primary key, #教师工号 - teacher_name varchar(20) not null, #教师姓名 - teacher_age int null #教师年龄 -); -insert into teacher -values (0001, '张老师', 40), - (0002, '李老师', 35); -#课程 -create table course -( - course_id int auto_increment primary key, #课程编号 - course_name varchar(20) not null, #课程名字 - teacher_number int, #教师工号 - constraint foreign key (teacher_number) references teacher (teacher_num) -); -insert into course -values (1, 'mysql', 0001), - (2, 'java', 0002); -#成绩表 -create table score -( - course_id int, # 课程编号 - score_number int, #成绩 - student_number int, #学号 - constraint foreign key (student_number) references student (student_number), - constraint foreign key (course_id) references course (course_id) -); -insert into score -values (1, 89, 2044010111), - (2, 78, 2044010111), - (1, 61, 2044010112), - (2, 77, 2044010112), - (1, 93, 2044010123), - (2, 88, 2044010123); -#课程表 -create table course_table -( - course_table_id int, #课程表编号 - course_name varchar(20), #课程名字 - course_date date, #课程日期 - course_time time, #课程时间 - site varchar(20), #地点 - constraint foreign key (course_table_id) references grade (grade_id) -); -insert into course_table -values (1, 'mysql', 20230901, 14 - 00 - 00, '教学楼xx房间'); -``` \ No newline at end of file diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-07.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-07.md" deleted file mode 100644 index 5d41b1eb27645eb003b1a5e69706838c73fd88c4..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-07.md" +++ /dev/null @@ -1,9 +0,0 @@ -1. Typora图床配置 - -2. 数据库的范式 - - 1:第一范式:原子性,字段内容不可再分割 - - 2:第二范式:要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键,要依赖整个联合主键)而不能只依赖部分。 - - 3:第三范式:满足第二范式的前提下,非主键属性要直接依赖主键 \ No newline at end of file diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-08.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-08.md" deleted file mode 100644 index ab76e8a395040241708cf816a86cb272bb32e9a9..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-08.md" +++ /dev/null @@ -1,112 +0,0 @@ -笔记: - -1:powerDesigner: - -​ 第一步:创建概念模型(类似ER图) CDM (用户角度) - -​ 第二步:转换成逻辑模型 LDM (计算机角度) - -​ 第三步:转换成物理模型 PDM (数据库角度) - -​ 第四步:生成DDL - -2:数据库设计步骤: - -​ 1.需求分析,了解要开发的系统的需求,明确数据和格式 - -​ 2.概念结构设计:将需求分析得到的抽象成概念模型,将ER图向关系模型转化 - -​ 3.逻辑结构设计:将概念结构转化成DBMS所支持的数据模型 - -​ 4.物理结构设计:将概念模型,转换成选定数据库管理系统需要的物理模型 - -​ 5.数据库实施:根据物理模型生成对应的DDL - -​ 6.数据库维护 - -```mysql -drop table if exists` book; - -drop table if exists holding; - -drop table if exists library; - -drop table if exists record; - -drop table if exists student; - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - bk_id decimal not null, - bk_name char(20) not null, - bk_author char(10) not null, - ISBN int not null, - bk_date date not null, - bk_sort char(10) not null, - primary key (bk_id) -); - -/*==============================================================*/ -/* Table: holding */ -/*==============================================================*/ -create table holding -( - bk_id decimal not null, - lb_id decimal not null, - hd_id decimal not null, - primary key (bk_id, lb_id, hd_id) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - lb_id decimal not null, - lb_name char(10) not null, - lb_address char(20) not null, - primary key (lb_id) -); - -/*==============================================================*/ -/* Table: record */ -/*==============================================================*/ -create table record -( - bk_id decimal not null, - stu_id decimal not null, - rc_id decimal not null, - primary key (bk_id, stu_id, rc_id) -); - -/*==============================================================*/ -/* Table: student */ -/*==============================================================*/ -create table student -( - stu_id decimal not null, - lb_id decimal not null, - stu_name char(10) not null, - stu_tel varchar(11) not null, - stu_address varchar(30) not null, - primary key (stu_id) -); - -alter table holding add constraint FK_Relationship_3 foreign key (bk_id) - references book (bk_id) on delete restrict on update restrict; - -alter table holding add constraint FK_Relationship_3 foreign key (lb_id) - references library (lb_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_1 foreign key (bk_id) - references book (bk_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_1 foreign key (stu_id) - references student (stu_id) on delete restrict on update restrict; - -alter table student add constraint FK_Relationship_2 foreign key (lb_id) - references library (lb_id) on delete restrict on update restrict; -``` \ No newline at end of file diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-12.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-12.md" deleted file mode 100644 index 1e7707dea56e22eb516743bb9e6f690cfc85e0ba..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-12.md" +++ /dev/null @@ -1,137 +0,0 @@ -![屏幕截图 2023-09-12 225416](C:\Users\陈胜杰\Pictures\Screenshots\屏幕截图 2023-09-12 225416.png) - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/12 22:48:17 */ -/*==============================================================*/ -create DATABASE movie character set utf8; -use movie; - -drop table if exists act_in; - -drop table if exists actor; - -drop table if exists discuss; - -drop table if exists file_review; - -drop table if exists film; - -drop table if exists phrase; - -drop table if exists user; - -/*==============================================================*/ -/* Table: act_in */ -/*==============================================================*/ -create table act_in -( - ac_id decimal not null, - film_id decimal not null, - primary key (ac_id, film_id) -); - -/*==============================================================*/ -/* Table: actor */ -/*==============================================================*/ -create table actor -( - ac_id decimal not null, - ac_name varchar(20) not null, - ac_english_name varchar(20) not null, - imb varchar(20) not null, - ְac_work varchar(10) not null, - ac_sex char(1) not null, - ac_intro text not null, - ac_head_portrait varchar(100) not null, - primary key (ac_id) -); - -/*==============================================================*/ -/* Table: discuss */ -/*==============================================================*/ -create table discuss -( - user_id decimal not null, - film_id decimal not null, - ds_headline varchar(30) not null, - ds_discuss varchar(300) not null, - primary key (user_id, film_id) -); - -/*==============================================================*/ -/* Table: file_review */ -/*==============================================================*/ -create table file_review -( - user_id decimal not null, - film_id decimal not null, - fr_headline varchar(30), - fr_fr varchar(300), - primary key (user_id, film_id) -); - -/*==============================================================*/ -/* Table: film */ -/*==============================================================*/ -create table film -( - film_id decimal not null, - film_name char(20) not null, - film_english char(20) not null, - film_release_date date not null, - film_alias varchar(100) not null, - imdb varchar(100) not null, - film_review text not null, - primary key (film_id) -); - -/*==============================================================*/ -/* Table: phrase */ -/*==============================================================*/ -create table phrase -( - user_id decimal not null, - film_id decimal not null, - ph_state varchar(10) not null, - ph_lable varchar(100) not null, - ph_critic varchar(350) not null, - primary key (user_id, film_id) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ -create table user -( - user_id decimal not null, - user_pw varchar(20) not null, - user_sex char(1) not null, - user_address varchar(50) not null, - user_head_protrait varchar(100) not null, - primary key (user_id) -); - -alter table act_in add constraint FK_Relationship_3 foreign key (ac_id) - references actor (ac_id) on delete restrict on update restrict; - -alter table act_in add constraint FK_Relationship_9 foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table discuss add constraint FK_Relationship_10 foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table discuss add constraint FK_Relationship_4 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table file_review add constraint FK_Relationship_12 foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table file_review add constraint FK_Relationship_6 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; - -alter table phrase add constraint FK_Relationship_11 foreign key (film_id) - references film (film_id) on delete restrict on update restrict; - -alter table phrase add constraint FK_Relationship_5 foreign key (user_id) - references user (user_id) on delete restrict on update restrict; \ No newline at end of file diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-13.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-13.md" deleted file mode 100644 index 2fc56f46266651d223cd66cfd7b012668757241d..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-13.md" +++ /dev/null @@ -1,123 +0,0 @@ -```mysql -drop table if exists docter; - -drop table if exists drug; - -drop table if exists nurse; - -drop table if exists patient; - -drop table if exists shoushushi_id; - -drop table if exists sickbed; - -drop table if exists sickperson; - -/*==============================================================*/ -/* Table: docter */ -/*==============================================================*/ -create table docter -( - docter_id int not null auto_increment, - docter_name varchar(10) not null, - docter_sex char(1) not null, - docter_degree varchar(15) not null, - docter_tel numeric(8,0) not null, - primary key (docter_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - drug_name varchar(20) not null, - drug_medication varchar(50) not null, - drug_price int not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: nurse */ -/*==============================================================*/ -create table nurse -( - nurse_id int not null auto_increment, - nurse_name varchar(10) not null, - primary key (nurse_id) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(10) not null, - patient_address varchar(20) not null, - patient_tel numeric(20,0) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: shoushushi_id */ -/*==============================================================*/ -create table shoushushi_id -( - shoushushi_id_id int not null auto_increment, - sickbed_id int not null, - sic_sickperson_id int not null, - patient_id int not null, - docter_id int not null, - shoushushi_idname varchar(10) not null, - sickperson_id int not null, - primary key (shoushushi_id_id) -); - -/*==============================================================*/ -/* Table: sickbed */ -/*==============================================================*/ -create table sickbed -( - sickbed_id int not null, - nurse_id int not null, - primary key (sickbed_id) -); - -/*==============================================================*/ -/* Table: sickperson */ -/*==============================================================*/ -create table sickperson -( - sickperson_id int not null, - patient_id int not null, - docter_id int not null, - drug_id int not null, - shoushushi_id_id int not null, - allergy char(1) not null, - sympton varchar(50) not null, - primary key (sickperson_id, patient_id, docter_id) -); - -alter table shoushushi_id add constraint FK_inhospital foreign key (sickbed_id) - references sickbed (sickbed_id) on delete restrict on update restrict; - -alter table shoushushi_id add constraint FK_operation foreign key (sic_sickperson_id, patient_id, docter_id) - references sickperson (sickperson_id, patient_id, docter_id) on delete restrict on update restrict; - -alter table sickbed add constraint FK_nursing foreign key (nurse_id) - references nurse (nurse_id) on delete restrict on update restrict; - -alter table sickperson add constraint FK_booking foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table sickperson add constraint FK_operation2 foreign key (shoushushi_id_id) - references shoushushi_id (shoushushi_id_id) on delete restrict on update restrict; - -alter table sickperson add constraint FK_see foreign key (docter_id) - references docter (docter_id) on delete restrict on update restrict; - -alter table sickperson add constraint FK_takedrug foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; -``` \ No newline at end of file diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-14.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-14.md" deleted file mode 100644 index 46d56a0e0a1048683a84585fe09745b714404510..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-14.md" +++ /dev/null @@ -1,97 +0,0 @@ -![屏幕截图 2023-09-14 122151](C:\Users\陈胜杰\Pictures\Screenshots\屏幕截图 2023-09-14 122151.png) - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/14 12:22:08 */ -/*==============================================================*/ - -create database hospital character set utf8; -use hospital; -drop table if exists case; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists prescription; - -drop table if exists sick; - -/*==============================================================*/ -/* Table: case */ -/*==============================================================*/ -create table case -( - case_id int not null auto_increment, - sick_id decimal, - doctor_id int, - case_pathogen varchar(200) not null, - therapy_method text not null, - primary key (case_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - doctor_name varchar(20) not null, - docyor_sex varchar(1) not null, - doctor_num varchar(11) not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: drug */ -/*==============================================================*/ -create table drug -( - drug_id int not null auto_increment, - sick_id decimal, - drug_name varchar(50) not null, - drug_num int not null, - primary key (drug_id) -); - -/*==============================================================*/ -/* Table: prescription */ -/*==============================================================*/ -create table prescription -( - drug_id int not null, - doctor_id int not null, - primary key (drug_id, doctor_id) -); - -/*==============================================================*/ -/* Table: sick */ -/*==============================================================*/ -create table sick -( - sick_id decimal not null, - doctor_id int, - sick_name varchar(10) not null, - sick_sex varchar(1) not null, - sick_num varchar(11) not null, - sick_message text not null, - primary key (sick_id) -); - -alter table case add constraint FK_have foreign key (sick_id) - references sick (sick_id) on delete restrict on update restrict; - -alter table case add constraint FK_looks foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table drug add constraint FK_get foreign key (sick_id) - references sick (sick_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription foreign key (drug_id) - references drug (drug_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table sick add constraint FK_look foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; \ No newline at end of file diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-15.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-15.md" deleted file mode 100644 index aa876ab8d95d9c106e16b00bd6ab2e74eafa87c6..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-15.md" +++ /dev/null @@ -1,185 +0,0 @@ -# 任务: - -- 给一个汽车商店设计销售系统的数据库 - -- 顶层实体:汽车、顾客、销售员 - -# 目标: - -- 完成概念模型、逻辑模型、物理模型 - -- 生成DDL SQL语句,建立对应数据库和表结构 - -- 模拟真实数据给每个表插入一些数据。并根据应用场景需求完成 DQL语句 - -# 需求: - -- 1.能记录在售车型的信息、销售员的基本信息、客户的基本信息 - -- 2.进行车辆售卖时,记录销售员、客户、销售日期、实际售卖价格等信息 - -- 3.满足实际应用场景下的数据查询功能 - - -# 应用场景: - -- 1.查询特定销售员的销售记录 - -- 2.查找销售记录中销售价格最高的汽车 - -- 3.统计某个销售员的销售总额 - -- 4.根据客户信息查询其购买过的汽车 - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -- 6.检索特定日期范围内的销售了哪些汽车 - -- 7.查找某车型的销售历史。 - -- 8.统计每个销售员的销售数量 - -# ER图: - -- 屏幕截图 2023-09-16 123217.png - -```mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/16 6:04:42 */ -/*==============================================================*/ -drop database car_sell -create database car_sell character set utf8; -use car_sell; - -drop table if exists car; - -drop table if exists customer; - -drop table if exists salesman; - -drop table if exists sell; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - car_type varchar(50) not null, - car_num int not null, - car_price float(5,1) not null, - primary key (car_id) -); - -insert into car values -(null,'仰望u8',10,108), -(null,'瑞虎',10,21), -(null,'迈腾',10,30.9), -(null,'奥迪Q5L',10,48), -(null,'捷达VA3',10,9.2); -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - customer_id int not null auto_increment, - customer_name varchar(10) not null, - customer_sex varchar(1) not null, - customer_tel varchar(11) not null, - primary key (customer_id) -); -insert into customer values -(null,'伟伟','男','18000132135'), -(null,'鉴玲','男','180001322257'), -(null,'阿俊','男','18000130001'), -(null,'陈梦','男','18000130983'), -(null,'清风','男','18000134423'), -(null,'海旺','男','18000134562'), -(null,'聪达','男','18000132122'); - -/*==============================================================*/ -/* Table: salesman */ -/*==============================================================*/ -create table salesman -( - salesman_id int not null auto_increment, - salesman_name varchar(10) not null, - salesman_sex varchar(1) not null, - salesman_tel varchar(11) not null, - primary key (salesman_id) -); -insert into salesman values -(null,'李念','女','19926654812'), -(null,'杨柳','男','11235523322'), -(null,'张清','男','17685645642'), -(null,'李四','男','17234325552'); -/*==============================================================*/ -/* Table: sell */ -/*==============================================================*/ -create table sell -( - sell_id int not null auto_increment, - car_id decimal, - customer_id decimal, - salesman_id decimal, - sell_price float(5,1) not null, - sell_data date not null, - primary key (sell_id) -); -insert into sell values -(null,3,1,1,28,20200807), -(null,4,2,2,45,20230117), -(null,2,3,3,20,20220718), -(null,1,4,3,100,20220307), -(null,5,5,2,9,20210805), -(null,4,4,1,40,20190907); -alter table sell add constraint FK_Relationship_1 foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - -alter table sell add constraint FK_Relationship_2 foreign key (customer_id) - references customer (customer_id) on delete restrict on update restrict; - -alter table sell add constraint FK_Relationship_3 foreign key (salesman_id) - references salesman (salesman_id) on delete restrict on update restrict; -``` - - - -```mysql - -- 1.查询特定销售员的销售记录 - select s2.salesman_name 销售姓名,c1.customer_name 客户姓名,c2.car_type 汽车类型,s1.sell_price 汽车价格,s1.sell_data 售卖时间 from sell s1 - join salesman s2 on s1.salesman_id=s2.salesman_id - join customer c1 on c1.customer_id=s1.customer_id - join car c2 on c2.car_id =s1.car_id - where s1.salesman_id=1 ; - - -- 2.查找销售记录中销售价格最高的汽车 - select car_type , max(sell_price) from sell s1 - join car c1 on s1.car_id=c1.car_id - where c1.car_id =1; - -select car_type from car -where car_id= -(select sell.car_id from sell where sell_price=(select max(sell_price)from sell)); --- 3.统计某个销售员的销售总额 - - select salesman_name,sum(sell_price) from sell s1 - join salesman s2 on s1.salesman_id=s2.salesman_id - where s2.salesman_id=1; - - -- 4.根据客户信息查询其购买过的汽车 - select car_type from car - where car_id in - (select car_id from sell where customer_id= - (select customer_id from customer where customer_name LIKE '%陈%')) - - - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额 - -SELECT car_type,GROUP_CONCAT(customer_id) ,SUM(sell_price) -FROM sell s1 -JOIN car c1 ON s1.car_id = c1.car_id -GROUP BY car_type; - - -- 6.检索特定日期范围内的销售了哪些汽车 - select car_type ,sell_data from sell s1 - join car c1 on s1.car_id=c1.car_id - where s1.sell_data between '2020-08-07' and '2022-03-07' ; - - -- 7.查找某车型的销售历史。 - select car_type 汽车类型,car_price 原价,sell_price 出售价格,customer_name 客户姓名,salesman_name 销售姓名 from car c1 - join sell s1 on c1.car_id=s1.car_id - join customer c2 on c2.customer_id=s1.customer_id - join salesman s2 on s1.salesman_id=s2.salesman_id - where c1.car_type like '%仰望%'; - -- 8.统计每个销售员的销售数量 -SELECT s2.salesman_name, COUNT(s1.salesman_id) -FROM sell s1 -JOIN salesman s2 ON s1.salesman_id = s2.salesman_id -GROUP BY s1.salesman_id, s2.salesman_name; -``` \ No newline at end of file diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-19.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-19.md" deleted file mode 100644 index 2f720537928acf2a6412c7e11b1df6633c65e77f..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-19.md" +++ /dev/null @@ -1,803 +0,0 @@ -```mysql -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ -create database company_information character set utf8; -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -select sum(salary* 12) 工资总和 from employees; - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -select sum(salary*(1+IFNULL(commission_pct,0))*12) 工资和奖金和 from employees; -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct -select distinct job_id from employees; - - -# 3.查询工资大于12000的员工姓名和工资 -select first_name,salary from employees where salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 - -select first_name, department_id from employees where employee_id=176; -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -select first_name,salary from employees where salary not between 5000 and 12000; - - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select * from employees where department_id between 20 and 50; -# 3.选择公司中没有管理者的员工姓名及job_id -select * from employees where ISNULL(manager_id); - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -select first_name ,salary*commission_pct , grade_level from employees -join job_grades -where salary*commission_pct between lowest_sal and highest_sal and commission_pct IS not NULL; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 -select last_name from employees where last_name like '__尔' -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -select last_name from employees where last_name like '%特%' and last_name like '%尔%' - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -select * from employees where first_name like '%尔' - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -select last_name , job_id from employees where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -select last_name,salary,manager_id from employees where manager_id in (100,101,110); - - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 -select last_name,department_id,salary*12 from employees ORDER BY salary desc; --- order by 年薪 asc/desc - -# - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select last_name,salary from employees where salary not between 8000 and 17000 ORDER BY salary desc LIMIT 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select * from employees where email like '%e%' ORDER BY length(email) desc ,department_id ; - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -select last_name,e1.department_id ,department_name from employees e1 join departments d1 on e1.department_id=d1.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id -select e1.job_id,location_id from employees e1 -join departments d1 on e1.department_id=e1.department_id -where d1.department_id=90 GROUP BY job_id; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select last_name , d1.department_name , l1.location_id , city from employees e1 -join departments d1 on e1.department_id=d1.department_id -join locations l1 on l1.location_id=d1.location_id -where commission_pct is not null ; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -select last_name , job_id , d1.department_id , department_name -from employees e1 -join departments d1 on e1.department_id=d1.department_id -join locations l1 on l1.location_id=d1.location_id -where city ='多伦多' ; - - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 -select department_name,street_address,last_name,job_title ,salary from departments d1 , employees e1 ,locations l1 ,jobs j1 where d1.department_id=e1.department_id and d1.location_id=l1.location_id and j1.job_id=e1.job_id and department_name='行政部' - - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select e1.last_name,e1.employee_id,e2.last_name,e2.manager_id from employees e1 join employees e2 on e1.employee_id=e2.manager_id; - -select e1.last_name,e1.employee_id,e2.last_name,e2.manager_id from employees e1 ,employees e2 where e1.employee_id=e2.manager_id; - -# 7.查询哪些部门没有员工 - -select department_name from employees e1 right join departments d1 on e1.department_id=d1.department_id where employee_id is null ; -# 8. 查询哪个城市没有部门 -select city from departments d1 right join locations l1 on d1.location_id=l1.location_id where department_name is null; -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -select * from departments d1 join employees e1 on d1.department_id=e1.department_id where department_name='销售部' or department_name='信息技术部' - - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary),min(salary),avg(salary),sum(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -select job_id, max(salary),min(salary),avg(salary),sum(salary) from employees GROUP BY job_id; - -#4.选择各个job_id的员工人数 -select job_id ,count(employee_id)from employees GROUP BY job_id; -# 5.查询员工最高工资和最低工资的差距 -select max(salary)-min(salary) from employees; - - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - - select manager_id,min(salary) from employees where salary>6000 and manager_id is not null group by manager_id - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 -select department_name,location_id ,COUNT(employee_id),avg(salary)from departments d1 , employees e1 where d1.department_id=e1.department_id group by department_name,location_id order by avg(salary) desc; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select department_name, job_title,min_salary from departments d1 -join employees e1 on d1.department_id=e1.department_id -join jobs j1 on j1.job_id=e1.job_id ; -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -select last_name , salary from employees where department_id = -(select e1.department_id from employees e1 join departments d1 on e1.department_id=d1.department_id where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -select employee_id ,last_name,salary from employees where salary >(select avg(salary) from employees ); - - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name, job_id, salary from employees where employee_id in -(select employee_id from employees where salary = -(select max(salary) from employees where job_id='sa_man')); - - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - - -select employee_id,last_name from employees where department_id in (select DISTINCT department_id from employees where email like '%u%') ORDER BY department_id; - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -select employee_id from employees where department_id in (select department_id from departments where location_id=1700); - -#6.查询管理者是 金 的员工姓名和工资 -SELECT last_name, salaryFROM employees WHERE manager_id IN (SELECT employee_id FROM employees WHERE last_name = '金'); - -#7.查询工资最低的员工信息: last_name, salary -select last_name,salary from employees where salary =(select min(salary) from employees ) -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 - --- A: -SELECT d.department_id, d.department_name, AVG(e.salary) AS average_salary -FROM departments d -JOIN employees e ON d.department_id = e.department_id -GROUP BY d.department_id, d.department_name -ORDER BY average_salary -LIMIT 1; - - - --- B: -select * from departments d1 where d1.department_id=( -SELECT d.department_id -FROM departments d -JOIN employees e ON d.department_id = e.department_id -GROUP BY d.department_id -HAVING AVG(e.salary) = (SELECT MIN(avg_salary) -FROM (SELECT AVG(salary) AS avg_salary -FROM employees -GROUP BY department_id) AS temp)); - -#方式2: -# 部门平均<= 公司所有平均 - - - - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -SELECT * -FROM departments d1 -JOIN ( - SELECT AVG(salary) avg_salary, department_id - FROM employees - WHERE department_id IS NOT NULL - GROUP BY department_id -) a ON d1.department_id = a.department_id -WHERE a.department_id = ( - SELECT department_id - FROM ( - SELECT AVG(salary) avg_salary, department_id - FROM employees - WHERE department_id IS NOT NULL - GROUP BY department_id - ) b - WHERE avg_salary = ( - SELECT MIN(avg_salary) min_avg - FROM ( - SELECT AVG(salary) avg_salary, department_id - FROM employees - WHERE department_id IS NOT NULL - GROUP BY department_id - ) AS c - ) -); - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 -select job_id from -(select avg(salary) as avg1 ,job_id from employees group by job_id) a -where max(avg)=( -select max(avg) from (select avg(salary) avg from employees group by job_id) as a1)as a2 ; - - - -#11.查询平均工资高于公司平均工资的部门有哪些? - - select d.department_name 部门名,avg(e.salary) 平均工资 - from departments d right join employees e on d.department_id = e.department_id - group by d.department_id having 平均工资 > (select avg(salary) from employees); - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 -select * from employees e1 join employees e2 on e1.employee_id=e2.manager_id; - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? -select min(e.salary) 最低工资 from employees e right join - (select department_id,max(salary) 最高工资 from employees group by department_id order by 最高工资 limit 0,1) a - on e.department_id = a.department_id ; - - -#方式: - - - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - select last_name, department_id, email, salary from employees where employee_id = - (select employee_id from employees e right join - (select department_id,avg(salary) 平均工资 from employees group by department_id order by 平均工资 desc limit 0,1) a - on e.department_id = a.department_id limit 0,1); - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - select job_id from jobs where job_id != 'ST_CLERK'; - - - -#16. 选择所有没有管理者的员工的last_name -select last_name from employees where manager_id is null; - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: -SELECT e1.employee_id, e1.first_name, e1.hire_date, e1.salary -FROM departments d1 -JOIN employees e1 ON d1.department_id = e1.department_id -WHERE e1.manager_id IN (SELECT employee_id FROM employees e2 WHERE e2.last_name = '格林伯格'); -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - select e.employee_id 员工号,e.last_name 姓名,e.salary 工资,a.平均工资 from employees e left join - (select department_id,avg(salary) 平均工资 from employees group by department_id) a - on e.department_id = a.department_id and e.salary > a.平均工资; -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - select department_name from departments where department_id in - (select distinct department_id from employees where employee_id in - (select manager_id from employees group by manager_id having count(manager_id)>5)); - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - select country_id from locations where location_id in - (select location_id from departments group by location_id having count(location_id) > 2); -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` - diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-20.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-20.md" deleted file mode 100644 index f18e4363e134ce28f9f9ae1618886b31a3a97b17..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-20.md" +++ /dev/null @@ -1,23 +0,0 @@ -## RBAC(Role-Based Access Control) - -一种数据库设计思想,基于角色的访问权限管制模型,目前权限的主流方案,核心为角色 - -在 RBAC 模型里面,有3个基础组成部分,分别是:用户、角色和权限 - -- User(用户):每个用户都有唯一的UID识别,并被授予不同的角色 -- Role(角色):不同角色具有不同的权限 -- Permission(权限):访问权限 -- 用户-角色映射:用户和角色之间的映射关系 -- 角色-权限映射:角色和权限之间的映射 - -管理员和普通用户被授予不同的权限,普通用户只能去修改和查看个人信息,而不能创建用户和冻结用户,而管理员由于被授予所有权限,所以可以做所有操作 - -## 预习 SKU - -SKU 英文全称为Stock Keeping Unit,简称 SKU ,是产品入库后一种编码归类方法,也是库存控制的最小单位。一款商品,每个颜色,每个尺码,每一型号等都有出现一个 sku ,便于电商品牌识别商品。 - -既然 sku 被定义为最小存货单元,商家就可以选择自己设定 sku,一般来说是以件、盒、个、托盘等为单位。 - -- 大厂的 sku 就可以是一箱, -- 超市的 sku 就可以是一盒, -- 零售商的 sku 可以是一个。 \ No newline at end of file diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-21.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-21.md" deleted file mode 100644 index 6e828d2e2414de86703b5884b9db5dbc93bf3819..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-21.md" +++ /dev/null @@ -1,146 +0,0 @@ -SKU: - -​ SKU=stock keeping unit(库存量单位) SKU即库存进出计量的单位(买家购买、商家进货、[供应商](https://www.zhihu.com/search?q=供应商&search_source=Entity&hybrid_search_source=Entity&hybrid_search_extra={"sourceType"%3A"answer"%2C"sourceId"%3A616073286})备货、工厂生产都是依据SKU进行的),在服装、鞋类商品中使用最多最普遍。 例如纺织品中一个SKU通常表示:规格、颜色、款式。 SKU是物理上不可分割的最小存货单元。也就是说一款商品,可以根据SKU来确定具体的货物存量。 sku 属性(会影响到库存和价格的属性, 又叫销售属性)---规格 - -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:17:57 */ -/*==============================================================*/ -create database jd character set utf8; -use jd; - -drop table if exists attribute; - -drop table if exists attribute_value; - -drop table if exists rele; - -drop table if exists sku; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table attribute -( - attribute_id int not null auto_increment, - attribute_name varchar(10) not null, - primary key (attribute_id) -); - -/*==============================================================*/ -/* Table: attribute_value */ -/*==============================================================*/ -create table attribute_value -( - value_id int not null auto_increment, - value_content varchar(50) not null, - primary key (value_id) -); - -/*==============================================================*/ -/* Table: rele */ -/*==============================================================*/ -create table rele -( - rele_id int not null auto_increment, - sku_id int, - attribute_id int, - value_id int, - primary key (rele_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price decimal(9,2) not null, - sku_stock int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(10) not null, - spu_test varchar(100) not null, - primary key (spu_id) -); - -alter table rele add constraint FK_attribute_rele foreign key (attribute_id) - references attribute (attribute_id) on delete restrict on update restrict; - -alter table rele add constraint FK_sku_rele foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table rele add constraint FK_value_rele foreign key (value_id) - references attribute_value (value_id) on delete restrict on update restrict; - -alter table sku add constraint FK_spu_sku foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - --- 商品 -insert into spu values (1,"华为","国货之光"); - --- 规格 -insert into sku values -(1,1,"华为mate60 黑色 256G",6999,10), -(2,1,"华为mate60 白色 256G",6999,20), -(3,1,"华为mate60 蓝色 256G",6999,0), -(4,1,"华为mate60 黑色 512G",7999,1), -(5,1,"华为mate60 白色 512G",7999,2), -(6,1,"华为mate60 蓝色 512G",7999,10); - --- 属性 -insert into attribute values -(1,"颜色"), -(2,"内存"); - --- 属性值 -insert into attribute_value values -(1,"黑色"), -(2,"白色"), -(3,"蓝色"), -(4,"256G"), -(5,"512G"); - --- 关联 -insert into rele values -(1,1,1,1), -(2,1,2,4), -(3,2,1,2), -(4,2,2,4), -(5,3,1,3), -(6,3,2,4), -(7,4,1,1), -(8,4,2,5), -(9,5,1,2), -(10,5,2,5), -(11,6,1,3), -(12,6,2,5); - - -select a.spu_id,b.sku_id,b.sku_name,b.sku_price,b.sku_stock from - spu a,sku b,attribute c,attribute_value d,rele e -where -a.spu_id = b.spu_id -and b.sku_id = e.sku_id -and c.attribute_id = e.attribute_id -and d.value_id = e.value_id -and b.sku_id = -( -select aa.sku_id from -(select sku_id from attribute, attribute_value , rele where attribute.attribute_id =rele.attribute_id and attribute_value.value_id = rele.value_id and value_content = "白色" ) aa -, -(select sku_id from attribute, attribute_value , rele where attribute.attribute_id =rele.attribute_id and attribute_value.value_id = rele.value_id and value_content = "256G" ) bb -where aa.sku_id = bb.sku_id -) limit 0,1; \ No newline at end of file diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-22.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-22.md" deleted file mode 100644 index 8951e1d57ff5631b6afeebc8f2d1ecc58efeda21..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-22.md" +++ /dev/null @@ -1,131 +0,0 @@ -- ## 笔记: - -- SPU(Standard Product Unit ):指的是标准商品单位,商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个商品的特性; - -- SKU(Stock Keeping Unit):库存量单位,是物理上不可分割的最小存货单元。 - -~~~mysql -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-22 09:09:19 */ -/*==============================================================*/ -create database tt character set utf8; -use tt; - -drop table if exists attributes; - -drop table if exists attributes_values; - -drop table if exists rele; - -drop table if exists sku; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_id int not null auto_increment, - attributes_name varchar(10) not null, - primary key (attributes_id) -); - -/*==============================================================*/ -/* Table: attributes_values */ -/*==============================================================*/ -create table attributes_values -( - values_id int not null auto_increment, - values_test varchar(20) not null, - primary key (values_id) -); - -/*==============================================================*/ -/* Table: rele */ -/*==============================================================*/ -create table rele -( - rele_id int not null auto_increment, - sku_id int, - attributes_id int, - values_id int, - primary key (rele_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price decimal(6,2) not null, - sku_add varchar(20) not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(20) not null, - spu_text varchar(255) not null, - primary key (spu_id) -); - -alter table rele add constraint FK_attributes_rele foreign key (attributes_id) - references attributes (attributes_id) on delete restrict on update restrict; - -alter table rele add constraint FK_sku_rele foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table rele add constraint FK_values_rele foreign key (values_id) - references attributes_values (values_id) on delete restrict on update restrict; - -alter table sku add constraint FK_spu_sku foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -# 查询1 -select a.spu_id,b.sku_id,b.sku_name,b.sku_price,b.sku_add - from spu a,sku b,attributes c,attributes_values d,rele e -where - a.spu_id = b.spu_id - and b.sku_id = e.sku_id - and c.attributes_id = e.attributes_id - and d.values_id = e.values_id ; - -# 查询2 -select a.spu_id,b.sku_id,b.sku_name,b.sku_price,b.sku_add -from spu a,sku b,attributes c,attributes_values d,rele e -where - a.spu_id = b.spu_id - and b.sku_id = e.sku_id - and c.attributes_id = e.attributes_id - and d.values_id = e.values_id -and b.sku_id = -( -select aa.sku_id from -(select sku_id from attributes, attributes_values , rele where attributes.attributes_id =rele.attributes_id and attributes_values.values_id = rele.values_id and values_test = "黑猪" ) aa -, -(select sku_id from attributes, attributes_values , rele where attributes.attributes_id =rele.attributes_id and attributes_values.values_id = rele.values_id and values_test = "200g" ) bb -, -(select sku_id from attributes, attributes_values , rele where attributes.attributes_id =rele.attributes_id and attributes_values.values_id = rele.values_id and values_test = "1包" ) cc -where aa.sku_id = bb.sku_id -and bb.sku_id = cc.sku_id -); - -``` - -![image-20230924163547326](https://s2.loli.net/2023/09/24/Z2dPCAgzaEhxJ9D.png) - -![image-20230924163617602](https://s2.loli.net/2023/09/24/skBJgn37QxUcXWV.png) - -![image-20230924163634393](https://s2.loli.net/2023/09/24/YIxF2dmAqj751Zl.png) -~~~ - diff --git "a/58 \351\231\210\350\203\234\346\235\260/2023-09-26.md" "b/58 \351\231\210\350\203\234\346\235\260/2023-09-26.md" deleted file mode 100644 index fdba219e4378d91b6479c632f004fe63c7f61cc0..0000000000000000000000000000000000000000 --- "a/58 \351\231\210\350\203\234\346\235\260/2023-09-26.md" +++ /dev/null @@ -1,297 +0,0 @@ -## 笔记: - -​ check 一种约束 例如:check(字段 in('男','女')) -​ utf8中 1个汉字占用3个字节 -​ length() 获取字节长度 -​ concat(字段1,字段2,...) 连接两个或者多个字段在一个字段里 -​ 视图: -​ 虚拟表,建立在已有在表在基础上 -​ 如果视图中数据是来自于一个表时,修改视图中的数据,表数据会更新。而且修改表中数据时,对应视图也会更新。但是如果视图数据来源于两个表时,修改视图数据时会报错,无法修改。 -​ 作用:1、有利于数据的安全性 -​ 2、方便查看 -​ 3、减少操作的冗余 - -```mysql -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db - -********************************************************************* - -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -create view emps(姓名,员工号,部门号) as select last_name,employee_id,department_id from employees -select view emps; - -#2. 显示视图的结构 -desc emps; - -#3. 查询视图中的全部内容 -select * from emps; - -#4. 将视图中的数据限定在部门号是80的范围内 -select * from emps where 部门号=80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -create view emp_v1 as select last_name,salary,email from employees where SUBSTR(phone_number ,1,3)='011'; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -alter view emp_v1 as select last_name,salary,email from employees where SUBSTR(phone_number ,1,3)='011' and email like '%e%'; - - -#3. 向 emp_v1 插入一条记录,是否可以? -#4. 修改emp_v1中员工的工资,每人涨薪1000 - -update emp_v1 set salary=salary+1000; -#5. 删除emp_v1中姓名为Olsen的员工 - -delete from emp_v1 where last_name='Olsen'; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create view emp_v2 as -select max(salary),department_id from employees GROUP BY department_id having max(salary)>12000 ; - - - -#7. 向 emp_v2 中插入一条记录,是否可以? - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v2 ; -drop view emp_v1; -``` - diff --git "a/59 \346\236\227\345\263\260/9\346\234\21012\346\227\245.md" "b/59 \346\236\227\345\263\260/9\346\234\21012\346\227\245.md" deleted file mode 100644 index 092bc27d085c65f62a8cad109d57daf0c4b4455f..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\21012\346\227\245.md" +++ /dev/null @@ -1,47 +0,0 @@ -/*==============================================================*/ /* DBMS name: MySQL 5.0 */ /* Created on: 2023/9/12 22:48:17 */ /*==============================================================*/ create DATABASE movie character set utf8; use movie; - -drop table if exists act_in; - -drop table if exists actor; - -drop table if exists discuss; - -drop table if exists file_review; - -drop table if exists film; - -drop table if exists phrase; - -drop table if exists user; - -/*==============================================================*/ /* Table: act_in */ /*==============================================================*/ create table act_in ( ac_id decimal not null, film_id decimal not null, primary key (ac_id, film_id) ); - -/*==============================================================*/ /* Table: actor */ /*==============================================================*/ create table actor ( ac_id decimal not null, ac_name varchar(20) not null, ac_english_name varchar(20) not null, imb varchar(20) not null, ְac_work varchar(10) not null, ac_sex char(1) not null, ac_intro text not null, ac_head_portrait varchar(100) not null, primary key (ac_id) ); - -/*==============================================================*/ /* Table: discuss */ /*==============================================================*/ create table discuss ( user_id decimal not null, film_id decimal not null, ds_headline varchar(30) not null, ds_discuss varchar(300) not null, primary key (user_id, film_id) ); - -/*==============================================================*/ /* Table: file_review */ /*==============================================================*/ create table file_review ( user_id decimal not null, film_id decimal not null, fr_headline varchar(30), fr_fr varchar(300), primary key (user_id, film_id) ); - -/*==============================================================*/ /* Table: film */ /*==============================================================*/ create table film ( film_id decimal not null, film_name char(20) not null, film_english char(20) not null, film_release_date date not null, film_alias varchar(100) not null, imdb varchar(100) not null, film_review text not null, primary key (film_id) ); - -/*==============================================================*/ /* Table: phrase */ /*==============================================================*/ create table phrase ( user_id decimal not null, film_id decimal not null, ph_state varchar(10) not null, ph_lable varchar(100) not null, ph_critic varchar(350) not null, primary key (user_id, film_id) ); - -/*==============================================================*/ /* Table: user */ /*==============================================================*/ create table user ( user_id decimal not null, user_pw varchar(20) not null, user_sex char(1) not null, user_address varchar(50) not null, user_head_protrait varchar(100) not null, primary key (user_id) ); - -alter table act_in add constraint FK_Relationship_3 foreign key (ac_id) references actor (ac_id) on delete restrict on update restrict; - -alter table act_in add constraint FK_Relationship_9 foreign key (film_id) references film (film_id) on delete restrict on update restrict; - -alter table discuss add constraint FK_Relationship_10 foreign key (film_id) references film (film_id) on delete restrict on update restrict; - -alter table discuss add constraint FK_Relationship_4 foreign key (user_id) references user (user_id) on delete restrict on update restrict; - -alter table file_review add constraint FK_Relationship_12 foreign key (film_id) references film (film_id) on delete restrict on update restrict; - -alter table file_review add constraint FK_Relationship_6 foreign key (user_id) references user (user_id) on delete restrict on update restrict; - -alter table phrase add constraint FK_Relationship_11 foreign key (film_id) references film (film_id) on delete restrict on update restrict; - -alter table phrase add constraint FK_Relationship_5 foreign key (user_id) references user (user_id) on delete restrict on update restrict; - -https://www.picgo.net/image/Tn2uG \ No newline at end of file diff --git "a/59 \346\236\227\345\263\260/9\346\234\21013\346\227\245.md" "b/59 \346\236\227\345\263\260/9\346\234\21013\346\227\245.md" deleted file mode 100644 index 76491fc5cd5750aa59edb241d7bc71c24b94d9cd..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\21013\346\227\245.md" +++ /dev/null @@ -1,172 +0,0 @@ -笔记:如果一个主体的属性有多个值,那这个属性就可以拆成一个新主体 - -b9f15c44a08aadf90bd62e92666ccdd0fdc7b29439c1458.png - -``` -create database hospital charset utf8; - -use hospital; - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023/9/13 21:45:56 */ -/*==============================================================*/ - - -drop table if exists department; - -drop table if exists doctor; - -drop table if exists doctor_patient_diagnosis; - -drop table if exists doctor_patient_registered; - -drop table if exists medicine; - -drop table if exists patient; - -drop table if exists pharmacy; - -drop table if exists ward; - -/*==============================================================*/ -/* Table: department */ -/*==============================================================*/ -create table department -( - department_id int not null auto_increment, - department_name varchar(7) not null, - department_tel char(11) not null, - department_address varchar(10) not null, - primary key (department_id) -); - -/*==============================================================*/ -/* Table: doctor */ -/*==============================================================*/ -create table doctor -( - doctor_id int not null auto_increment, - department_id int not null, - doctor_name varchar(4) not null, - doctor_sex char(1) not null, - doctor_title varchar(5) not null, - doctor_age int not null, - primary key (doctor_id) -); - -/*==============================================================*/ -/* Table: doctor_patient_diagnosis */ -/*==============================================================*/ -create table doctor_patient_diagnosis -( - diagnosis_id int not null auto_increment, - patient_id int not null, - doctor_id int not null, - medicine_jd int not null, - diagnosis_price numeric(7,2) not null, - primary key (diagnosis_id) -); - -/*==============================================================*/ -/* Table: doctor_patient_registered */ -/*==============================================================*/ -create table doctor_patient_registered -( - registered_id int not null auto_increment, - patient_id int not null, - doctor_id int not null, - registered_date datetime not null, - registered_price numeric(2,0) not null, - primary key (registered_id) -); - -/*==============================================================*/ -/* Table: medicine */ -/*==============================================================*/ -create table medicine -( - medicine_jd int not null auto_increment, - pharmacy_id int not null, - medicine_name varchar(10) not null, - medicine_price numeric(5,2) not null, - medicine_function varchar(50) not null, - medicine_ingredients varchar(50) not null, - medicine_num int not null, - primary key (medicine_jd) -); - -/*==============================================================*/ -/* Table: patient */ -/*==============================================================*/ -create table patient -( - patient_id int not null auto_increment, - patient_name varchar(4) not null, - patient_age int not null, - patient_sex char(1) not null, - primary key (patient_id) -); - -/*==============================================================*/ -/* Table: pharmacy */ -/*==============================================================*/ -create table pharmacy -( - pharmacy_id int not null auto_increment, - pharmacy_name varchar(7) not null, - primary key (pharmacy_id) -); - -/*==============================================================*/ -/* Table: ward */ -/*==============================================================*/ -create table ward -( - ward_id int not null auto_increment, - department_id int not null, - bed_id char(3) not null, - primary key (ward_id) -); - -alter table doctor add constraint FK_department_doctor_belong foreign key (department_id) - references department (department_id) on delete restrict on update restrict; - -alter table doctor_patient_diagnosis add constraint FK_doctor_patient_diagnosis foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table doctor_patient_diagnosis add constraint FK_doctor_patient_diagnosis2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table doctor_patient_diagnosis add constraint FK_mediciner_patient_diagnosis foreign key (medicine_jd) - references medicine (medicine_jd) on delete restrict on update restrict; - -alter table doctor_patient_registered add constraint FK_doctor_patient_registered foreign key (patient_id) - references patient (patient_id) on delete restrict on update restrict; - -alter table doctor_patient_registered add constraint FK_doctor_patient_registered2 foreign key (doctor_id) - references doctor (doctor_id) on delete restrict on update restrict; - -alter table medicine add constraint FK_medicine_pharmacy_storage foreign key (pharmacy_id) - references pharmacy (pharmacy_id) on delete restrict on update restrict; - -alter table ward add constraint FK_department_ward_belong foreign key (department_id) - references department (department_id) on delete restrict on update restrict; - - -INSERT INTO `department` VALUES (5, '皮肤科', '08756934127', '门诊楼5层'); - -INSERT INTO `doctor` VALUES (3, 5, 'Kim', '女', '主治医师', 45); - -INSERT INTO `pharmacy` VALUES (7, '7房'); - -INSERT INTO `medicine` VALUES (8, 7, '氯雷他定', 60.00, '接触性皮炎', '氯', 1); - -INSERT INTO `ward` VALUES (1, 5, '#01'); - -INSERT INTO `patient` VALUES (1, 'isa', 21, '女'); - -INSERT INTO `doctor_patient_registered` VALUES (1, 1, 3, '2020-11-12 10:52:16', 50); - -INSERT INTO `doctor_patient_diagnosis` VALUES (1, 1, 3, 8, 110.00); -``` \ No newline at end of file diff --git "a/59 \346\236\227\345\263\260/9\346\234\21014\346\227\245.md" "b/59 \346\236\227\345\263\260/9\346\234\21014\346\227\245.md" deleted file mode 100644 index f078248cd4224143cc18d171ba367f8e165b1494..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\21014\346\227\245.md" +++ /dev/null @@ -1,33 +0,0 @@ -/*==============================================================*/ /* DBMS name: MySQL 5.0 */ /* Created on: 2023/9/14 12:22:08 */ /*==============================================================*/ - -create database hospital character set utf8; use hospital; drop table if exists case; - -drop table if exists doctor; - -drop table if exists drug; - -drop table if exists prescription; - -drop table if exists sick; - -/*==============================================================*/ /* Table: case */ /*==============================================================*/ create table case ( case_id int not null auto_increment, sick_id decimal, doctor_id int, case_pathogen varchar(200) not null, therapy_method text not null, primary key (case_id) ); - -/*==============================================================*/ /* Table: doctor */ /*==============================================================*/ create table doctor ( doctor_id int not null auto_increment, doctor_name varchar(20) not null, docyor_sex varchar(1) not null, doctor_num varchar(11) not null, primary key (doctor_id) ); - -/*==============================================================*/ /* Table: drug */ /*==============================================================*/ create table drug ( drug_id int not null auto_increment, sick_id decimal, drug_name varchar(50) not null, drug_num int not null, primary key (drug_id) ); - -/*==============================================================*/ /* Table: prescription */ /*==============================================================*/ create table prescription ( drug_id int not null, doctor_id int not null, primary key (drug_id, doctor_id) ); - -/*==============================================================*/ /* Table: sick */ /*==============================================================*/ create table sick ( sick_id decimal not null, doctor_id int, sick_name varchar(10) not null, sick_sex varchar(1) not null, sick_num varchar(11) not null, sick_message text not null, primary key (sick_id) ); - -alter table case add constraint FK_have foreign key (sick_id) references sick (sick_id) on delete restrict on update restrict; - -alter table case add constraint FK_looks foreign key (doctor_id) references doctor (doctor_id) on delete restrict on update restrict; - -alter table drug add constraint FK_get foreign key (sick_id) references sick (sick_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription foreign key (drug_id) references drug (drug_id) on delete restrict on update restrict; - -alter table prescription add constraint FK_prescription2 foreign key (doctor_id) references doctor (doctor_id) on delete restrict on update restrict; - -alter table sick add constraint FK_look foreign key (doctor_id) references doctor (doctor_id) on delete restrict on update restrict; \ No newline at end of file diff --git "a/59 \346\236\227\345\263\260/9\346\234\21015\345\217\267.md" "b/59 \346\236\227\345\263\260/9\346\234\21015\345\217\267.md" deleted file mode 100644 index 5c222edb4e0a8d0dad8f359e81e19adbfeedb245..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\21015\345\217\267.md" +++ /dev/null @@ -1,145 +0,0 @@ -``` -bYhJlVZ3SKnGOH7ce07f185a5ffc628.pngcreate database buy_car charset utf8; -use buy_car; - -drop table if exists car; - -drop table if exists car_brand; - -drop table if exists customer; - -drop table if exists sales_record; - -drop table if exists salesperson; - -/*==============================================================*/ -/* Table: car */ -/*==============================================================*/ -create table car -( - car_id int not null auto_increment, - cb_id int, - car_name varchar(10) not null, - car_price decimal(4,2) not null, - primary key (car_id) -); -insert into car values -(null,1,'奥迪A6L',42.79), -(null,1,'奥迪A8L',82.98), -(null,1,'奥迪A4L',32.18), -(null,2,'奔驰S400L',86.26), -(null,2,'奔驰GLA',28.78), -(null,2,'奔驰E级',50.25), -(null,3,'宝马X3',63.69), -(null,3,'宝马2系',41.98), -(null,3,'宝马X5',71.99); - -/*==============================================================*/ -/* Table: car_brand */ -/*==============================================================*/ -create table car_brand -( - cb_id int not null auto_increment, - cb_name varchar(10) not null, - primary key (cb_id) -); -insert into car_brand values -(null,'奥迪'), -(null,'奔驰'), -(null,'宝马'); - -/*==============================================================*/ -/* Table: customer */ -/*==============================================================*/ -create table customer -( - customer_id int not null auto_increment, - customer_name varchar(5) not null, - customer_sex char(1) not null, - customer_tel varchar(11) not null, - customer_address varchar(20) not null, - primary key (customer_id) -); -insert into customer values -(null,'张三','男','18850625585','福建省南平市'), -(null,'李四','女','16845766554','福建省龙岩市'), -(null,'王五','男','14950028523','福建省泉州市'), -(null,'赵六','女','15650258573','福建省漳州市'), -(null,'田七','女','14589562573','福建省漳州市'); - -/*==============================================================*/ -/* Table: 销售记录 */ -/*==============================================================*/ -create table sales_record -( - sr_id int not null auto_increment, - car_id int, - sp_id int, - customer_id int, - sr_time date not null, - primary key (sr_id) -); -insert into sales_record values -(null,2,1,1,'2023-02-13'), -(null,1,3,1,'2023-05-23'), -(null,3,1,3,'2023-03-19'), -(null,5,2,2,'2023-07-21'), -(null,4,4,5,'2023-06-14'), -(null,6,2,4,'2023-08-15'), -(null,9,3,2,'2023-07-21'); - -/*==============================================================*/ -/* Table: 销售员 */ -/*==============================================================*/ -create table salesperson -( - sp_id int not null auto_increment, - sp_name varchar(5) not null, - sp_sex char(1) not null, - sp_tel varchar(11) not null, - sp_address varchar(20) not null, - primary key (sp_id) -); -insert into salesperson values -(null,'小李','男','14648515156','福建省南平市'), -(null,'小敏','女','18956764856','福建省漳州市'), -(null,'小莉','女','15989525856','福建省龙岩市'), -(null,'小黄','男','15954879156','福建省龙岩市'); - -alter table car add constraint FK_belong_to foreign key (cb_id) - references car_brand (cb_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_buy foreign key (customer_id) - references customer (customer_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_sell_a foreign key (sp_id) - references salesperson (sp_id) on delete restrict on update restrict; - -alter table sales_record add constraint FK_sell_b foreign key (car_id) - references car (car_id) on delete restrict on update restrict; - - - - -- 1.查询特定销售员的销售记录(小李) - select * from salesperson s,sales_record sr where s.sp_id = sr.sp_id and sp_name = '小李'; - -- 2.查找销售记录中销售价格最高的汽车 - select * from car where car_price = - (select max(car_price) from car c,sales_record sr where c.car_id = sr.car_id); - -- 3.统计某个销售员的销售总额(小敏) - select sum(car_price) 万元 from car c,sales_record sr where c.car_id = sr.car_id and sp_id =(select sp_id from salesperson where sp_name = '小敏'); - -- 4.根据客户信息查询其购买过的汽车(李四) - select * from car where car_id in - (select car_id from sales_record where customer_id = (select customer_id from customer where customer_name = '李四')); - -- 5.分析特定品牌汽车的销售情况,统计每个品牌的销售数量和总销售额(奔驰) - select cb.cb_name 品牌,count(cb.cb_id) 销售数量,sum(car_price) 总销售额万元 - from car_brand cb,car c,sales_record sr where cb.cb_id = c.cb_id and c.car_id = sr.car_id group by cb.cb_id; - -- 6.检索特定日期范围内的销售了哪些汽车(2023-07-21) - select * from car where car_id in - (select car_id from sales_record where sr_time = '2023-07-21'); - -- 7.查找某车型的销售历史(宝马X3)。 - select * from sales_record where car_id = - (select car_id from car where car_name = '奔驰S400L'); - -- 8.统计每个销售员的销售数量 - select sp_name 销售员,count(sp.sp_id) 销售数量 from salesperson sp , sales_record sr where sp.sp_id = sr.sp_id group by sp.sp_id; -``` - diff --git "a/59 \346\236\227\345\263\260/9\346\234\21019\346\227\245.md" "b/59 \346\236\227\345\263\260/9\346\234\21019\346\227\245.md" deleted file mode 100644 index badc7436cd046822d25cf54c7480461cdb9d022b..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\21019\346\227\245.md" +++ /dev/null @@ -1,799 +0,0 @@ -笔记: - -如果值是null,那么所有null参与运算,返回的结果也都是null - -所以遇上null,却又必须让它参与运算,就使用 ifnull (原值,新值) - -这个函数的作用,如果原值是null,就用新值代替,如果原值不null,就保持原值 - -作业: - -``` -/* - Navicat Premium Data Transfer - - Source Server : local - Source Server Type : MySQL - Source Server Version : 80034 (8.0.34) - Source Host : localhost:3306 - Source Schema : mxdxdb - - Target Server Type : MySQL - Target Server Version : 80034 (8.0.34) - File Encoding : 65001 - - Date: 17/09/2023 22:21:02 -*/ -create database company_information character set utf8; -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for countries --- ---------------------------- -DROP TABLE IF EXISTS `countries`; -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of countries --- ---------------------------- -BEGIN; -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AR', '阿根廷', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('AU', '澳大利亚', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BE', '比利时', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('BR', '巴西', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CA', '加拿大', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CH', '瑞士', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('CN', '中国', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DE', '德国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('DK', '丹麦', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('EG', '埃及', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('FR', '法国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('HK', '香港', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IL', '以色列', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IN', '印度', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('IT', '意大利', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('JP', '日本', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('KW', '科威特', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('MX', '墨西哥', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NG', '尼日利亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('NL', '荷兰', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('SG', '新加坡', 3); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('UK', '英国', 1); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('US', '美国', 2); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZM', '赞比亚', 4); -INSERT INTO `countries` (`country_id`, `country_name`, `region_id`) VALUES ('ZW', '津巴布韦', 4); -COMMIT; - --- ---------------------------- --- Table structure for departments --- ---------------------------- -DROP TABLE IF EXISTS `departments`; -CREATE TABLE `departments` ( - `department_id` int NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int DEFAULT NULL, - `location_id` int DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of departments --- ---------------------------- -BEGIN; -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (10, '行政部', 200, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (20, '营销部', 201, 1800); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (30, '采购部', 114, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (40, '人力资源部', 203, 2400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (50, '物流部', 121, 1500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (60, '信息技术部', 103, 1400); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (70, '公共关系部', 204, 2700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (80, '销售部', 145, 2500); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (90, '执行部门', 100, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (100, '财务部', 108, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (110, '会计部', 205, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (120, '财务部门1', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (130, '企业税务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (140, '控制和信用部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (150, '股东服务部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (160, '员工福利部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (170, '制造部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (180, '建筑部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (190, '承包部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (200, '运营部', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (210, '信息技术支持部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (220, '网络运营中心', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (230, '信息技术帮助台', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (240, '政府销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (250, '零售销售部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (260, '招聘部门', NULL, 1700); -INSERT INTO `departments` (`department_id`, `department_name`, `manager_id`, `location_id`) VALUES (270, '工资单部门', NULL, 1700); -COMMIT; - --- ---------------------------- --- Table structure for employees --- ---------------------------- -DROP TABLE IF EXISTS `employees`; -CREATE TABLE `employees` ( - `employee_id` int NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int DEFAULT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of employees --- ---------------------------- -BEGIN; -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (100, '史蒂文', '金', 'SKING', '515.123.4567', '1987-06-17', 'AD_PRES', 24000.00, NULL, NULL, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (101, '尼娜', '科查尔', 'NKOCHHAR', '515.123.4568', '1989-09-21', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (102, '雷克斯', '德哈恩', 'LDEHAAN', '515.123.4569', '1993-01-13', 'AD_VP', 17000.00, NULL, 100, 90); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (103, '亚历山大', '胡诺尔德', 'AHUNOLD', '590.423.4567', '1990-01-03', 'IT_PROG', 9000.00, NULL, 102, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (104, '布鲁斯', '恩斯特', 'BERNST', '590.423.4568', '1991-05-21', 'IT_PROG', 6000.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (105, '大卫', '奥斯汀', 'DAUSTIN', '590.423.4569', '1997-06-25', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (106, '瓦利', '帕塔巴拉', 'VPATABAL', '590.423.4560', '1998-02-05', 'IT_PROG', 4800.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (107, '黛安娜', '洛伦茨', 'DLORENTZ', '590.423.5567', '1999-02-07', 'IT_PROG', 4200.00, NULL, 103, 60); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (108, '南希', '格林伯格', 'NGREENBE', '515.124.4569', '1994-08-17', 'FI_MGR', 12000.00, NULL, 101, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (109, '丹尼尔', '法维特', 'DFAVIET', '515.124.4169', '1994-08-16', 'FI_ACCOUNT', 9000.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (110, '约翰', '陈', 'JCHEN', '515.124.4269', '1997-09-28', 'FI_ACCOUNT', 8200.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (111, '伊斯梅尔', '斯基亚拉', 'ISCIARRA', '515.124.4369', '1997-09-30', 'FI_ACCOUNT', 7700.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (112, '何塞·曼努埃尔', '乌尔曼', 'JMURMAN', '515.124.4469', '1998-03-07', 'FI_ACCOUNT', 7800.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (113, '路易斯', '波普', 'LPOPP', '515.124.4567', '1999-12-07', 'FI_ACCOUNT', 6900.00, NULL, 108, 100); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (114, '丹', '拉法艾利', 'DRAPHEAL', '515.127.4561', '1994-12-07', 'PU_MAN', 11000.00, NULL, 100, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (115, '亚历山大', '胡', 'AKHOO', '515.127.4562', '1995-05-18', 'PU_CLERK', 3100.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (116, '雪莉', '拜达', 'SBAIDA', '515.127.4563', '1997-12-24', 'PU_CLERK', 2900.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (117, '西加尔', '托比亚斯', 'STOBIAS', '515.127.4564', '1997-07-24', 'PU_CLERK', 2800.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (118, '盖伊', '火室', 'GHIMURO', '515.127.4565', '1998-11-15', 'PU_CLERK', 2600.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (119, '卡伦', '科尔门纳雷斯', 'KCOLMENA', '515.127.4566', '1999-08-10', 'PU_CLERK', 2500.00, NULL, 114, 30); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (120, '马修', '韦斯', 'MWEISS', '650.123.1234', '1996-07-18', 'ST_MAN', 8000.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (121, '亚当', '弗里普', 'AFRIPP', '650.123.2234', '1997-04-10', 'ST_MAN', 8200.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (122, '帕亚姆', '考夫林', 'PKAUFLIN', '650.123.3234', '1995-05-01', 'ST_MAN', 7900.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (123, '珊塔', '沃尔曼', 'SVOLLMAN', '650.123.4234', '1997-10-10', 'ST_MAN', 6500.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (124, '凯文', '莫尔戈斯', 'KMOURGOS', '650.123.5234', '1999-11-16', 'ST_MAN', 5800.00, NULL, 100, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (125, '朱莉娅', '内耶尔', 'JNAYER', '650.124.1214', '1997-07-16', 'ST_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (126, '艾琳', '米基利内尼', 'IMIKKILI', '650.124.1224', '1998-09-28', 'ST_CLERK', 2700.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (127, '詹姆斯', '兰德里', 'JLANDRY', '650.124.1334', '1999-01-14', 'ST_CLERK', 2400.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (128, '史蒂文', '马克尔', 'SMARKLE', '650.124.1434', '2000-03-08', 'ST_CLERK', 2200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (129, '劳拉', '比索特', 'LBISSOT', '650.124.5234', '1997-08-20', 'ST_CLERK', 3300.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (130, '莫兹', '阿特金森', 'MATKINSO', '650.124.6234', '1997-10-30', 'ST_CLERK', 2800.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (131, '詹姆斯', '马洛', 'JAMRLOW', '650.124.7234', '1997-02-16', 'ST_CLERK', 2500.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (132, 'TJ', '奥尔森', 'TJOLSON', '650.124.8234', '1999-04-10', 'ST_CLERK', 2100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (133, '贾森', '马林', 'JMALLIN', '650.127.1934', '1996-06-14', 'ST_CLERK', 3300.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (134, '迈克尔', '罗杰斯', 'MROGERS', '650.127.1834', '1998-08-26', 'ST_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (135, '基', '吉', 'KGEE', '650.127.1734', '1999-12-12', 'ST_CLERK', 2400.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (136, '海泽尔', '菲尔坦克', 'HPHILTAN', '650.127.1634', '2000-02-06', 'ST_CLERK', 2200.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (137, '伦斯克', '拉德维格', 'RLADWIG', '650.121.1234', '1995-07-14', 'ST_CLERK', 3600.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (138, '斯蒂芬', '斯泰尔斯', 'SSTILES', '650.121.2034', '1997-10-26', 'ST_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (139, '约翰', '西奥', 'JSEO', '650.121.2019', '1998-02-12', 'ST_CLERK', 2700.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (140, '乔舒亚', '帕特尔', 'JPATEL', '650.121.1834', '1998-04-06', 'ST_CLERK', 2500.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (141, '特蕾娜', '拉杰斯', 'TRAJS', '650.121.8009', '1995-10-17', 'ST_CLERK', 3500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (142, '柯蒂斯', '戴维斯', 'CDAVIES', '650.121.2994', '1997-01-29', 'ST_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (143, '兰德尔', '马托斯', 'RMATOS', '650.121.2874', '1998-03-15', 'ST_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (144, '彼得', '瓦加斯', 'PVARGAS', '650.121.2004', '1998-07-09', 'ST_CLERK', 2500.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (145, '约翰', '罗素', 'JRUSSEL', '011.44.1344.429268', '1996-10-01', 'SA_MAN', 14000.00, 0.40, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (146, '卡伦', '帕特纳斯', 'KPARTNER', '011.44.1344.467268', '1997-01-05', 'SA_MAN', 13500.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (147, '阿尔贝托', '埃拉苏里斯', 'AERRAZUR', '011.44.1344.429278', '1997-03-10', 'SA_MAN', 12000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (148, '杰拉德', '坎布劳特', 'GCAMBRAU', '011.44.1344.619268', '1999-10-15', 'SA_MAN', 11000.00, 0.30, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (149, '埃莱妮', '兹洛特基', 'EZLOTKEY', '011.44.1344.429018', '2000-01-29', 'SA_MAN', 10500.00, 0.20, 100, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (150, '彼得', '塔克', 'PTUCKER', '011.44.1344.129268', '1997-01-30', 'SA_REP', 10000.00, 0.30, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (151, '大卫', '伯恩斯坦', 'DBERNSTE', '011.44.1344.345268', '1997-03-24', 'SA_REP', 9500.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (152, '彼得', '霍尔', 'PHALL', '011.44.1344.478968', '1997-08-20', 'SA_REP', 9000.00, 0.25, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (153, '克里斯托弗', '奥尔森', 'COLSEN', '011.44.1344.498718', '1998-03-30', 'SA_REP', 8000.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (154, '娜妮特', '坎布劳特', 'NCAMBRAU', '011.44.1344.987668', '1998-12-09', 'SA_REP', 7500.00, 0.20, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (155, '奥利弗', '图沃尔特', 'OTUVAULT', '011.44.1344.486508', '1999-11-23', 'SA_REP', 7000.00, 0.15, 145, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (156, '詹妮特', '金', 'JKING', '011.44.1345.429268', '1996-01-30', 'SA_REP', 10000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (157, '帕特里克', '萨利', 'PSULLY', '011.44.1345.929268', '1996-03-04', 'SA_REP', 9500.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (158, '艾伦', '麦克尤恩', 'AMCEWEN', '011.44.1345.829268', '1996-08-01', 'SA_REP', 9000.00, 0.35, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (159, '林赛', '史密斯', 'LSMITH', '011.44.1345.729268', '1997-03-10', 'SA_REP', 8000.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (160, '路易斯', '多兰', 'LDORAN', '011.44.1345.629268', '1997-12-15', 'SA_REP', 7500.00, 0.30, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (161, '萨拉特', '肖尔', 'SSEWALL', '011.44.1345.529268', '1998-11-03', 'SA_REP', 7000.00, 0.25, 146, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (162, '克拉拉', '维什尼', 'CVISHNEY', '011.44.1346.129268', '1997-11-11', 'SA_REP', 10500.00, 0.25, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (163, '丹妮尔', '格林', 'DGREENE', '011.44.1346.229268', '1999-03-19', 'SA_REP', 9500.00, 0.15, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (164, '玛蒂亚', '马文斯', 'MMARVINS', '011.44.1346.329268', '2000-01-24', 'SA_REP', 7200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (165, '大卫', '李', 'DLEE', '011.44.1346.529268', '2000-02-23', 'SA_REP', 6800.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (166, '桑达尔', '安迪', 'SANDE', '011.44.1346.629268', '2000-03-24', 'SA_REP', 6400.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (167, '阿米特', '班达', 'ABANDA', '011.44.1346.729268', '2000-04-21', 'SA_REP', 6200.00, 0.10, 147, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (168, '丽莎', '奥泽尔', 'LOZER', '011.44.1343.929268', '1997-03-11', 'SA_REP', 11500.00, 0.25, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (169, '哈里森', '布鲁姆', 'HBLOOM', '011.44.1343.829268', '1998-03-23', 'SA_REP', 10000.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (170, '泰勒', '福克斯', 'TFOX', '011.44.1343.729268', '1998-01-24', 'SA_REP', 9600.00, 0.20, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (171, '威廉', '史密斯', 'WSMITH', '011.44.1343.629268', '1999-02-23', 'SA_REP', 7400.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (172, '伊丽莎白', '贝茨', 'EBATES', '011.44.1343.529268', '1999-03-24', 'SA_REP', 7300.00, 0.15, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (173, '桑迪塔', '库马尔', 'SKUMAR', '011.44.1343.329268', '2000-04-21', 'SA_REP', 6100.00, 0.10, 148, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (174, '艾伦', '阿贝尔', 'EABEL', '011.44.1644.429267', '1996-05-11', 'SA_REP', 11000.00, 0.30, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (175, '阿莉莎', '哈顿', 'AHUTTON', '011.44.1644.429266', '1997-03-19', 'SA_REP', 8800.00, 0.25, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (176, '乔纳森', '泰勒', 'JTAYLOR', '011.44.1644.429265', '1998-03-24', 'SA_REP', 8600.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (177, '杰克', '利文斯顿', 'JLIVINGS', '011.44.1644.429264', '1998-04-23', 'SA_REP', 8400.00, 0.20, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (178, '金柏莉', '格兰特', 'KGRANT', '011.44.1644.429263', '1999-05-24', 'SA_REP', 7000.00, 0.15, 149, NULL); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (179, '查尔斯', '约翰逊', 'CJOHNSON', '011.44.1644.429262', '2000-01-04', 'SA_REP', 6200.00, 0.10, 149, 80); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (180, '温斯顿', '泰勒', 'WTAYLOR', '650.507.9876', '1998-01-24', 'SH_CLERK', 3200.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (181, '简', '弗勒尔', 'JFLEAUR', '650.507.9877', '1998-02-23', 'SH_CLERK', 3100.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (182, '玛莎', '沙利文', 'MSULLIVA', '650.507.9878', '1999-06-21', 'SH_CLERK', 2500.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (183, '吉拉德', '格奥尼', 'GGEONI', '650.507.9879', '2000-02-03', 'SH_CLERK', 2800.00, NULL, 120, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (184, '南迪塔', '萨尔钦德', 'NSARCHAN', '650.509.1876', '1996-01-27', 'SH_CLERK', 4200.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (185, '亚历克西斯', '布尔', 'ABULL', '650.509.2876', '1997-02-20', 'SH_CLERK', 4100.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (186, '朱莉娅', '戴林格', 'JDELLING', '650.509.3876', '1998-06-24', 'SH_CLERK', 3400.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (187, '安东尼', '卡布里奥', 'ACABRIO', '650.509.4876', '1999-02-07', 'SH_CLERK', 3000.00, NULL, 121, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (188, '凯莉', '钟', 'KCHUNG', '650.505.1876', '1997-06-14', 'SH_CLERK', 3800.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (189, '詹妮弗', '迪利', 'JDILLY', '650.505.2876', '1997-08-13', 'SH_CLERK', 3600.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (190, '蒂莫西', '盖茨', 'TGATES', '650.505.3876', '1998-07-11', 'SH_CLERK', 2900.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (191, '兰达尔', '珀金斯', 'RPERKINS', '650.505.4876', '1999-12-19', 'SH_CLERK', 2500.00, NULL, 122, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (192, '萨拉', '贝尔', 'SBELL', '650.501.1876', '1996-02-04', 'SH_CLERK', 4000.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (193, '布里特尼', '埃弗雷特', 'BEVERETT', '650.501.2876', '1997-03-03', 'SH_CLERK', 3900.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (194, '塞缪尔', '麦凯恩', 'SMCCAIN', '650.501.3876', '1998-07-01', 'SH_CLERK', 3200.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (195, '范斯', '琼斯', 'VJONES', '650.501.4876', '1999-03-17', 'SH_CLERK', 2800.00, NULL, 123, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (196, '阿兰娜', '沃尔什', 'AWALSH', '650.507.9811', '1998-04-24', 'SH_CLERK', 3100.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (197, '凯文', '费尼', 'KFEENEY', '650.507.9822', '1998-05-23', 'SH_CLERK', 3000.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (198, '唐纳德', '奥康奈尔', 'DOCONNEL', '650.507.9833', '1999-06-21', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (199, '道格拉斯', '格兰特', 'DGRANT', '650.507.9844', '2000-01-13', 'SH_CLERK', 2600.00, NULL, 124, 50); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (200, '詹妮弗', '韦伦', 'JWHALEN', '515.123.4444', '1987-09-17', 'AD_ASST', 4400.00, NULL, 101, 10); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (201, '迈克尔', '哈滕斯坦', 'MHARTSTE', '515.123.5555', '1996-02-17', 'MK_MAN', 13000.00, NULL, 100, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (202, '帕特', '费伊', 'PFAY', '603.123.6666', '1997-08-17', 'MK_REP', 6000.00, NULL, 201, 20); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (203, '苏珊', '马夫里斯', 'SMAVRIS', '515.123.7777', '1994-06-07', 'HR_REP', 6500.00, NULL, 101, 40); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (204, '赫尔曼', '拜尔', 'HBAER', '515.123.8888', '1994-06-07', 'PR_REP', 10000.00, NULL, 101, 70); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (205, '谢莉', '希金斯', 'SHIGGINS', '515.123.8080', '1994-06-07', 'AC_MGR', 12000.00, NULL, 101, 110); -INSERT INTO `employees` (`employee_id`, `first_name`, `last_name`, `email`, `phone_number`, `hire_date`, `job_id`, `salary`, `commission_pct`, `manager_id`, `department_id`) VALUES (206, '威廉', '吉茨', 'WGIETZ', '515.123.8181', '1994-06-07', 'AC_ACCOUNT', 8300.00, NULL, 205, 110); -COMMIT; - --- ---------------------------- --- Table structure for job_grades --- ---------------------------- -DROP TABLE IF EXISTS `job_grades`; -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int DEFAULT NULL, - `highest_sal` int DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_grades --- ---------------------------- -BEGIN; -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('A', 1000, 2999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('B', 3000, 5999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('C', 6000, 9999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('D', 10000, 14999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('E', 15000, 24999); -INSERT INTO `job_grades` (`grade_level`, `lowest_sal`, `highest_sal`) VALUES ('F', 25000, 40000); -COMMIT; - --- ---------------------------- --- Table structure for job_history --- ---------------------------- -DROP TABLE IF EXISTS `job_history`; -CREATE TABLE `job_history` ( - `employee_id` int NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of job_history --- ---------------------------- -BEGIN; -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1989-09-21', '1993-10-27', 'AC_ACCOUNT', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (101, '1993-10-28', '1997-03-15', 'AC_MGR', 110); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (102, '1993-01-13', '1998-07-24', 'IT_PROG', 60); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (114, '1998-03-24', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (122, '1999-01-01', '1999-12-31', 'ST_CLERK', 50); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1998-03-24', '1998-12-31', 'SA_REP', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (176, '1999-01-01', '1999-12-31', 'SA_MAN', 80); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1987-09-17', '1993-06-17', 'AD_ASST', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (200, '1994-07-01', '1998-12-31', 'AC_ACCOUNT', 90); -INSERT INTO `job_history` (`employee_id`, `start_date`, `end_date`, `job_id`, `department_id`) VALUES (201, '1996-02-17', '1999-12-19', 'MK_REP', 20); -COMMIT; - --- ---------------------------- --- Table structure for jobs --- ---------------------------- -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int DEFAULT NULL, - `max_salary` int DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of jobs --- ---------------------------- -BEGIN; -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_ACCOUNT', '公共会计师', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AC_MGR', '会计经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_ASST', '行政助理', 3000, 6000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_PRES', '总裁', 20000, 40000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('AD_VP', '行政副总裁', 15000, 30000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_ACCOUNT', '会计', 4200, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('FI_MGR', '财务经理', 8200, 16000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('HR_REP', '人力资源代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('IT_PROG', '程序员', 4000, 10000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_MAN', '市场营销经理', 9000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('MK_REP', '市场营销代表', 4000, 9000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PR_REP', '公共关系代表', 4500, 10500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_CLERK', '采购文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('PU_MAN', '采购经理', 8000, 15000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_MAN', '销售经理', 10000, 20000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SA_REP', '销售代表', 6000, 12000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('SH_CLERK', '发货文员', 2500, 5500); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_CLERK', '库存文员', 2000, 5000); -INSERT INTO `jobs` (`job_id`, `job_title`, `min_salary`, `max_salary`) VALUES ('ST_MAN', '库存经理', 5500, 8500); -COMMIT; - --- ---------------------------- --- Table structure for locations --- ---------------------------- -DROP TABLE IF EXISTS `locations`; -CREATE TABLE `locations` ( - `location_id` int NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of locations --- ---------------------------- -BEGIN; -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1000, '1297 Via Cola di Rie', '00989', '罗马', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1100, '93091 Calle della Testa', '10934', '威尼斯', NULL, 'IT'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1200, '2017 Shinjuku-ku', '1689', '东京', '东京都', 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1300, '9450 Kamiya-cho', '6823', '广岛', NULL, 'JP'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1400, '2014 Jabberwocky Rd', '26192', '南湖', '德克萨斯', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1500, '2011 Interiors Blvd', '99236', '南旧金山', '加利福尼亚', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1600, '2007 Zagora St', '50090', '南布朗斯维克', '新泽西', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1700, '2004 Charade Rd', '98199', '西雅图', '华盛顿', 'US'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1800, '147 Spadina Ave', 'M5V 2L7', '多伦多', '安大略', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (1900, '6092 Boxwood St', 'YSW 9T2', '怀特霍斯', '育空', 'CA'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2000, '40-5-12 Laogianggen', '190518', '北京', NULL, 'CN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2100, '1298 Vileparle (E)', '490231', '孟买', '马哈拉施特拉邦', 'IN'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2200, '12-98 Victoria Street', '2901', '悉尼', '新南威尔士', 'AU'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2300, '198 Clementi North', '540198', '新加坡', NULL, 'SG'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2400, '8204 Arthur St', NULL, '伦敦', NULL, 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2500, 'Magdalen Centre, The Oxford Science Park', 'OX9 9ZB', '牛津', '牛津', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2600, '9702 Chester Road', '09629850293', '斯特雷福德', '曼彻斯特', 'UK'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2700, 'Schwanthalerstr. 7031', '80925', '慕尼黑', '巴伐利亚', 'DE'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2800, 'Rua Frei Caneca 1360 ', '01307-002', '圣保罗', '圣保罗', 'BR'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (2900, '20 Rue des Corps-Saints', '1730', '日内瓦', '日内瓦', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3000, 'Murtenstrasse 921', '3095', '伯尔尼', 'BE', 'CH'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3100, 'Pieter Breughelstraat 837', '3029SK', '乌得勒支', '乌得勒支', 'NL'); -INSERT INTO `locations` (`location_id`, `street_address`, `postal_code`, `city`, `state_province`, `country_id`) VALUES (3200, 'Mariano Escobedo 9991', '11932', '墨西哥城', '联邦区', 'MX'); -COMMIT; - --- ---------------------------- --- Table structure for order --- ---------------------------- -DROP TABLE IF EXISTS `order`; -CREATE TABLE `order` ( - `order_id` int DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of order --- ---------------------------- -BEGIN; -INSERT INTO `order` (`order_id`, `order_name`) VALUES (1, 'shkstart'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (2, 'tomcat'); -INSERT INTO `order` (`order_id`, `order_name`) VALUES (3, 'dubbo'); -COMMIT; - --- ---------------------------- --- Table structure for regions --- ---------------------------- -DROP TABLE IF EXISTS `regions`; -CREATE TABLE `regions` ( - `region_id` int NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3; - --- ---------------------------- --- Records of regions --- ---------------------------- -BEGIN; -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (1, '欧洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (2, '美洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (3, '亚洲'); -INSERT INTO `regions` (`region_id`, `region_name`) VALUES (4, '中东和非洲'); -COMMIT; - --- ---------------------------- --- View structure for emp_details_view --- ---------------------------- -DROP VIEW IF EXISTS `emp_details_view`; -CREATE ALGORITHM = UNDEFINED SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)); - -SET FOREIGN_KEY_CHECKS = 1; - -#第03章_基本的SELECT语句的课后练习 - -# 1.查询所有员工12个月的工资总和,并起别名为工资总和 -select sum(salary* 12) 工资总和 from employees; - -#理解1:计算12月的基本工资 - -#SELECT sum(salary*12) as 工资总和 FROM employees; - -#理解2:计算12月的基本工资和奖金 -select sum(salary*(1+IFNULL(commission_pct,0))*12) 工资和奖金和 from employees; -# ifnull(原值,新值) 判断一个原值是否为null,如果原值是null,就用一个新值代替 - - - -# 2.查询employees表中去除重复的job_id以后的数据 -#去除重复 distinct -select distinct job_id from employees; - - -# 3.查询工资大于12000的员工姓名和工资 -select first_name,salary from employees where salary>12000; - -# 4.查询员工号为176的员工的姓名和部门号 - -select first_name, department_id from employees where employee_id=176; -#; - -# 5.显示表 departments 的结构,并查询其中的全部数据 -desc departments; -select * from departments; - -# 第04章_运算符课后练习 - -# 1.选择工资不在5000到12000的员工的姓名和工资 -select first_name,salary from employees where salary not between 5000 and 12000; - - -# 2.选择在20或50号部门工作的员工姓名和部门号 - -select * from employees where department_id between 20 and 50; -# 3.选择公司中没有管理者的员工姓名及job_id -select * from employees where ISNULL(manager_id); - -# 4.选择公司中有奖金的员工姓名,工资和奖金级别 -select first_name ,salary*commission_pct , grade_level from employees -join job_grades -where salary*commission_pct between lowest_sal and highest_sal and commission_pct IS not NULL; - -# 5.选择员工姓名的第三个字是 尔 的员工姓名 -select last_name from employees where last_name like '__尔' -# 6.选择姓名中有 特 字和 尔 字的员工姓名 -select last_name from employees where last_name like '%特%' and last_name like '%尔%' - - -# 7.显示出表 employees 表中 first_name 以 '尔'结尾的员工信息 -select * from employees where first_name like '%尔' - - -# 8.显示出表 employees 部门编号在 80-100 之间的姓名、工种 -select last_name , job_id from employees where department_id between 80 and 100; - -# 9.显示出表 employees 的 manager_id 是 100,101,110 的员工姓名、工资、管理者id -select last_name,salary,manager_id from employees where manager_id in (100,101,110); - - -#第05章_排序与分页的课后练习 - - -#1. 查询员工的姓名和部门号和年薪,按年薪降序显示 -select last_name,department_id,salary*12 from employees ORDER BY salary desc; --- order by 年薪 asc/desc - -# - -#2. 选择工资不在 8000 到 17000 的员工的姓名和工资,按工资降序,显示第21到40位置的数据 - -select last_name,salary from employees where salary not between 8000 and 17000 ORDER BY salary desc LIMIT 20,20; - -#3. 查询邮箱中包含 e 的员工信息,并先按邮箱的字节数降序,再按部门号升序 -select * from employees where email like '%e%' ORDER BY length(email) desc ,department_id ; - -# 第06章_多表查询的课后练习 - - -# 1.显示所有员工的姓名,部门号和部门名称。 -select last_name,e1.department_id ,department_name from employees e1 join departments d1 on e1.department_id=d1.department_id; - -# 2.查询90号部门员工的job_id和90号部门的location_id -select e1.job_id,location_id from employees e1 -join departments d1 on e1.department_id=e1.department_id -where d1.department_id=90 GROUP BY job_id; - - - -# 3.选择所有 有奖金的员工 的 last_name , department_name , location_id , city - -select last_name , d1.department_name , l1.location_id , city from employees e1 -join departments d1 on e1.department_id=d1.department_id -join locations l1 on l1.location_id=d1.location_id -where commission_pct is not null ; - - -# 4.选择city在 多伦多 工作的员工的 last_name , job_id , department_id , department_name -select last_name , job_id , d1.department_id , department_name -from employees e1 -join departments d1 on e1.department_id=d1.department_id -join locations l1 on l1.location_id=d1.location_id -where city ='多伦多' ; - - -#sql92语法(自然连接): - - - - -# 5.查询行政部门员工的部门名称、部门地址、姓名、工作、工资 -select department_name,street_address,last_name,job_title ,salary from departments d1 , employees e1 ,locations l1 ,jobs j1 where d1.department_id=e1.department_id and d1.location_id=l1.location_id and j1.job_id=e1.job_id and department_name='行政部' - - - - - -# 6.显示所有员工的姓名,员工号,以及他的管理者的姓名和员工号,结果类似于下面的格式 --- 员工姓名 员工编号 上级姓名 上级的员工编号 --- 德哈恩 102 金 100 - -select e1.last_name,e1.employee_id,e2.last_name,e2.manager_id from employees e1 join employees e2 on e1.employee_id=e2.manager_id; - -select e1.last_name,e1.employee_id,e2.last_name,e2.manager_id from employees e1 ,employees e2 where e1.employee_id=e2.manager_id; - -# 7.查询哪些部门没有员工 - -select department_name from employees e1 right join departments d1 on e1.department_id=d1.department_id where employee_id is null ; -# 8. 查询哪个城市没有部门 -select city from departments d1 right join locations l1 on d1.location_id=l1.location_id where department_name is null; -# 9. 查询部门名为 销售部 或 信息技术部 的员工信息 -select * from departments d1 join employees e1 on d1.department_id=e1.department_id where department_name='销售部' or department_name='信息技术部' - - -# 第08章_聚合函数的课后练习 - - - -#2.查询公司员工工资的最大值,最小值,平均值,总和 -select max(salary),min(salary),avg(salary),sum(salary) from employees; - -#3.查询各job_id的员工工资的最大值,最小值,平均值,总和 -select job_id, max(salary),min(salary),avg(salary),sum(salary) from employees GROUP BY job_id; - -#4.选择各个job_id的员工人数 -select job_id ,count(employee_id)from employees GROUP BY job_id; -# 5.查询员工最高工资和最低工资的差距 -select max(salary)-min(salary) from employees; - - -# 6.查询各个管理者 手下员工的最低工资,其中最低工资不能低于6000,没有管理者的员工不计算在内 - - select manager_id,min(salary) from employees where salary>6000 and manager_id is not null group by manager_id - -# 7.查询所有部门的名字,location_id,员工数量和平均工资,并按平均工资降序 -select department_name,location_id ,COUNT(employee_id),avg(salary)from departments d1 , employees e1 where d1.department_id=e1.department_id group by department_name,location_id order by avg(salary) desc; - -# 8.查询每个工种、每个部门的部门名、工种名和最低工资 - -select department_name, job_title,min_salary from departments d1 -join employees e1 on d1.department_id=e1.department_id -join jobs j1 on j1.job_id=e1.job_id ; -# 第09章_子查询的课后练习 - - - -#1.查询和 兹洛特基 相同部门的员工姓名和工资 -select last_name , salary from employees where department_id = -(select e1.department_id from employees e1 join departments d1 on e1.department_id=d1.department_id where last_name='兹洛特基'); - -#2.查询工资比公司平均工资高的员工的员工号,姓名和工资。 -select employee_id ,last_name,salary from employees where salary >(select avg(salary) from employees ); - - -#3.选择工资大于所有JOB_ID = 'SA_MAN'的员工的工资的员工的last_name, job_id, salary - -select last_name, job_id, salary from employees where employee_id in -(select employee_id from employees where salary = -(select max(salary) from employees where job_id='sa_man')); - - - -#4.查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名 - - -select employee_id,last_name from employees where department_id in (select DISTINCT department_id from employees where email like '%u%') ORDER BY department_id; - - -#5.查询部门的location_id为1700的部门的工作的员工的员工号 -select employee_id from employees where department_id in (select department_id from departments where location_id=1700); - -#6.查询管理者是 金 的员工姓名和工资 -SELECT last_name, salaryFROM employees WHERE manager_id IN (SELECT employee_id FROM employees WHERE last_name = '金'); - -#7.查询工资最低的员工信息: last_name, salary -select last_name,salary from employees where salary =(select min(salary) from employees ) -#8.查询平均工资最低的部门信息 - -#方式1: -# 部门最低工资=全司最低 - --- A: -SELECT d.department_id, d.department_name, AVG(e.salary) AS average_salary -FROM departments d -JOIN employees e ON d.department_id = e.department_id -GROUP BY d.department_id, d.department_name -ORDER BY average_salary -LIMIT 1; - - - --- B: -select * from departments d1 where d1.department_id=( -SELECT d.department_id -FROM departments d -JOIN employees e ON d.department_id = e.department_id -GROUP BY d.department_id -HAVING AVG(e.salary) = (SELECT MIN(avg_salary) -FROM (SELECT AVG(salary) AS avg_salary -FROM employees -GROUP BY department_id) AS temp)); - -#方式2: -# 部门平均<= 公司所有平均 - - - - - -#9.查询平均工资最低的部门信息和该部门的平均工资(相关子查询) -#方式:先查最低平均工资的部门,再根据其id去select中再子查询 -SELECT * -FROM departments d1 -JOIN ( - SELECT AVG(salary) avg_salary, department_id - FROM employees - WHERE department_id IS NOT NULL - GROUP BY department_id -) a ON d1.department_id = a.department_id -WHERE a.department_id = ( - SELECT department_id - FROM ( - SELECT AVG(salary) avg_salary, department_id - FROM employees - WHERE department_id IS NOT NULL - GROUP BY department_id - ) b - WHERE avg_salary = ( - SELECT MIN(avg_salary) min_avg - FROM ( - SELECT AVG(salary) avg_salary, department_id - FROM employees - WHERE department_id IS NOT NULL - GROUP BY department_id - ) AS c - ) -); - -#10.查询平均工资最高的 job 信息 - -#方式1:平均工资=最大 - -#方式2:平均工资>=所有平均工资 - - - - -#11.查询平均工资高于公司平均工资的部门有哪些? - - - - -#12.查询出公司中所有 manager 的详细信息 - -#方式1:自连接 自己连自己 -select * from employees e1 join employees e2 on e1.employee_id=e2.manager_id; - -#方式2:子查询 -#员工编号=(管理员编号有哪些) - - -#13.各个部门中 最高工资中 最低的那个部门的 最低工资是多少? - - - -#方式: - - - - - - -#14.查询平均工资最高的部门的 manager 的详细信息: last_name, department_id, email, salary -#方式1: - - - -#15. 查询部门的部门号,其中不包括job_id是"ST_CLERK"的部门号 -#方式1: - - - - - -#16. 选择所有没有管理者的员工的last_name -select last_name from employees where manager_id is null; - - -#17.查询员工号、姓名、雇用时间、工资,其中员工的管理者为 'De Haan' -#方式1: -SELECT e1.employee_id, e1.first_name, e1.hire_date, e1.salary -FROM departments d1 -JOIN employees e1 ON d1.department_id = e1.department_id -WHERE e1.manager_id IN (SELECT employee_id FROM employees e2 WHERE e2.last_name = '格林伯格'); -#方式2: - - -#18.查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资(相关子查询) - -#方式1:使用相关子查询 - - -#方式2:在FROM中声明子查询 - - - -#19.查询每个部门下的部门人数大于 5 的部门名称(相关子查询) - - - -#20.查询每个国家下的部门个数大于 2 的国家编号(相关子查询) - -/* -子查询的编写技巧(或步骤):① 从里往外写 ② 从外往里写 - -如何选择? -① 如果子查询相对较简单,建议从外往里写。一旦子查询结构较复杂,则建议从里往外写 -② 如果是相关子查询的话,通常都是从外往里写。 - -*/ -``` \ No newline at end of file diff --git "a/59 \346\236\227\345\263\260/9\346\234\21020.md" "b/59 \346\236\227\345\263\260/9\346\234\21020.md" deleted file mode 100644 index 3741bf6baeacaabee6e3098acc650f8331cf8ecf..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\21020.md" +++ /dev/null @@ -1,129 +0,0 @@ -- 笔记 - - RBAC : 基于角色访问控制权限 - - 一个控制模型 - - **角色**是RBAC是的核心 - - RBAC是主流设计模式 - - #### 数据库能存什么 - - 1. 业务数据表:用户、商品 - 2. 功能资源表:菜单信息表、页面代码表 - - #### 权限使用背景 - - 菜单权限: 不同用户登录系统后,展示菜单不同 - - 按钮权限:不同用户查看同一个对象时,展示按钮不一样 - - 数据权限:可见数据不同 - - 操作权限:看得到点不着 例如:腾讯视频VIP你可以看到视频但是不可以播放 - - #### RBAC由三个部分组成 - - 1. 用户 - 2. 角色 - 3. 权限 - - - User(用户):每个用户都有唯一的UID识别,并被授予不同的角色 - - Role(角色):不同角色具有不同的权限 - - Permission(权限):访问权限 - - 用户-角色映射:用户和角色之间的映射关系 - - 角色-权限映射:角色和权限之间的映射 - - 权限关联实现授权,给用户分配应当有的对应权限 - - ##### RBAC的优点: - - 简化了用户和权限的关系 - - 易扩展,易维护 - - ##### 缺点: - - RBAC模型没有提供操作顺序的控制机制,这一缺陷得RBAC模型很难适应那些对操作次序有严格要求的系统 - - ``` - /*==============================================================*/ - /* DBMS name: MySQL 5.0 */ - /* Created on: 2023-09-20 15:24:17 */ - /*==============================================================*/ - - - drop table if exists jurisdiction; - - drop table if exists personal; - - drop table if exists personal_role; - - drop table if exists role; - - drop table if exists role_jurisdiction; - - /*==============================================================*/ - /* Table: jurisdiction */ - /*==============================================================*/ - create table jurisdiction - ( - jurisdiction_id int not null auto_increment, - jurisdiction_name varchar(50) not null, - primary key (jurisdiction_id) - ); - - /*==============================================================*/ - /* Table: personal */ - /*==============================================================*/ - create table personal - ( - personal_id int not null auto_increment, - personal_name varchar(11) not null, - personal_pwd varchar(11) not null, - primary key (personal_id) - ); - - /*==============================================================*/ - /* Table: personal_role */ - /*==============================================================*/ - create table personal_role - ( - role_id int not null, - personal_id int not null, - primary key (role_id, personal_id) - ); - - /*==============================================================*/ - /* Table: role */ - /*==============================================================*/ - create table role - ( - role_id int not null auto_increment, - role_name varchar(50) not null, - primary key (role_id) - ); - - /*==============================================================*/ - /* Table: role_jurisdiction */ - /*==============================================================*/ - create table role_jurisdiction - ( - jurisdiction_id int not null, - role_id int not null, - primary key (jurisdiction_id, role_id) - ); - - alter table personal_role add constraint FK_personal_role foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - - alter table personal_role add constraint FK_personal_role2 foreign key (personal_id) - references personal (personal_id) on delete restrict on update restrict; - - alter table role_jurisdiction add constraint FK_role_jurisdiction foreign key (jurisdiction_id) - references jurisdiction (jurisdiction_id) on delete restrict on update restrict; - - alter table role_jurisdiction add constraint FK_role_jurisdiction2 foreign key (role_id) - references role (role_id) on delete restrict on update restrict; - ``` \ No newline at end of file diff --git "a/59 \346\236\227\345\263\260/9\346\234\21021\346\227\245.md" "b/59 \346\236\227\345\263\260/9\346\234\21021\346\227\245.md" deleted file mode 100644 index ad28ab45f9423b9b5eb5cff5b96418befb7a3b0e..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\21021\346\227\245.md" +++ /dev/null @@ -1,147 +0,0 @@ -SKU: - - SKU=stock keeping unit(库存量单位) SKU即库存进出计量的单位(买家购买、商家进货、[供应商](https://gitee.com/link?target=https%3A%2F%2Fwww.zhihu.com%2Fsearch%3Fq%3D%E4%BE%9B%E5%BA%94%E5%95%86%26search_source%3DEntity%26hybrid_search_source%3DEntity%26hybrid_search_extra%3D%7B%22sourceType%22%3A%22answer%22%2C%22sourceId%22%3A616073286%7D)备货、工厂生产都是依据SKU进行的),在服装、鞋类商品中使用最多最普遍。 例如纺织品中一个SKU通常表示:规格、颜色、款式。 SKU是物理上不可分割的最小存货单元。也就是说一款商品,可以根据SKU来确定具体的货物存量。 sku 属性(会影响到库存和价格的属性, 又叫销售属性)---规格 - -``` -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-21 16:17:57 */ -/*==============================================================*/ -create database jd character set utf8; -use jd; - -drop table if exists attribute; - -drop table if exists attribute_value; - -drop table if exists rele; - -drop table if exists sku; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attribute */ -/*==============================================================*/ -create table attribute -( - attribute_id int not null auto_increment, - attribute_name varchar(10) not null, - primary key (attribute_id) -); - -/*==============================================================*/ -/* Table: attribute_value */ -/*==============================================================*/ -create table attribute_value -( - value_id int not null auto_increment, - value_content varchar(50) not null, - primary key (value_id) -); - -/*==============================================================*/ -/* Table: rele */ -/*==============================================================*/ -create table rele -( - rele_id int not null auto_increment, - sku_id int, - attribute_id int, - value_id int, - primary key (rele_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price decimal(9,2) not null, - sku_stock int not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(10) not null, - spu_test varchar(100) not null, - primary key (spu_id) -); - -alter table rele add constraint FK_attribute_rele foreign key (attribute_id) - references attribute (attribute_id) on delete restrict on update restrict; - -alter table rele add constraint FK_sku_rele foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table rele add constraint FK_value_rele foreign key (value_id) - references attribute_value (value_id) on delete restrict on update restrict; - -alter table sku add constraint FK_spu_sku foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - --- 商品 -insert into spu values (1,"华为","国货之光"); - --- 规格 -insert into sku values -(1,1,"华为mate60 黑色 256G",6999,10), -(2,1,"华为mate60 白色 256G",6999,20), -(3,1,"华为mate60 蓝色 256G",6999,0), -(4,1,"华为mate60 黑色 512G",7999,1), -(5,1,"华为mate60 白色 512G",7999,2), -(6,1,"华为mate60 蓝色 512G",7999,10); - --- 属性 -insert into attribute values -(1,"颜色"), -(2,"内存"); - --- 属性值 -insert into attribute_value values -(1,"黑色"), -(2,"白色"), -(3,"蓝色"), -(4,"256G"), -(5,"512G"); - --- 关联 -insert into rele values -(1,1,1,1), -(2,1,2,4), -(3,2,1,2), -(4,2,2,4), -(5,3,1,3), -(6,3,2,4), -(7,4,1,1), -(8,4,2,5), -(9,5,1,2), -(10,5,2,5), -(11,6,1,3), -(12,6,2,5); - - -select a.spu_id,b.sku_id,b.sku_name,b.sku_price,b.sku_stock from - spu a,sku b,attribute c,attribute_value d,rele e -where -a.spu_id = b.spu_id -and b.sku_id = e.sku_id -and c.attribute_id = e.attribute_id -and d.value_id = e.value_id -and b.sku_id = -( -select aa.sku_id from -(select sku_id from attribute, attribute_value , rele where attribute.attribute_id =rele.attribute_id and attribute_value.value_id = rele.value_id and value_content = "白色" ) aa -, -(select sku_id from attribute, attribute_value , rele where attribute.attribute_id =rele.attribute_id and attribute_value.value_id = rele.value_id and value_content = "256G" ) bb -where aa.sku_id = bb.sku_id -) limit 0,1; -``` \ No newline at end of file diff --git "a/59 \346\236\227\345\263\260/9\346\234\21022\346\227\245.md" "b/59 \346\236\227\345\263\260/9\346\234\21022\346\227\245.md" deleted file mode 100644 index 8ef6553ff1f2459127df51a21d71261357a00078..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\21022\346\227\245.md" +++ /dev/null @@ -1,130 +0,0 @@ -- ## 笔记: - -- SPU(Standard Product Unit ):指的是标准商品单位,商品信息聚合的最小单位,是一组可复用、易检索的标准化信息的集合,该集合描述了一个商品的特性; - -- SKU(Stock Keeping Unit):库存量单位,是物理上不可分割的最小存货单元。 - -```` -``` mysql -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-22 09:09:19 */ -/*==============================================================*/ -create database tt character set utf8; -use tt; - -drop table if exists attributes; - -drop table if exists attributes_values; - -drop table if exists rele; - -drop table if exists sku; - -drop table if exists spu; - -/*==============================================================*/ -/* Table: attributes */ -/*==============================================================*/ -create table attributes -( - attributes_id int not null auto_increment, - attributes_name varchar(10) not null, - primary key (attributes_id) -); - -/*==============================================================*/ -/* Table: attributes_values */ -/*==============================================================*/ -create table attributes_values -( - values_id int not null auto_increment, - values_test varchar(20) not null, - primary key (values_id) -); - -/*==============================================================*/ -/* Table: rele */ -/*==============================================================*/ -create table rele -( - rele_id int not null auto_increment, - sku_id int, - attributes_id int, - values_id int, - primary key (rele_id) -); - -/*==============================================================*/ -/* Table: sku */ -/*==============================================================*/ -create table sku -( - sku_id int not null auto_increment, - spu_id int, - sku_name varchar(50) not null, - sku_price decimal(6,2) not null, - sku_add varchar(20) not null, - primary key (sku_id) -); - -/*==============================================================*/ -/* Table: spu */ -/*==============================================================*/ -create table spu -( - spu_id int not null auto_increment, - spu_name varchar(20) not null, - spu_text varchar(255) not null, - primary key (spu_id) -); - -alter table rele add constraint FK_attributes_rele foreign key (attributes_id) - references attributes (attributes_id) on delete restrict on update restrict; - -alter table rele add constraint FK_sku_rele foreign key (sku_id) - references sku (sku_id) on delete restrict on update restrict; - -alter table rele add constraint FK_values_rele foreign key (values_id) - references attributes_values (values_id) on delete restrict on update restrict; - -alter table sku add constraint FK_spu_sku foreign key (spu_id) - references spu (spu_id) on delete restrict on update restrict; - -# 查询1 -select a.spu_id,b.sku_id,b.sku_name,b.sku_price,b.sku_add - from spu a,sku b,attributes c,attributes_values d,rele e -where - a.spu_id = b.spu_id - and b.sku_id = e.sku_id - and c.attributes_id = e.attributes_id - and d.values_id = e.values_id ; - -# 查询2 -select a.spu_id,b.sku_id,b.sku_name,b.sku_price,b.sku_add -from spu a,sku b,attributes c,attributes_values d,rele e -where - a.spu_id = b.spu_id - and b.sku_id = e.sku_id - and c.attributes_id = e.attributes_id - and d.values_id = e.values_id -and b.sku_id = -( -select aa.sku_id from -(select sku_id from attributes, attributes_values , rele where attributes.attributes_id =rele.attributes_id and attributes_values.values_id = rele.values_id and values_test = "黑猪" ) aa -, -(select sku_id from attributes, attributes_values , rele where attributes.attributes_id =rele.attributes_id and attributes_values.values_id = rele.values_id and values_test = "200g" ) bb -, -(select sku_id from attributes, attributes_values , rele where attributes.attributes_id =rele.attributes_id and attributes_values.values_id = rele.values_id and values_test = "1包" ) cc -where aa.sku_id = bb.sku_id -and bb.sku_id = cc.sku_id -); - -``` - -![image-20230924163547326](https://s2.loli.net/2023/09/24/Z2dPCAgzaEhxJ9D.png) - -![image-20230924163617602](https://s2.loli.net/2023/09/24/skBJgn37QxUcXWV.png) - -![image-20230924163634393](https://s2.loli.net/2023/09/24/YIxF2dmAqj751Zl.png) -```` \ No newline at end of file diff --git "a/59 \346\236\227\345\263\260/9\346\234\21026\346\227\245.md" "b/59 \346\236\227\345\263\260/9\346\234\21026\346\227\245.md" deleted file mode 100644 index a39d88fccd649505557edc506108f78177d7e784..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\21026\346\227\245.md" +++ /dev/null @@ -1,285 +0,0 @@ -check 一种约束 例如:check(字段 in('男','女')) utf8中 1个汉字占用3个字节 length() 获取字节长度 concat(字段1,字段2,...) 连接两个或者多个字段在一个字段里 视图: 虚拟表,建立在已有在表在基础上 如果视图中数据是来自于一个表时,修改视图中的数据,表数据会更新。而且修改表中数据时,对应视图也会更新。但是如果视图数据来源于两个表时,修改视图数据时会报错,无法修改。 作用:1、有利于数据的安全性 2、方便查看 3、减少操作的冗余 - -``` -/* -SQLyog Ultimate v12.08 (64 bit) -MySQL - 5.7.28-log : Database - view_db - -********************************************************************* - -*/ - - -/*!40101 SET NAMES utf8 */; - -/*!40101 SET SQL_MODE=''*/; - -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; -CREATE DATABASE /*!32312 IF NOT EXISTS*/`view_db` /*!40100 DEFAULT CHARACTER SET utf8 */; - -USE `view_db`; - -/*Table structure for table `countries` */ - -DROP TABLE IF EXISTS `countries`; - -CREATE TABLE `countries` ( - `country_id` char(2) NOT NULL, - `country_name` varchar(40) DEFAULT NULL, - `region_id` int(11) DEFAULT NULL, - PRIMARY KEY (`country_id`), - KEY `countr_reg_fk` (`region_id`), - CONSTRAINT `countr_reg_fk` FOREIGN KEY (`region_id`) REFERENCES `regions` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `countries` */ - -insert into `countries`(`country_id`,`country_name`,`region_id`) values ('AR','Argentina',2),('AU','Australia',3),('BE','Belgium',1),('BR','Brazil',2),('CA','Canada',2),('CH','Switzerland',1),('CN','China',3),('DE','Germany',1),('DK','Denmark',1),('EG','Egypt',4),('FR','France',1),('HK','HongKong',3),('IL','Israel',4),('IN','India',3),('IT','Italy',1),('JP','Japan',3),('KW','Kuwait',4),('MX','Mexico',2),('NG','Nigeria',4),('NL','Netherlands',1),('SG','Singapore',3),('UK','United Kingdom',1),('US','United States of America',2),('ZM','Zambia',4),('ZW','Zimbabwe',4); - -/*Table structure for table `departments` */ - -DROP TABLE IF EXISTS `departments`; - -CREATE TABLE `departments` ( - `department_id` int(4) NOT NULL DEFAULT '0', - `department_name` varchar(30) NOT NULL, - `manager_id` int(6) DEFAULT NULL, - `location_id` int(4) DEFAULT NULL, - PRIMARY KEY (`department_id`), - UNIQUE KEY `dept_id_pk` (`department_id`), - KEY `dept_loc_fk` (`location_id`), - KEY `dept_mgr_fk` (`manager_id`), - CONSTRAINT `dept_loc_fk` FOREIGN KEY (`location_id`) REFERENCES `locations` (`location_id`), - CONSTRAINT `dept_mgr_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `departments` */ - -insert into `departments`(`department_id`,`department_name`,`manager_id`,`location_id`) values (10,'Administration',200,1700),(20,'Marketing',201,1800),(30,'Purchasing',114,1700),(40,'Human Resources',203,2400),(50,'Shipping',121,1500),(60,'IT',103,1400),(70,'Public Relations',204,2700),(80,'Sales',145,2500),(90,'Executive',100,1700),(100,'Finance',108,1700),(110,'Accounting',205,1700),(120,'Treasury',NULL,1700),(130,'Corporate Tax',NULL,1700),(140,'Control And Credit',NULL,1700),(150,'Shareholder Services',NULL,1700),(160,'Benefits',NULL,1700),(170,'Manufacturing',NULL,1700),(180,'Construction',NULL,1700),(190,'Contracting',NULL,1700),(200,'Operations',NULL,1700),(210,'IT Support',NULL,1700),(220,'NOC',NULL,1700),(230,'IT Helpdesk',NULL,1700),(240,'Government Sales',NULL,1700),(250,'Retail Sales',NULL,1700),(260,'Recruiting',NULL,1700),(270,'Payroll',NULL,1700); - -/*Table structure for table `employees` */ - -DROP TABLE IF EXISTS `employees`; - -CREATE TABLE `employees` ( - `employee_id` int(6) NOT NULL DEFAULT '0', - `first_name` varchar(20) DEFAULT NULL, - `last_name` varchar(25) NOT NULL, - `email` varchar(25) NOT NULL, - `phone_number` varchar(20) DEFAULT NULL, - `hire_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `salary` double(8,2) DEFAULT NULL, - `commission_pct` double(2,2) DEFAULT NULL, - `manager_id` int(6) DEFAULT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`), - UNIQUE KEY `emp_email_uk` (`email`), - UNIQUE KEY `emp_emp_id_pk` (`employee_id`), - KEY `emp_dept_fk` (`department_id`), - KEY `emp_job_fk` (`job_id`), - KEY `emp_manager_fk` (`manager_id`), - CONSTRAINT `emp_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `emp_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`), - CONSTRAINT `emp_manager_fk` FOREIGN KEY (`manager_id`) REFERENCES `employees` (`employee_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `employees` */ - -insert into `employees`(`employee_id`,`first_name`,`last_name`,`email`,`phone_number`,`hire_date`,`job_id`,`salary`,`commission_pct`,`manager_id`,`department_id`) values (100,'Steven','King','SKING','515.123.4567','1987-06-17','AD_PRES',24000.00,NULL,NULL,90),(101,'Neena','Kochhar','NKOCHHAR','515.123.4568','1989-09-21','AD_VP',17000.00,NULL,100,90),(102,'Lex','De Haan','LDEHAAN','515.123.4569','1993-01-13','AD_VP',17000.00,NULL,100,90),(103,'Alexander','Hunold','AHUNOLD','590.423.4567','1990-01-03','IT_PROG',9000.00,NULL,102,60),(104,'Bruce','Ernst','BERNST','590.423.4568','1991-05-21','IT_PROG',6000.00,NULL,103,60),(105,'David','Austin','DAUSTIN','590.423.4569','1997-06-25','IT_PROG',4800.00,NULL,103,60),(106,'Valli','Pataballa','VPATABAL','590.423.4560','1998-02-05','IT_PROG',4800.00,NULL,103,60),(107,'Diana','Lorentz','DLORENTZ','590.423.5567','1999-02-07','IT_PROG',4200.00,NULL,103,60),(108,'Nancy','Greenberg','NGREENBE','515.124.4569','1994-08-17','FI_MGR',12000.00,NULL,101,100),(109,'Daniel','Faviet','DFAVIET','515.124.4169','1994-08-16','FI_ACCOUNT',9000.00,NULL,108,100),(110,'John','Chen','JCHEN','515.124.4269','1997-09-28','FI_ACCOUNT',8200.00,NULL,108,100),(111,'Ismael','Sciarra','ISCIARRA','515.124.4369','1997-09-30','FI_ACCOUNT',7700.00,NULL,108,100),(112,'Jose Manuel','Urman','JMURMAN','515.124.4469','1998-03-07','FI_ACCOUNT',7800.00,NULL,108,100),(113,'Luis','Popp','LPOPP','515.124.4567','1999-12-07','FI_ACCOUNT',6900.00,NULL,108,100),(114,'Den','Raphaely','DRAPHEAL','515.127.4561','1994-12-07','PU_MAN',11000.00,NULL,100,30),(115,'Alexander','Khoo','AKHOO','515.127.4562','1995-05-18','PU_CLERK',3100.00,NULL,114,30),(116,'Shelli','Baida','SBAIDA','515.127.4563','1997-12-24','PU_CLERK',2900.00,NULL,114,30),(117,'Sigal','Tobias','STOBIAS','515.127.4564','1997-07-24','PU_CLERK',2800.00,NULL,114,30),(118,'Guy','Himuro','GHIMURO','515.127.4565','1998-11-15','PU_CLERK',2600.00,NULL,114,30),(119,'Karen','Colmenares','KCOLMENA','515.127.4566','1999-08-10','PU_CLERK',2500.00,NULL,114,30),(120,'Matthew','Weiss','MWEISS','650.123.1234','1996-07-18','ST_MAN',8000.00,NULL,100,50),(121,'Adam','Fripp','AFRIPP','650.123.2234','1997-04-10','ST_MAN',8200.00,NULL,100,50),(122,'Payam','Kaufling','PKAUFLIN','650.123.3234','1995-05-01','ST_MAN',7900.00,NULL,100,50),(123,'Shanta','Vollman','SVOLLMAN','650.123.4234','1997-10-10','ST_MAN',6500.00,NULL,100,50),(124,'Kevin','Mourgos','KMOURGOS','650.123.5234','1999-11-16','ST_MAN',5800.00,NULL,100,50),(125,'Julia','Nayer','JNAYER','650.124.1214','1997-07-16','ST_CLERK',3200.00,NULL,120,50),(126,'Irene','Mikkilineni','IMIKKILI','650.124.1224','1998-09-28','ST_CLERK',2700.00,NULL,120,50),(127,'James','Landry','JLANDRY','650.124.1334','1999-01-14','ST_CLERK',2400.00,NULL,120,50),(128,'Steven','Markle','SMARKLE','650.124.1434','2000-03-08','ST_CLERK',2200.00,NULL,120,50),(129,'Laura','Bissot','LBISSOT','650.124.5234','1997-08-20','ST_CLERK',3300.00,NULL,121,50),(130,'Mozhe','Atkinson','MATKINSO','650.124.6234','1997-10-30','ST_CLERK',2800.00,NULL,121,50),(131,'James','Marlow','JAMRLOW','650.124.7234','1997-02-16','ST_CLERK',2500.00,NULL,121,50),(132,'TJ','Olson','TJOLSON','650.124.8234','1999-04-10','ST_CLERK',2100.00,NULL,121,50),(133,'Jason','Mallin','JMALLIN','650.127.1934','1996-06-14','ST_CLERK',3300.00,NULL,122,50),(134,'Michael','Rogers','MROGERS','650.127.1834','1998-08-26','ST_CLERK',2900.00,NULL,122,50),(135,'Ki','Gee','KGEE','650.127.1734','1999-12-12','ST_CLERK',2400.00,NULL,122,50),(136,'Hazel','Philtanker','HPHILTAN','650.127.1634','2000-02-06','ST_CLERK',2200.00,NULL,122,50),(137,'Renske','Ladwig','RLADWIG','650.121.1234','1995-07-14','ST_CLERK',3600.00,NULL,123,50),(138,'Stephen','Stiles','SSTILES','650.121.2034','1997-10-26','ST_CLERK',3200.00,NULL,123,50),(139,'John','Seo','JSEO','650.121.2019','1998-02-12','ST_CLERK',2700.00,NULL,123,50),(140,'Joshua','Patel','JPATEL','650.121.1834','1998-04-06','ST_CLERK',2500.00,NULL,123,50),(141,'Trenna','Rajs','TRAJS','650.121.8009','1995-10-17','ST_CLERK',3500.00,NULL,124,50),(142,'Curtis','Davies','CDAVIES','650.121.2994','1997-01-29','ST_CLERK',3100.00,NULL,124,50),(143,'Randall','Matos','RMATOS','650.121.2874','1998-03-15','ST_CLERK',2600.00,NULL,124,50),(144,'Peter','Vargas','PVARGAS','650.121.2004','1998-07-09','ST_CLERK',2500.00,NULL,124,50),(145,'John','Russell','JRUSSEL','011.44.1344.429268','1996-10-01','SA_MAN',14000.00,0.40,100,80),(146,'Karen','Partners','KPARTNER','011.44.1344.467268','1997-01-05','SA_MAN',13500.00,0.30,100,80),(147,'Alberto','Errazuriz','AERRAZUR','011.44.1344.429278','1997-03-10','SA_MAN',12000.00,0.30,100,80),(148,'Gerald','Cambrault','GCAMBRAU','011.44.1344.619268','1999-10-15','SA_MAN',11000.00,0.30,100,80),(149,'Eleni','Zlotkey','EZLOTKEY','011.44.1344.429018','2000-01-29','SA_MAN',10500.00,0.20,100,80),(150,'Peter','Tucker','PTUCKER','011.44.1344.129268','1997-01-30','SA_REP',10000.00,0.30,145,80),(151,'David','Bernstein','DBERNSTE','011.44.1344.345268','1997-03-24','SA_REP',9500.00,0.25,145,80),(152,'Peter','Hall','PHALL','011.44.1344.478968','1997-08-20','SA_REP',9000.00,0.25,145,80),(153,'Christopher','Olsen','COLSEN','011.44.1344.498718','1998-03-30','SA_REP',8000.00,0.20,145,80),(154,'Nanette','Cambrault','NCAMBRAU','011.44.1344.987668','1998-12-09','SA_REP',7500.00,0.20,145,80),(155,'Oliver','Tuvault','OTUVAULT','011.44.1344.486508','1999-11-23','SA_REP',7000.00,0.15,145,80),(156,'Janette','King','JKING','011.44.1345.429268','1996-01-30','SA_REP',10000.00,0.35,146,80),(157,'Patrick','Sully','PSULLY','011.44.1345.929268','1996-03-04','SA_REP',9500.00,0.35,146,80),(158,'Allan','McEwen','AMCEWEN','011.44.1345.829268','1996-08-01','SA_REP',9000.00,0.35,146,80),(159,'Lindsey','Smith','LSMITH','011.44.1345.729268','1997-03-10','SA_REP',8000.00,0.30,146,80),(160,'Louise','Doran','LDORAN','011.44.1345.629268','1997-12-15','SA_REP',7500.00,0.30,146,80),(161,'Sarath','Sewall','SSEWALL','011.44.1345.529268','1998-11-03','SA_REP',7000.00,0.25,146,80),(162,'Clara','Vishney','CVISHNEY','011.44.1346.129268','1997-11-11','SA_REP',10500.00,0.25,147,80),(163,'Danielle','Greene','DGREENE','011.44.1346.229268','1999-03-19','SA_REP',9500.00,0.15,147,80),(164,'Mattea','Marvins','MMARVINS','011.44.1346.329268','2000-01-24','SA_REP',7200.00,0.10,147,80),(165,'David','Lee','DLEE','011.44.1346.529268','2000-02-23','SA_REP',6800.00,0.10,147,80),(166,'Sundar','Ande','SANDE','011.44.1346.629268','2000-03-24','SA_REP',6400.00,0.10,147,80),(167,'Amit','Banda','ABANDA','011.44.1346.729268','2000-04-21','SA_REP',6200.00,0.10,147,80),(168,'Lisa','Ozer','LOZER','011.44.1343.929268','1997-03-11','SA_REP',11500.00,0.25,148,80),(169,'Harrison','Bloom','HBLOOM','011.44.1343.829268','1998-03-23','SA_REP',10000.00,0.20,148,80),(170,'Tayler','Fox','TFOX','011.44.1343.729268','1998-01-24','SA_REP',9600.00,0.20,148,80),(171,'William','Smith','WSMITH','011.44.1343.629268','1999-02-23','SA_REP',7400.00,0.15,148,80),(172,'Elizabeth','Bates','EBATES','011.44.1343.529268','1999-03-24','SA_REP',7300.00,0.15,148,80),(173,'Sundita','Kumar','SKUMAR','011.44.1343.329268','2000-04-21','SA_REP',6100.00,0.10,148,80),(174,'Ellen','Abel','EABEL','011.44.1644.429267','1996-05-11','SA_REP',11000.00,0.30,149,80),(175,'Alyssa','Hutton','AHUTTON','011.44.1644.429266','1997-03-19','SA_REP',8800.00,0.25,149,80),(176,'Jonathon','Taylor','JTAYLOR','011.44.1644.429265','1998-03-24','SA_REP',8600.00,0.20,149,80),(177,'Jack','Livingston','JLIVINGS','011.44.1644.429264','1998-04-23','SA_REP',8400.00,0.20,149,80),(178,'Kimberely','Grant','KGRANT','011.44.1644.429263','1999-05-24','SA_REP',7000.00,0.15,149,NULL),(179,'Charles','Johnson','CJOHNSON','011.44.1644.429262','2000-01-04','SA_REP',6200.00,0.10,149,80),(180,'Winston','Taylor','WTAYLOR','650.507.9876','1998-01-24','SH_CLERK',3200.00,NULL,120,50),(181,'Jean','Fleaur','JFLEAUR','650.507.9877','1998-02-23','SH_CLERK',3100.00,NULL,120,50),(182,'Martha','Sullivan','MSULLIVA','650.507.9878','1999-06-21','SH_CLERK',2500.00,NULL,120,50),(183,'Girard','Geoni','GGEONI','650.507.9879','2000-02-03','SH_CLERK',2800.00,NULL,120,50),(184,'Nandita','Sarchand','NSARCHAN','650.509.1876','1996-01-27','SH_CLERK',4200.00,NULL,121,50),(185,'Alexis','Bull','ABULL','650.509.2876','1997-02-20','SH_CLERK',4100.00,NULL,121,50),(186,'Julia','Dellinger','JDELLING','650.509.3876','1998-06-24','SH_CLERK',3400.00,NULL,121,50),(187,'Anthony','Cabrio','ACABRIO','650.509.4876','1999-02-07','SH_CLERK',3000.00,NULL,121,50),(188,'Kelly','Chung','KCHUNG','650.505.1876','1997-06-14','SH_CLERK',3800.00,NULL,122,50),(189,'Jennifer','Dilly','JDILLY','650.505.2876','1997-08-13','SH_CLERK',3600.00,NULL,122,50),(190,'Timothy','Gates','TGATES','650.505.3876','1998-07-11','SH_CLERK',2900.00,NULL,122,50),(191,'Randall','Perkins','RPERKINS','650.505.4876','1999-12-19','SH_CLERK',2500.00,NULL,122,50),(192,'Sarah','Bell','SBELL','650.501.1876','1996-02-04','SH_CLERK',4000.00,NULL,123,50),(193,'Britney','Everett','BEVERETT','650.501.2876','1997-03-03','SH_CLERK',3900.00,NULL,123,50),(194,'Samuel','McCain','SMCCAIN','650.501.3876','1998-07-01','SH_CLERK',3200.00,NULL,123,50),(195,'Vance','Jones','VJONES','650.501.4876','1999-03-17','SH_CLERK',2800.00,NULL,123,50),(196,'Alana','Walsh','AWALSH','650.507.9811','1998-04-24','SH_CLERK',3100.00,NULL,124,50),(197,'Kevin','Feeney','KFEENEY','650.507.9822','1998-05-23','SH_CLERK',3000.00,NULL,124,50),(198,'Donald','OConnell','DOCONNEL','650.507.9833','1999-06-21','SH_CLERK',2600.00,NULL,124,50),(199,'Douglas','Grant','DGRANT','650.507.9844','2000-01-13','SH_CLERK',2600.00,NULL,124,50),(200,'Jennifer','Whalen','JWHALEN','515.123.4444','1987-09-17','AD_ASST',4400.00,NULL,101,10),(201,'Michael','Hartstein','MHARTSTE','515.123.5555','1996-02-17','MK_MAN',13000.00,NULL,100,20),(202,'Pat','Fay','PFAY','603.123.6666','1997-08-17','MK_REP',6000.00,NULL,201,20),(203,'Susan','Mavris','SMAVRIS','515.123.7777','1994-06-07','HR_REP',6500.00,NULL,101,40),(204,'Hermann','Baer','HBAER','515.123.8888','1994-06-07','PR_REP',10000.00,NULL,101,70),(205,'Shelley','Higgins','SHIGGINS','515.123.8080','1994-06-07','AC_MGR',12000.00,NULL,101,110),(206,'William','Gietz','WGIETZ','515.123.8181','1994-06-07','AC_ACCOUNT',8300.00,NULL,205,110); - -/*Table structure for table `job_grades` */ - -DROP TABLE IF EXISTS `job_grades`; - -CREATE TABLE `job_grades` ( - `grade_level` varchar(3) DEFAULT NULL, - `lowest_sal` int(11) DEFAULT NULL, - `highest_sal` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_grades` */ - -insert into `job_grades`(`grade_level`,`lowest_sal`,`highest_sal`) values ('A',1000,2999),('B',3000,5999),('C',6000,9999),('D',10000,14999),('E',15000,24999),('F',25000,40000); - -/*Table structure for table `job_history` */ - -DROP TABLE IF EXISTS `job_history`; - -CREATE TABLE `job_history` ( - `employee_id` int(6) NOT NULL, - `start_date` date NOT NULL, - `end_date` date NOT NULL, - `job_id` varchar(10) NOT NULL, - `department_id` int(4) DEFAULT NULL, - PRIMARY KEY (`employee_id`,`start_date`), - UNIQUE KEY `jhist_emp_id_st_date_pk` (`employee_id`,`start_date`), - KEY `jhist_job_fk` (`job_id`), - KEY `jhist_dept_fk` (`department_id`), - CONSTRAINT `jhist_dept_fk` FOREIGN KEY (`department_id`) REFERENCES `departments` (`department_id`), - CONSTRAINT `jhist_emp_fk` FOREIGN KEY (`employee_id`) REFERENCES `employees` (`employee_id`), - CONSTRAINT `jhist_job_fk` FOREIGN KEY (`job_id`) REFERENCES `jobs` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `job_history` */ - -insert into `job_history`(`employee_id`,`start_date`,`end_date`,`job_id`,`department_id`) values (101,'1989-09-21','1993-10-27','AC_ACCOUNT',110),(101,'1993-10-28','1997-03-15','AC_MGR',110),(102,'1993-01-13','1998-07-24','IT_PROG',60),(114,'1998-03-24','1999-12-31','ST_CLERK',50),(122,'1999-01-01','1999-12-31','ST_CLERK',50),(176,'1998-03-24','1998-12-31','SA_REP',80),(176,'1999-01-01','1999-12-31','SA_MAN',80),(200,'1987-09-17','1993-06-17','AD_ASST',90),(200,'1994-07-01','1998-12-31','AC_ACCOUNT',90),(201,'1996-02-17','1999-12-19','MK_REP',20); - -/*Table structure for table `jobs` */ - -DROP TABLE IF EXISTS `jobs`; - -CREATE TABLE `jobs` ( - `job_id` varchar(10) NOT NULL DEFAULT '', - `job_title` varchar(35) NOT NULL, - `min_salary` int(6) DEFAULT NULL, - `max_salary` int(6) DEFAULT NULL, - PRIMARY KEY (`job_id`), - UNIQUE KEY `job_id_pk` (`job_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `jobs` */ - -insert into `jobs`(`job_id`,`job_title`,`min_salary`,`max_salary`) values ('AC_ACCOUNT','Public Accountant',4200,9000),('AC_MGR','Accounting Manager',8200,16000),('AD_ASST','Administration Assistant',3000,6000),('AD_PRES','President',20000,40000),('AD_VP','Administration Vice President',15000,30000),('FI_ACCOUNT','Accountant',4200,9000),('FI_MGR','Finance Manager',8200,16000),('HR_REP','Human Resources Representative',4000,9000),('IT_PROG','Programmer',4000,10000),('MK_MAN','Marketing Manager',9000,15000),('MK_REP','Marketing Representative',4000,9000),('PR_REP','Public Relations Representative',4500,10500),('PU_CLERK','Purchasing Clerk',2500,5500),('PU_MAN','Purchasing Manager',8000,15000),('SA_MAN','Sales Manager',10000,20000),('SA_REP','Sales Representative',6000,12000),('SH_CLERK','Shipping Clerk',2500,5500),('ST_CLERK','Stock Clerk',2000,5000),('ST_MAN','Stock Manager',5500,8500); - -/*Table structure for table `locations` */ - -DROP TABLE IF EXISTS `locations`; - -CREATE TABLE `locations` ( - `location_id` int(4) NOT NULL DEFAULT '0', - `street_address` varchar(40) DEFAULT NULL, - `postal_code` varchar(12) DEFAULT NULL, - `city` varchar(30) NOT NULL, - `state_province` varchar(25) DEFAULT NULL, - `country_id` char(2) DEFAULT NULL, - PRIMARY KEY (`location_id`), - UNIQUE KEY `loc_id_pk` (`location_id`), - KEY `loc_c_id_fk` (`country_id`), - CONSTRAINT `loc_c_id_fk` FOREIGN KEY (`country_id`) REFERENCES `countries` (`country_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `locations` */ - -insert into `locations`(`location_id`,`street_address`,`postal_code`,`city`,`state_province`,`country_id`) values (1000,'1297 Via Cola di Rie','00989','Roma',NULL,'IT'),(1100,'93091 Calle della Testa','10934','Venice',NULL,'IT'),(1200,'2017 Shinjuku-ku','1689','Tokyo','Tokyo Prefecture','JP'),(1300,'9450 Kamiya-cho','6823','Hiroshima',NULL,'JP'),(1400,'2014 Jabberwocky Rd','26192','Southlake','Texas','US'),(1500,'2011 Interiors Blvd','99236','South San Francisco','California','US'),(1600,'2007 Zagora St','50090','South Brunswick','New Jersey','US'),(1700,'2004 Charade Rd','98199','Seattle','Washington','US'),(1800,'147 Spadina Ave','M5V 2L7','Toronto','Ontario','CA'),(1900,'6092 Boxwood St','YSW 9T2','Whitehorse','Yukon','CA'),(2000,'40-5-12 Laogianggen','190518','Beijing',NULL,'CN'),(2100,'1298 Vileparle (E)','490231','Bombay','Maharashtra','IN'),(2200,'12-98 Victoria Street','2901','Sydney','New South Wales','AU'),(2300,'198 Clementi North','540198','Singapore',NULL,'SG'),(2400,'8204 Arthur St',NULL,'London',NULL,'UK'),(2500,'Magdalen Centre, The Oxford Science Park','OX9 9ZB','Oxford','Oxford','UK'),(2600,'9702 Chester Road','09629850293','Stretford','Manchester','UK'),(2700,'Schwanthalerstr. 7031','80925','Munich','Bavaria','DE'),(2800,'Rua Frei Caneca 1360 ','01307-002','Sao Paulo','Sao Paulo','BR'),(2900,'20 Rue des Corps-Saints','1730','Geneva','Geneve','CH'),(3000,'Murtenstrasse 921','3095','Bern','BE','CH'),(3100,'Pieter Breughelstraat 837','3029SK','Utrecht','Utrecht','NL'),(3200,'Mariano Escobedo 9991','11932','Mexico City','Distrito Federal,','MX'); - -/*Table structure for table `order` */ - -DROP TABLE IF EXISTS `order`; - -CREATE TABLE `order` ( - `order_id` int(11) DEFAULT NULL, - `order_name` varchar(15) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `order` */ - -insert into `order`(`order_id`,`order_name`) values (1,'shkstart'),(2,'tomcat'),(3,'dubbo'); - -/*Table structure for table `regions` */ - -DROP TABLE IF EXISTS `regions`; - -CREATE TABLE `regions` ( - `region_id` int(11) NOT NULL, - `region_name` varchar(25) DEFAULT NULL, - PRIMARY KEY (`region_id`), - UNIQUE KEY `reg_id_pk` (`region_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -/*Data for the table `regions` */ - -insert into `regions`(`region_id`,`region_name`) values (1,'Europe'),(2,'Americas'),(3,'Asia'),(4,'Middle East and Africa'); - -/*Table structure for table `emp_details_view` */ - -DROP TABLE IF EXISTS `emp_details_view`; - -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; - -/*!50001 CREATE TABLE `emp_details_view`( - `employee_id` int(6) , - `job_id` varchar(10) , - `manager_id` int(6) , - `department_id` int(4) , - `location_id` int(4) , - `country_id` char(2) , - `first_name` varchar(20) , - `last_name` varchar(25) , - `salary` double(8,2) , - `commission_pct` double(2,2) , - `department_name` varchar(30) , - `job_title` varchar(35) , - `city` varchar(30) , - `state_province` varchar(25) , - `country_name` varchar(40) , - `region_name` varchar(25) -)*/; - -/*View structure for view emp_details_view */ - -/*!50001 DROP TABLE IF EXISTS `emp_details_view` */; -/*!50001 DROP VIEW IF EXISTS `emp_details_view` */; - -/*!50001 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `emp_details_view` AS select `e`.`employee_id` AS `employee_id`,`e`.`job_id` AS `job_id`,`e`.`manager_id` AS `manager_id`,`e`.`department_id` AS `department_id`,`d`.`location_id` AS `location_id`,`l`.`country_id` AS `country_id`,`e`.`first_name` AS `first_name`,`e`.`last_name` AS `last_name`,`e`.`salary` AS `salary`,`e`.`commission_pct` AS `commission_pct`,`d`.`department_name` AS `department_name`,`j`.`job_title` AS `job_title`,`l`.`city` AS `city`,`l`.`state_province` AS `state_province`,`c`.`country_name` AS `country_name`,`r`.`region_name` AS `region_name` from (((((`employees` `e` join `departments` `d`) join `jobs` `j`) join `locations` `l`) join `countries` `c`) join `regions` `r`) where ((`e`.`department_id` = `d`.`department_id`) and (`d`.`location_id` = `l`.`location_id`) and (`l`.`country_id` = `c`.`country_id`) and (`c`.`region_id` = `r`.`region_id`) and (`j`.`job_id` = `e`.`job_id`)) */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - - -#第14章_视图的课后练习 - -USE dbtest14; -#练习1: -#1. 使用表emps创建视图employee_vu, -#其中包括姓名(LAST_NAME),员工号(EMPLOYEE_ID),部门号(DEPARTMENT_ID) - -create view emps(姓名,员工号,部门号) as select last_name,employee_id,department_id from employees -select view emps; - -#2. 显示视图的结构 -desc emps; - -#3. 查询视图中的全部内容 -select * from emps; - -#4. 将视图中的数据限定在部门号是80的范围内 -select * from emps where 部门号=80; - -#练习2: - - -#1. 创建视图emp_v1,要求查询电话号码以‘011’开头的员工姓名和工资、邮箱 - -create view emp_v1 as select last_name,salary,email from employees where SUBSTR(phone_number ,1,3)='011'; - -#2. 要求将视图 emp_v1 修改为查询电话号码以‘011’开头的并且邮箱中包含 e 字符 -#的员工姓名和邮箱、电话号码,工资 -alter view emp_v1 as select last_name,salary,email from employees where SUBSTR(phone_number ,1,3)='011' and email like '%e%'; - - -#3. 向 emp_v1 插入一条记录,是否可以? -#4. 修改emp_v1中员工的工资,每人涨薪1000 - -update emp_v1 set salary=salary+1000; -#5. 删除emp_v1中姓名为Olsen的员工 - -delete from emp_v1 where last_name='Olsen'; -#6. 创建视图emp_v2,要求查询部门的最高工资高于 12000 的部门id和其最高工资 -create view emp_v2 as -select max(salary),department_id from employees GROUP BY department_id having max(salary)>12000 ; - - - -#7. 向 emp_v2 中插入一条记录,是否可以? - -#8. 删除刚才的emp_v2 和 emp_v1 -drop view emp_v2 ; -drop view emp_v1; -``` \ No newline at end of file diff --git "a/59 \346\236\227\345\263\260/9\346\234\2105\346\227\245.md" "b/59 \346\236\227\345\263\260/9\346\234\2105\346\227\245.md" deleted file mode 100644 index 6bcd17c337e9d4479fa1246921747045def06ed4..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\2105\346\227\245.md" +++ /dev/null @@ -1,17 +0,0 @@ -1. 未来学习计划 - -2. 辅助/自学的工具 - - 1.github全球正版 - - 2.gitee中国式版本 - - 3.csdn - - 4.bilibili - -3. 技术栈与技能树的含义 - - 1.技术栈:指的是实现一个软件的功能所需要的技术 - - 2.技能数:指的是一个人所掌握的技能 \ No newline at end of file diff --git "a/59 \346\236\227\345\263\260/9\346\234\2106\346\227\245.md" "b/59 \346\236\227\345\263\260/9\346\234\2106\346\227\245.md" deleted file mode 100644 index 722dd05dd3be3c68e87d201cf1009ae316140d0f..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\2106\346\227\245.md" +++ /dev/null @@ -1,119 +0,0 @@ -## 笔记: - -##### 一.数据库设计: - - 1.表与表之间的关系 - - 多对多:引入第三张表 - - 一对多:主键放入多的表当外键 - - 一对一:将一个表的主键放入另一个表当外键 - - 2.E-R图 - - 实体(表) - - 属性(字段) - - 关系(联系) - -``` -create database school character set utf8; -use school; -#院系表 -create table department -( - department_id int auto_increment primary key, #学院编号 - department_name varchar(50) not null #学院名字 -); -insert into department -values (null, '软件工程学院'); -#专业表 -create table major -( - major_id int auto_increment primary key, #专业编号 - major_name varchar(20) not null, #专业名称 - department_id int, #所属学院编号 - constraint foreign key (department_id) references department (department_id) -); -insert into major -values (null, '软件技术', 1), - (null, '新媒体运营', 1); -#班级表 -create table grade -( - grade_id int auto_increment primary key, #班级编号 - grade_name varchar(20) not null, #班级名字 - major_id int not null, #所属专业编号 - constraint foreign key (major_id) references major (major_id) -); -insert into grade -values (null, '软件技术1班', 1), - (null, '软件技术2班', 1), - (null, '新媒体运营1班', 2); - -#学生表 -create table student -( - student_id int, #学生编号 - student_name varchar(20), #学生名字 - student_age int, #学生年龄 - student_number int primary key, #学生学号 - grade_id int, #所属班级编号 - constraint foreign key (grade_id) references grade (grade_id) -); -insert into student -values (1, 'kaixin', 20, 2044010111, 1), - (2, 'tianxin', 20, 2044010112, 1), - (3, 'xiaoxin', 21, 2044010123, 2); -#教师表 -create table teacher -( - teacher_num int not null primary key, #教师工号 - teacher_name varchar(20) not null, #教师姓名 - teacher_age int null #教师年龄 -); -insert into teacher -values (0001, '张老师', 40), - (0002, '李老师', 35); -#课程 -create table course -( - course_id int auto_increment primary key, #课程编号 - course_name varchar(20) not null, #课程名字 - teacher_number int, #教师工号 - constraint foreign key (teacher_number) references teacher (teacher_num) -); -insert into course -values (1, 'mysql', 0001), - (2, 'java', 0002); -#成绩表 -create table score -( - course_id int, # 课程编号 - score_number int, #成绩 - student_number int, #学号 - constraint foreign key (student_number) references student (student_number), - constraint foreign key (course_id) references course (course_id) -); -insert into score -values (1, 89, 2044010111), - (2, 78, 2044010111), - (1, 61, 2044010112), - (2, 77, 2044010112), - (1, 93, 2044010123), - (2, 88, 2044010123); -#课程表 -create table course_table -( - course_table_id int, #课程表编号 - course_name varchar(20), #课程名字 - course_date date, #课程日期 - course_time time, #课程时间 - site varchar(20), #地点 - constraint foreign key (course_table_id) references grade (grade_id) -); -insert into course_table -values (1, 'mysql', 20230901, 14 - 00 - 00, '教学楼xx房间'); -``` \ No newline at end of file diff --git "a/59 \346\236\227\345\263\260/9\346\234\2107\346\227\245\347\254\224\350\256\260.md" "b/59 \346\236\227\345\263\260/9\346\234\2107\346\227\245\347\254\224\350\256\260.md" deleted file mode 100644 index 9012d9df540328a311cb06a387249bc5a27eff53..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\2107\346\227\245\347\254\224\350\256\260.md" +++ /dev/null @@ -1,13 +0,0 @@ -数据库的范式 - -1.第一范式:要求字段的内容,不可再分割,为的是保证数据的原子性 - -2.第二范式:要求在满足第一范式的基础上,要求非主键字段要完全依赖主键(非主键,要依赖整个联合主键),而不能只依赖部分 - -完全依赖:小明的存在是依赖小明父亲的存在 - -不能只依赖部分:小明的存在,还得依赖母亲的存在 - -3.第三范式:满足第二范式的前提上,要求非主键属性要直接依赖于主键 - -​ “儿子依赖父亲,父亲依赖爷爷,儿子与爷爷为间接关系” \ No newline at end of file diff --git "a/59 \346\236\227\345\263\260/9\346\234\2108\346\227\245\344\275\234\344\270\232.md" "b/59 \346\236\227\345\263\260/9\346\234\2108\346\227\245\344\275\234\344\270\232.md" deleted file mode 100644 index 6cadf8f8ffa9b94a2e31fb9a6c3d5bf36920321a..0000000000000000000000000000000000000000 --- "a/59 \346\236\227\345\263\260/9\346\234\2108\346\227\245\344\275\234\344\270\232.md" +++ /dev/null @@ -1,112 +0,0 @@ -笔记: - -1:powerDesigner: - - 第一步:创建概念模型(类似ER图) CDM (用户角度) - - 第二步:转换成逻辑模型 LDM (计算机角度) - - 第三步:转换成物理模型 PDM (数据库角度) - - 第四步:生成DDL - -2:数据库设计步骤: - - 1.需求分析,了解要开发的系统的需求,明确数据和格式 - - 2.概念结构设计:将需求分析得到的抽象成概念模型,将ER图向关系模型转化 - - 3.逻辑结构设计:将概念结构转化成DBMS所支持的数据模型 - - 4.物理结构设计:将概念模型,转换成选定数据库管理系统需要的物理模型 - - 5.数据库实施:根据物理模型生成对应的DDL - - 6.数据库维护 - -``` -drop table if exists` book; - -drop table if exists holding; - -drop table if exists library; - -drop table if exists record; - -drop table if exists student; - -/*==============================================================*/ -/* Table: book */ -/*==============================================================*/ -create table book -( - bk_id decimal not null, - bk_name char(20) not null, - bk_author char(10) not null, - ISBN int not null, - bk_date date not null, - bk_sort char(10) not null, - primary key (bk_id) -); - -/*==============================================================*/ -/* Table: holding */ -/*==============================================================*/ -create table holding -( - bk_id decimal not null, - lb_id decimal not null, - hd_id decimal not null, - primary key (bk_id, lb_id, hd_id) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ -create table library -( - lb_id decimal not null, - lb_name char(10) not null, - lb_address char(20) not null, - primary key (lb_id) -); - -/*==============================================================*/ -/* Table: record */ -/*==============================================================*/ -create table record -( - bk_id decimal not null, - stu_id decimal not null, - rc_id decimal not null, - primary key (bk_id, stu_id, rc_id) -); - -/*==============================================================*/ -/* Table: student */ -/*==============================================================*/ -create table student -( - stu_id decimal not null, - lb_id decimal not null, - stu_name char(10) not null, - stu_tel varchar(11) not null, - stu_address varchar(30) not null, - primary key (stu_id) -); - -alter table holding add constraint FK_Relationship_3 foreign key (bk_id) - references book (bk_id) on delete restrict on update restrict; - -alter table holding add constraint FK_Relationship_3 foreign key (lb_id) - references library (lb_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_1 foreign key (bk_id) - references book (bk_id) on delete restrict on update restrict; - -alter table record add constraint FK_Relationship_1 foreign key (stu_id) - references student (stu_id) on delete restrict on update restrict; - -alter table student add constraint FK_Relationship_2 foreign key (lb_id) - references library (lb_id) on delete restrict on update restrict; -``` \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index f46cf6f39ca24e12a705774999d5df6428c99af5..0000000000000000000000000000000000000000 --- a/README.md +++ /dev/null @@ -1,8 +0,0 @@ -fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff - -winandlow - - - - - diff --git a/image-20230910234344708.png b/image-20230910234344708.png deleted file mode 100644 index d71da4693dd7c6a8c7a8f192c1f8af3949ca8fc4..0000000000000000000000000000000000000000 Binary files a/image-20230910234344708.png and /dev/null differ diff --git "a/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237\346\234\200\347\273\210\347\211\210.md" "b/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237\346\234\200\347\273\210\347\211\210.md" deleted file mode 100644 index 361c0f55843fed7a814aaa391a40cfa3777b4c47..0000000000000000000000000000000000000000 --- "a/\345\233\276\344\271\246\347\256\241\347\220\206\347\263\273\347\273\237\346\234\200\347\273\210\347\211\210.md" +++ /dev/null @@ -1,283 +0,0 @@ -```mysql --- 创建数据库 -create database t_books charset utf8; --- 使用数据库 -use t_books; - - - -/*==============================================================*/ -/* DBMS name: MySQL 5.0 */ -/* Created on: 2023-09-11 20:27:33 */ -/*==============================================================*/ - - -drop table if exists bookinfo;-- 书籍具体信息表 - -drop table if exists borrow;-- 借阅信息表 - -drop table if exists floormassage;-- 楼层信息表 - -drop table if exists gett;-- 接收人 - -drop table if exists library;-- 图书馆表 - -drop table if exists put;-- 放置图书 - -drop table if exists return_book;-- 归还信息表 - -drop table if exists user;-- 用户登录表 - -drop table if exists userinfo;-- 用户信息表 - -drop table if exists work;-- 管理员信息表 - -/*==============================================================*/ -/* Table: bookinfo */ -/*==============================================================*/ - --- 书籍具体信息表 -create table bookinfo -( - book_ID int not null auto_increment, -- 书籍编号 - ID int not null, -- 楼层编号 - book_name char(20) not null, -- 书籍名称 - author varchar(15) not null, -- 书籍作者 - publish date not null, -- 出版时间 - book_price numeric(10,2) not null, -- 书籍价格 - primary key (book_ID) -); - -/*==============================================================*/ -/* Table: borrow */ -/*==============================================================*/ - --- 借阅信息表 -create table borrow -( - borrow_ID int not null auto_increment, -- 借阅编号 - book_ID int not null, -- 书籍编号 - borrow_date date not null, -- 借阅时间 - return_date date not null, -- 归还时间 - primary key (borrow_ID) -); - -/*==============================================================*/ -/* Table: floormassage */ -/*==============================================================*/ - --- 楼层信息表 -create table floormassage -( - ID int not null auto_increment, -- 楼层编号 - lib_ID int not null, -- 图书馆编号 - floor char(3) not null, -- 楼层 - shelf_ID int not null, -- 书架编号 - linenum int not null, -- 行号 - type char(10) not null, -- 类型 - primary key (ID) -); - -/*==============================================================*/ -/* Table: get */ -/*==============================================================*/ - --- 接收人 -create table gett -( - worker_ID int not null, -- 管理员编号 - return_ID int not null, -- 归还编号 - primary key (worker_ID, return_ID) -); - -/*==============================================================*/ -/* Table: library */ -/*==============================================================*/ - --- 图书馆表 -create table library -( - lib_ID int not null auto_increment, -- 图书馆编号 - user_ID int not null, -- 用户编号 - lib_name varchar(10) not null, -- 图书馆名称 - primary key (lib_ID) -); - -/*==============================================================*/ -/* Table: put */ -/*==============================================================*/ - --- 放置图书 -create table put -( - lib_ID int not null, -- 楼层编号 - worker_ID int not null, -- 管理员编号 - primary key (lib_ID, worker_ID) -); - -/*==============================================================*/ -/* Table: "return" */ -/*==============================================================*/ - --- 归还信息表 -create table return_book -( - return_ID int not null auto_increment, -- 归还编号 - user_ID int not null, -- 用户编号 - return_date date not null, -- 归还时间 - primary key (return_ID) -); - -/*==============================================================*/ -/* Table: user */ -/*==============================================================*/ - --- 用户登录表 -create table user -( - user_ID int not null auto_increment, -- 用户编号 - user_name varchar(5) not null, -- 用户姓名 - password varchar(10) not null, -- 密码 - primary key (user_ID) -); - -/*==============================================================*/ -/* Table: userinfo */ -/*==============================================================*/ - --- 用户信息表 -create table userinfo -( - userinfo_ID int not null auto_increment, -- 用户信息编号 - user_ID int not null, -- 用户编号 - userinfo_name varchar(6) not null, -- 用户姓名 - userinfo_sex char(1) not null, -- 用户性别 - college char(10) not null, -- 学院 - major char(15) not null, -- 专业 - grade char(20) not null, -- 年级 - class char(20) not null, -- 班级 - user_tel char(15) not null, -- 用户电话 - primary key (userinfo_ID) -); - -/*==============================================================*/ -/* Table: work */ -/*==============================================================*/ - --- 管理员信息表 -create table work -( - worker_ID int not null auto_increment, -- 员工编号 - worker_name varchar(5) not null, -- 员工姓名 - worker_sex char(1) not null, -- 员工性别 - worker_tel char(12) not null, -- 员工电话 - worker_salary int not null, -- 员工工资 - primary key (worker_ID) -); - -alter table bookinfo add constraint FK_check_book foreign key (ID) - references floormassage (ID) on delete restrict on update restrict; - -alter table borrow add constraint FK_borrow foreign key (book_ID) - references bookinfo (book_ID) on delete restrict on update restrict; - -alter table floormassage add constraint FK_check_floor foreign key (lib_ID) - references library (lib_ID) on delete restrict on update restrict; - -alter table gett add constraint FK_get foreign key (worker_ID) - references work (worker_ID) on delete restrict on update restrict; - -alter table gett add constraint FK_get2 foreign key (return_ID) - references return_book (return_ID) on delete restrict on update restrict; - -alter table library add constraint FK_check foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - -alter table put add constraint FK_put foreign key (lib_ID) - references library (lib_ID) on delete restrict on update restrict; - -alter table put add constraint FK_put2 foreign key (worker_ID) - references work (worker_ID) on delete restrict on update restrict; - -alter table return_book add constraint FK_return foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - -alter table userinfo add constraint FK_information foreign key (user_ID) - references user (user_ID) on delete restrict on update restrict; - - ### 用户登录 - -insert into user values -- 用户登录 -(001,'小梅','123'), -(002,'小晶','456'), -(003,'小芳','789'); - - - ### 用户信息表 -insert into userinfo values -(101,001,'韩梅梅','女','软件工程学院','前端','22级','1班','1234567892'), -(102,002,'郭晶晶','女','软件工程学院','后端','22级','2班','2345678925'), -(103,003,'李静芳','女','软件工程学院','新媒体','22级','10班','1234567894'); - - -### 图书馆信息表 -insert into library values -(201,001,'北京市图书馆'), -(202,002,'龙岩市图书馆'), -(203,003,'厦门市图书馆'); - -### 楼层信息表 -insert into floormassage values -(301,201,'四楼',337,1,'外国著作'), -(302,202,'六楼',338,2,'文学经典'), -(303,203,'五楼',339,3,'仙侠类'); - -### 书籍具体信息表 -insert into bookinfo values -- 图书信息 -(401,301,'战争与和平','列夫托尔斯泰','1869-6-6',45), -(402,302,'活着','余华','1992-12-2',60), -(403,303,'花千骨','果果','2018-12-31',80.8); - - - - - -### 借阅信息表 -insert into borrow values -- 图书借阅 -(501,401,'2023-04-16','2023-05-16'), -(502,402,'2023-04-16','2023-05-16'), -(503,403,'2023-04-16','2023-05-16'); - - - - -### 归还信息表 -insert into return_book values -- 归还图书 -(601,001,'2023-04-25'), -(602,002,'2023-05-10'), -(603,003,'2023-05-16'); - - - -### 管理员 -insert into work values -(701,'张三','男','1594628347',5000), -(702,'李四','男','1569821347',4000), -(703,'李雪','女','1634957612',3000); - - --- 接受表 -insert into gett values -(701,601), -(702,602), -(703,603); - --- 放置表 -insert into put values -(201,701), -(202,702), -(203,703); - - -``` -