如何根据特定领域的教育历史显示员工并按部门分组

时间:2019-02-01 03:58:54

标签: postgresql

我想根据与计算机或信息学等相关的毕业生来显示员工数据。拥有计算机学位(本科,硕士或博士学位)的员工将被视为一次或从未被计算过。每个员工都在一个部门工作。这是我的餐桌关系

Dept  with structure (Dept_id, Dept_name)
------
A
B
C
D

Employee  with structure (Emp_Id, Emp_name, Educational_history_id, Dept_id)      
----------             
Donny
Sarah
Tony
Dan



Education_level with structure (Education_level_id, Education_level_name)
---------------
Undergraduate
Master
Doctoral


Educational with structure (Educational_Id, Educational_Name)
-----------
Informatics
Computer Engineering
Economy
Math
Biology


Educational_History  with structure (Educational_history_id, Emp_id, Educational_Id, Education_level_id)
----------------------
1. Donny have Undergraduate in Informatics, he in Dept A
2. Sarah have Undergraduate in Math but Master in Computer Engineering, she in Dept B
3. Tony have Doctoral in Informatic, he in Dept C
4. Dan have Undergraduate in Economy, he in Dept D

我需要的结果,向员工显示有关“信息学”的历史记录:

-------------------------------------------------
Emp_name | Dept |  Educational | Education Level
------------------------------------------------
Donny    |  A   |  Informatics | Undergraduate
------------------------------------------------
Sarah    |  B   |  Computer Engineering | Master
------------------------------------------------
Tony    |  C   |  Informatics | Doctoral

如何显示结果?谢谢

0 个答案:

没有答案