Deloitte SQL Interview Question 2024 | Find the top 3 highest-paid employees in each department

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2024

ความคิดเห็น • 3

  • @varmakvm4812
    @varmakvm4812 2 วันที่ผ่านมา

    Hi,
    In first question while finding the top 3 employees within each department, dense_rank() would be appropriate one because it will handle tie values without skipping the ranking rather than row_number IMO.
    Thank you for the constant motivation through SQL Questions ! Looking for more ...

    • @skilltechath0n
      @skilltechath0n  2 วันที่ผ่านมา

      Yes, definitely if the interviewer asked us to provide the same rank for duplicate values.
      Thanks for mentioning it 👍

    • @parthchauhan9305
      @parthchauhan9305 13 ชั่วโมงที่ผ่านมา

      On the contrary, using dense_rank may give us more than 3 values (if there are ties), rather we only need to find top 3 highest paid employees (3 rows), row_number will always ensure that we get only 3 rows in the result set.