2nd Highest Salary || Nth Highest Salary || LIMIT keyword in SQL - Part 4

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2024
  • In this video, we will learn about how to find out 2nd highest salary and how to write a generic query to find out the nth highest salary from a table.
    Learn:
    -What is Max() function
    -What is LIMIT Keyword
    -How to find out 2nd highest salary using inner query and Max() function
    -How to find out nth highest salary using LIMIT keyword
    --What is TOP and ROWNUM in SQL.
    ~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
    www.youtube.co...
    Follow me on my Facebook Page:
    / naveenqtpexpert
    Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
    t.me/joinchat/...
    WebServices API Automation Tutorials:
    vimeo.com/onde... Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
    www.youtube.co...
    Follow me on my Facebook Page:
    / naveenqtpexpert
    Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
    t.me/joinchat/...
    Paid courses (Recorded) videos:
    Java & Selenium Course: www.naveenautom...
    API Course: www.naveenautom... ➡️Get Our Courses✔️
    📗 Get My Paid Courses at
    Paid courses (Recorded) videos:
    Java & Selenium Course: www.naveenautom...
    API Course: www.naveenautom...
    -------------------------------
    ✔️SOCIAL NETWORKS
    Facebook: / naveenqtpexpert
    Twitter: / naveenkhunteta
    Blog: www.naveenautom...
    --------------------------------
    Support My Channel✔️Or Buy Me A Coffee
    Paypal: paypal.me/nave...
    Google Pay: naveenanimation20@gmail.com
    --------------------------------
    ✔️Thanks for watching!
    देखने के लिए धन्यवाद
    Благодаря за гледането
    感谢您观看
    Merci d'avoir regardé
    Grazie per la visione
    Gracias por ver
    شكرا للمشاهدة

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

  • @kavyahc2205
    @kavyahc2205 5 ปีที่แล้ว +1

    Thank you...Very nice explanation.... Very useful... I have asked about this fetching highest column in my recent interview...

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

    very nice vedio very helpful need joins vedio too!!!

  • @meenup7232
    @meenup7232 5 ปีที่แล้ว +1

    Hi Naveen, Thank you for such a nice video. just wanted to know how to write LIMIT command for second last salary for employee if we dont know the total number of rows .

  • @rekhachawla459
    @rekhachawla459 4 ปีที่แล้ว +1

    Hello sir, i saw your SQL and automation videos they are really useful.sir i want you to make some videos on joins and other SQL queries that are asked in interviews

  • @KrishnaPrasad-id1mp
    @KrishnaPrasad-id1mp 5 ปีที่แล้ว +1

    Hi Naveen, Thanks for these videos. Kindly upload Foreign Key Constraint, Joins videos also.

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

    I think, LIMIT is only supported for MySQL, I tried in Oracle 11g, it gives me error.
    In Oracle we can write following query to find nth salary,
    By Using function DENSE_RANK() :
    select *
    from
    (
    select
    salary
    ,dense_rank() over (order by salary desc) ranking
    from employees
    )
    where ranking = n ;
    OR
    By Using Co-related Subquery :
    select distinct salary from employees a where n = (select count(distinct(salary)) from employees b
    where b.salary >= a.salary) order by a.salary desc;

  • @jatinpatel7443
    @jatinpatel7443 3 ปีที่แล้ว

    Hi Naveen, you are doing amazing videos for all series . thank you for sharing you knowledge . how can i get this SQL note ?

  • @pradeepbisht7346
    @pradeepbisht7346 5 ปีที่แล้ว +1

    thx naveen@@ plz make some interview question for ma
    nual testing@@

  • @04mamatha
    @04mamatha 4 ปีที่แล้ว

    Hi naveen... Can u pls help me with this query.. Display the department name and total no of employees in each department...

  • @gayatriganyarpwar2090
    @gayatriganyarpwar2090 5 ปีที่แล้ว

    Very nice and informative video.
    Could you please share video on joins. It will be of great help.

  • @arunpondhe7949
    @arunpondhe7949 5 ปีที่แล้ว

    superb Explanation Thank You for guidance

  • @sristipattar7651
    @sristipattar7651 5 ปีที่แล้ว +1

    👍💐Informative video.

  • @harshit5698
    @harshit5698 4 ปีที่แล้ว +1

    limit 3-1, 1;
    how it gives 3rd highest salary, 3-1 = 2
    it should give 2nd highest salary.
    kindly clear my doubt naveen sir

    • @John12685
      @John12685 4 ปีที่แล้ว

      Harshit do u know what is '1' doin here after , ?

    • @pranavkurkure6091
      @pranavkurkure6091 4 ปีที่แล้ว +1

      @@John12685 1 is to specify that we want only one record of salary.

    • @John12685
      @John12685 4 ปีที่แล้ว

      @@pranavkurkure6091 Oh alright pranav. I get it now. Thanku

  • @jatinpatel7443
    @jatinpatel7443 3 ปีที่แล้ว

    And one more question whenever you write "varchar(225)" what is meaning of (225)? is it limit of numbers or characters ?

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

      it means size of characters,if we specify varchar(3) ,it means i can store size of 3 characters. eg : abi,ram, pop etc

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

    awesome :-)

  • @Muthati
    @Muthati 3 ปีที่แล้ว

    Hi Naveen. I think your query will give the wrong result.if we have duplicate salary in the table

  • @nagrajullasgokarnkar6366
    @nagrajullasgokarnkar6366 5 ปีที่แล้ว

    Sir please make video on python automation