[英]Find Average Age Of Developers in sql
To find the average age of the developers assigned to all the tasks you need to run this query -要查找分配给您运行此查询所需的所有任务的开发人员的平均年龄 -
select AVG(e.Age) as age from `Employee` e join `Task_Assignment` ta on ta.Developer_ID = e.Employee_ID;
To find the number of tasks for each priority you need to run this query -要查找每个优先级的任务数,您需要运行此查询 -
select COUNT(t.TASK_ID) from `Task` t join `Task_Priority` tp on t.Task_ID = tp.Task_ID GROUP_BY tp.Priority_ID;
Hope this helps :)
希望这可以帮助 :)
select sum(age)/count(*) as avg_age from (
select distinct developer, age from (
select * from Employee emp inner join Task_Assignment task_assign
on emp.emp_id = task_assign.developer
) as a ) as b
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.