在SQL中编写查询以查找两个以上员工正在工作的部门的名称。(不是我的问题)。 [英] Write a query in SQL to find the names of departments where more than two employees are working.(is not my question).
本文介绍了在SQL中编写查询以查找两个以上员工正在工作的部门的名称。(不是我的问题)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
示例表:emp_department
Sample table: emp_department
DPT_CODE DPT_NAME DPT_ALLOTMENT
-------- --------------- -------------
57 IT 65000
63 Finance 15000
47 HR 240000
27 RD 55000
89 QC 75000
样品表:emp_details
Sample table : emp_details
EMP_IDNO EMP_FNAME EMP_LNAME EMP_DEPT
--------- --------------- --------------- ----------
127323 Michale Robbin 57
526689 Carlos Snares 63
843795 Enric Dosio 57
328717 Jhon Snares 63
444527 Joseph Dosni 47
659831 Zanifer Emily 47
847674 Kuleswar Sitaraman 57
748681 Henrey Gabriel 47
555935 Alex Manuel 57
539569 George Mardy 27
733843 Mario Saule 63
631548 Alan Snappy 27
839139 Maria Foster 57
我的尝试:
What I have tried:
SELECT emp_department.dpt_name
FROM emp_details
INNER JOIN emp_department
ON emp_dept = dpt_code...
推荐答案
这是你的作业,所以我不会给你代码!
但是开始通过找出haw许多部门有三个或更多的员工 - 这是你的emp_details表上的一个简单的GROUP BY。
如果有,请在emp_department表上使用JOIN获取部门名称。
This is your homework, so I'll not give you the code!
But start by finding out haw many departments have three or more employees - that's a simple GROUP BY on your emp_details table.
When you have that, use a JOIN onto your emp_department table to get the department name.
这篇关于在SQL中编写查询以查找两个以上员工正在工作的部门的名称。(不是我的问题)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文