Find Nth Highest Salary in SQL | 5 Different Ways | Most Important SQL Interview Question

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ส.ค. 2021
  • In this video we will see how we can find the Nth (1st, 2nd , 3rd, ... ,nth) Highest salary in SQL . Here we will discuss five different ways to solve this query .
    ✅Using Max() - 1:15
    ✅Using LIMIT - 3:15
    ✅Without using LIMIT - 5:42
    ✅Using dense_rank() - 8:27
    ✅Using NOT IN operator - 11:10
    Join our Telegram Channel - t.me/joingroupCodeEra
    ⭐Part 1:Top 9 SQL queries for interview -
    • Top 9 SQL queries for ...
    ⭐Part 2:Top 9 SQL queries for interview -
    • PART 2 : Top 9 SQL que...
    ⭐Top SQL Interview Question
    • Top SQL Interview Ques...
    ⭐Types of Joins in SQL-
    • SQL Joins & Its Types ...
    ⭐Aggregate Functions In SQL | COUNT, SUM, AVG, MIN, MAX | IFNULL( )
    • Aggregate Functions In...
    ⭐Difference Between DELETE, DROP and TRUNCATE
    • Difference Between DEL...
    ⭐SQL vs NoSQL | MySQL vs MongoDB
    • Difference between SQL...
    ⭐DBMS vs RDMS
    • DBMS vs RDBMS | What i...
    ⭐Normalization in DBMS-
    • Normalization and its ...
    ⭐Types of key in DBMS-
    • Types of Keys in DBMS ...
    ⭐Create MySQL Database and Table -
    • How to Create Database...
    #mysql #oracle #dbms #query #top #sqlserver #database #PlacementPreparation
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    The best video out there on this topic, must watch before the interviews

  • @imamhasan9942
    @imamhasan9942 8 หลายเดือนก่อน +1

    Easy, Simple and best way of example, Thanks 👍

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

    Awesome tutorial, concise and crystal clear. Well done! At the end, I would go for the one that works all the time, preferably the one that fecthes all the records that meet the specified condition/restriction.

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

    Now my doubt has been cleared, thank you

  • @user-lf6lg5yg7e
    @user-lf6lg5yg7e หลายเดือนก่อน

    finally my doubt cleared in simple way very thanks hope you upload this kind of videos which are helpful

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

    But in Oracle SQL if we use ROWNUM instead of Limit then the order by clause needs to be in a inner query. Otherwise it throws an error.

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

    Amazing explanation of all the techniques. Thank you!! 😊👍🏻

  • @sunilachaarya6678
    @sunilachaarya6678 5 หลายเดือนก่อน

    Thank you so much 🙏for this well explained session. 🙌

  • @UtkarshSinhas
    @UtkarshSinhas 2 ปีที่แล้ว +10

    You helped me in clearing my interview 🤠 Thank you so much

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

      Congratulations.we are so happy that our video helped you.

    • @Cake-bz5bf
      @Cake-bz5bf ปีที่แล้ว

      Kitne ki package lagi bhaiya😮

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

    Very useful vedio Thanks a lot

  • @RaviTejaMeruva
    @RaviTejaMeruva 17 วันที่ผ่านมา

    Excellent Explanation

  • @RupeshYadav-kt5dv
    @RupeshYadav-kt5dv 2 หลายเดือนก่อน

    Excellent job ma'am 👏 👍 👌 🙌
    Thanks 🙏 🙏 🙏

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

    Can you plzz tell .. Is there any approach which is used to find nth salary using MAX function

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

    As 2nd highest is 3lakh and has two employees same salary using normal max function only one row it return the output or two row?

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

    thank you. God bless

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

    Informative ❤️

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

    Nice. , good video

  • @poojam271
    @poojam271 24 วันที่ผ่านมา

    Thank You so much Mam

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

    Why use N-1 expression is used? How did you come to that expression? Is it as we doing a binary search?

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

    thanks please bring videos on python basic problems

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

    If we use LIMIT function in oracle sql developer it shows error as sql command not properly ended. What to do for that?

  • @sandeeptripurana4496
    @sandeeptripurana4496 14 วันที่ผ่านมา

    Good one

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

    Awesome 😊

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

    when we use limit function in oracle it throws error.

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

    Thanks Ma'am

  • @prajakta_subramanian9909
    @prajakta_subramanian9909 6 หลายเดือนก่อน

    u r brilliant

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

    Thanks

  • @ArifKhan-qo9jw
    @ArifKhan-qo9jw ปีที่แล้ว +1

    Is this will be work in SSMS?

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

    Great video 🙏🏻

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

    Hii.. Can you find Nth rank in Department wise please

  • @AmitGupta-fd3zy
    @AmitGupta-fd3zy ปีที่แล้ว +1

    thank you mam, you taught very well

  • @satyabhau69
    @satyabhau69 2 ปีที่แล้ว +5

    Using Limit and Dense Rank is the Correct Approach to get the nth highest numeric value

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

      Thanks for watching..

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

    Thanks for the info

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

    Please clear in limit if we have multiple rows then.

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

    very helpful!!!!!!!!!!

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

    Good explanation

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

    nice explaination

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

    Nice 👍

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

    Superb

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

      Thank you so much😊

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

    Good

  • @DileepKumar-kc4qj
    @DileepKumar-kc4qj ปีที่แล้ว +1

    limit clause not working in sql server and without limit clause you solved that i didnt understand can you explain in more so that i can understand i watched many time this video but not clear concept ,,,....thanks in advance CodeEra

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

      Please watch this video th-cam.com/video/2QCUQhihwDM/w-d-xo.html . here you will find alternate options for Limit clause

    • @unknown_fact1586
      @unknown_fact1586 8 หลายเดือนก่อน

      you can use top instead of limit in sql server

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

    We can use exist and not exist

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

    2:51,, you query is not working

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

    Upload more👍

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

    Pls upload more cases

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

      Could you please mention which cases do you want to see?

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

    limit do not work in Oracle what is the option
    ?

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

      You can use TOP in Oracle

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

      When I use limit and top get error sql command not properly ended.How I fix it

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

    Does limit function work in MS SQL server platform?

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

      Nope

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

      No..you can use TOP instead of limit in ms sql

  • @amolgirase2332
    @amolgirase2332 วันที่ผ่านมา

    Select salary
    From employee_info E1
    Where 3=
    (Select count(distinct salary)
    From employee_info e2
    Where e2.salary >= e1.salary)

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

    Limit function not work in my sql

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

      NO
      It is working fine in MYSQL

    • @user-yy1dw5bc8y
      @user-yy1dw5bc8y ปีที่แล้ว

      @@CodeEra2020 not working in sql server?

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

    LIMIT NOT WORK