1.Database [TEST]
表1 Employee(员工表)
Employee_id Last_Name First_Name Gender Birthday STATUS
201800001 张 华 女 19840113 离职
201800002 王 立新 男 19830624 在职
201800003 蒋 超 男 19841115 离职
201800004 王 浩雨 男 19851020 在职
201800005 张 静 女 19840418 在职
表2 Alignment(岗位表)
Alignment_id Alignment_Name Employee_id Team Manager_align_id Role
A001 华东区_001 201800001 A A005 DM
A002 华南区_002 B REP
A003 华东区_002 201800005 A A001 REP
A004 华东区_003 201800004 A A001 REP
A005 华东大区_001 201800002 A RM
A006 华南区_003 C REP
题目1:请你用一个语句从数据库抽取REP的岗位列表,列名如下:
Alignment_name Employee_id Employee_Name Manager_name Role
Select a.Alignment_name,b.Employee_id,concat(b.Last_Name,b.First_Name) as employee_name,a.Team as Manager_name,a.Role from Employee b,Alignment a;
MariaDB [db1]> create table Employee(Employee_id int,Last_Name varchar(10),First_name varchar(10),Gender enum(‘男’,’女’),Birthday date,STATUS enum(‘离职’,’在职’));
insert into Employee values(201800001,’张’,’华’,’女’,19840113,’离职’);
MariaDB [(none)]> insert into db1.Employee values(201800002,’王’,’立新’,’男’,19830624,’在职’);
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> insert into db1.Employee values(201800003,’蒋’,’超’,’男’,19841115,’离职’);
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> insert into db1.Employee values(201800004,’王’,’浩雨’,’男’,19851020,’在职’);
Query OK, 1 row affected (0.01 sec)
MariaDB [(none)]> insert into db1.Employee values(201800005,’张’,’静’,’女’,19840418,’在职’);
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> create table db1.Alignment(Alignment_id char(10),Alignment_Name varchar(30),Employee_id int,Team varchar(3),Manager_align_id varchar(20),Role varchar(10));
MariaDB [(none)]> insert into db1.Alignment values(‘A001’,’华东区_001’,201800001,’A’,’A005’,’DM’);
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> insert into db1.Alignment values(‘A002’,’华东区_002’,’’,’B’,’’,’REP’);
Query OK, 1 row affected, 1 warning (0.01 sec)
MariaDB [(none)]> insert into db1.Alignment values(‘A003’,’华东区_002’,’201800005’,’A’,’A001’,’REP’);
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> insert into db1.Alignment values(‘A004’,’华东区_003’,’201800004’,’A’,’A001’,’REP’);
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> insert into db1.Alignment values(‘A005’,’华东区_001’,’201800002’,’A’,’’,’RM’);
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> insert into db1.Alignment values(‘A006’,’华南区_003’,’’,’C’,’’,’REP’);
Query OK, 1 row affected, 1 warning (0.00 sec)
题目2:请你用一个语句计算出每个Team现有员工的有效人数
表3 Customer(客户表)
Customer_id Name Class Alignment_id
C00001 徐家汇社区医院 一级丙等 A003
C00002 上海华山医院 三级甲等 A003
C00003 北京市石景山医院 二级乙等 A003
C00004 中国人民解放军二六一医院 三级甲等 A004
C00005 北京王府中西医结合医院 三级甲等 A004
表4 Sales(销量表)
Product Price Quantity Customer_id Month
Actos 30.62 58 C00001 201809
Basen 55.34 3 C00001 201809
Basen 55.34 23 C00003 201810
Actos 30.62 11 C00004 201810
Actos 30.62 30 C00002 201810
题目3:请你用一个语句计算出每个岗位每个月每个产品的销量总金额
题目4:如何在excel实现下方的操作,请描述excel里的操作步骤.