SQL Query to Find Nth Highest Salary Using Dense Rank Function

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 มิ.ย. 2022
  • Hi, In this video we've discussed SQL query for nth highest salary using dense rank function. This is an Important SQL Interview question.
    ✨Work related mails can be sent on work.sadiasiddiqui@gmail.com
    ✨If you appreciate my work and would like to donate to support our channel, you can do so here : paypal.me/sadia1702
    ✨Please like, share, subscribe and comment down. It would make my day :)
    Thank you, have a nice day!

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

  • @ankursingh730
    @ankursingh730 2 ปีที่แล้ว +4

    Do you have any suggestion for SQL course to be taken for beginners/intermediate/advanced level?

  • @haribabuarava9270
    @haribabuarava9270 ปีที่แล้ว

    Excellent explanation.... Thanks

  • @SatyamSingh-uq2hm
    @SatyamSingh-uq2hm 2 ปีที่แล้ว +1

    Ma'am you didn't give the definition or working of (DENSE_rank). Please elaborate it.

  • @janesarkhan4599
    @janesarkhan4599 ปีที่แล้ว

    Sukriyaa mam. You solved my big question❤️❤️

  • @dileepsingh6565
    @dileepsingh6565 2 ปีที่แล้ว

    Define a variable with Varchar 1000 and assign
    the value ‘IND-India,JPN-Japan,US-United States’
    This string can be of any length.
    Write a dynamic query to insert data in a table with
    two columns column 1 should have Country Short
    Form and column 2 should have Country Full Form.
    Output should be: -
    Short Form Full Form
    IND India
    JPN Japan
    US United States
    Ma'am Please solve this question with explanation

  • @MohdKhan02
    @MohdKhan02 ปีที่แล้ว

    Saadia appi you are great ❤️❤️❤️

  • @Funnybhadrakia
    @Funnybhadrakia ปีที่แล้ว

    Thank you mam

  • @Lalit_Sharma_20
    @Lalit_Sharma_20 2 ปีที่แล้ว

    This can be said another way of finding second highest salary, video having 3 methods : max,limit,top right ?

  • @mohamedshahidomar3682
    @mohamedshahidomar3682 2 ปีที่แล้ว

    Does rank function gives the same result?

  • @moviesworld764
    @moviesworld764 ปีที่แล้ว +3

    If we have duplicates ...
    Then how can we write query...?

  • @shayan3381
    @shayan3381 ปีที่แล้ว

    Mam please use max function

  • @San2shsingh
    @San2shsingh ปีที่แล้ว

    What if there's a duplicate salary?

    • @atsec4110
      @atsec4110 11 หลายเดือนก่อน +1

      It will give all records for that salary , so all records where Rn=2 will be displayed.

    • @osoriomatucurane9511
      @osoriomatucurane9511 7 หลายเดือนก่อน

      That is right, it covers all records that meet the condition specified

    • @badruddindulvi4819
      @badruddindulvi4819 4 หลายเดือนก่อน

      Here we are using Dense_rank() function so if we have duplicate salaries then Dense_rank() will assign same rank to the same salaries. It wouldn't assign continuous rank for the same salary. Hope you understood

  • @shayan3381
    @shayan3381 ปีที่แล้ว

    Mam please use the max function instead of dense rank

  • @kranthikumar6043
    @kranthikumar6043 2 ปีที่แล้ว +1

    Why did you use "in line" sub query

    • @mummz3371
      @mummz3371 2 ปีที่แล้ว

      Was wondering the same thing. Can the filter not be applied directly to the dense rank query?

    • @kranthikumar6043
      @kranthikumar6043 2 ปีที่แล้ว

      @@mummz3371 yeah why can't we use directly qualify filter.. rather than where clause

    • @ruqaiyamuskaan9722
      @ruqaiyamuskaan9722 2 ปีที่แล้ว

      Firstly, we are applying dense rank function and creating a derived table in which dense rank function gives a rank to each salary in desc order
      Then, we give alias to inner query and selecting from that inline query.

    • @kranthikumar6043
      @kranthikumar6043 2 ปีที่แล้ว

      @@ruqaiyamuskaan9722why again need of where clause...we can directly get through qualify clause

    • @ruqaiyamuskaan9722
      @ruqaiyamuskaan9722 2 ปีที่แล้ว

      @@kranthikumar6043 basically, we need to give rank to each salary then put a rank
      Here where clause is used to set a rank