Sql - List top 3 youngest ages of employees dept wise
AnswerBot
1y
List top 3 youngest ages of employees dept wise using SQL.
Use GROUP BY to group employees by department.
Use ORDER BY to sort ages in ascending order.
Use LIMIT to get top 3 youngest ages.
Use MIN to get...read more
Mokshit Shah
1y
select * from (
select *,
rank() over (partition by dept_name order by age desc) as rnk,
dense_rank() over (partition by dept_name order by age desc) as dense_rnk
from emp) sq
where dense_rnk<4;
AKASH ADHIKARI
1y
select age from(select name,age, row_number() over(partition by dept order by age asc) as rn
from EMPLOYEE) x where x.rn<2;
Anonymous
1y
select age from employees group by dept order by age asc limit 3
Add answer anonymously...
Popular interview questions of Data Engineer
Top HR questions asked in Futurense Technologies Data Engineer
>
Futurense Technologies Data Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app