Lec-70: Find Nth(1st,2nd,3rd....N) Highest Salary in SQL | Imp for Competitive & Placement exam

  Рет қаралды 600,179

Gate Smashers

Gate Smashers

Күн бұрын

Пікірлер: 444
@aalirashid7178
@aalirashid7178 4 жыл бұрын
GREAT EXPLANATION SIR IN WHOLE KZbin DATABASE TUTORIALS I FEEL COMFORT WITH YOUR TUTORIALS ONLY STAY BLESSED LIKE SAME FROM PAKISTAN..
@Dhirendrakumar-dk1dt
@Dhirendrakumar-dk1dt 2 жыл бұрын
Make it very easy to understand SQL. I have watched your all series of SQL and that helps me a lot to crack my interview, thank you very much sir for sharing your information ❤️
@annoniimous
@annoniimous Жыл бұрын
Alternate Answer for finding nth highest salary: SELECT Salary FROM employee ORDER BY Salary Desc limit 1 offset 0 Here, limit means : how many output values you want to show on the screen () offset means: let assume you want to show nth (4th) highest salary . In this case you will provide offset 3 which means you are leaving top 3 rows and you are choosing the 4th one . (( "offset means escaping the number of rows from top"))
@ajaysingh-kd4nt
@ajaysingh-kd4nt Жыл бұрын
limit does not work with oracle sql select * from (select * from employee order by salare desc) where rownum
@sr7821
@sr7821 Жыл бұрын
@@ajaysingh-kd4nt your code selects highest salary not Nth. I think this should work: select * from (select * from (select * from employee order by salary desc) where rownum
@ajaysingh-kd4nt
@ajaysingh-kd4nt Жыл бұрын
yea i was working on highest salary only @@sr7821
@ajaysingh-kd4nt
@ajaysingh-kd4nt Жыл бұрын
yes that might work filtering the Nth tuples and then getting the record @@sr7821
@AMANPATEL-g8v
@AMANPATEL-g8v Жыл бұрын
mnnit wle bhi aa rhe kyaa , biotech me kb se dbms aa gya bhai ??
@ayeshaameen3903
@ayeshaameen3903 2 жыл бұрын
Wowwww You are a genius. No one have ever taught me like this.. thank you so much for this one specially.
@ayushyadav4180
@ayushyadav4180 3 жыл бұрын
i think in this world there would be no teacher other than him who don't need his students to know the language he is talking in i have seen comment of ppl from all over the world appreciating him.
@nickbaib1839
@nickbaib1839 5 жыл бұрын
Thank you so much! Continue the good job my friend! Greetings from Greece!
@GateSmashers
@GateSmashers 5 жыл бұрын
wow..Thank you for your support..
@vinitakeer515
@vinitakeer515 4 жыл бұрын
Thank you sir jb ap bolte hai k ye meri garrenti hai that puch line is superb.... God bless you
@varshasingh2748
@varshasingh2748 5 жыл бұрын
Aapka lecture dekhe bina din achha ni jata your enthusiastic way of teaching fill Josh.
@kushagrasahu8289
@kushagrasahu8289 4 жыл бұрын
Your channel made SQL learning easy informative and fun🙌. I literally binge watched sql series.
@ishangujarathi10
@ishangujarathi10 Жыл бұрын
One of the frequently asked question in interviews and placement/internships tests, thank you so such a perfect and easy explanation!!!
@bhuppidhamii
@bhuppidhamii Жыл бұрын
how does he explains every topic in a clear and comprehensible manner.😭💖
@souviknag
@souviknag 2 жыл бұрын
I'm watching it very late. And there's only one thing that's going on in my mind, ITS BETTER LATE THAN NEVER!! I'm so glad that I found this channel after all. Subscribed!!
@NishaOnYoutube
@NishaOnYoutube 4 жыл бұрын
Sir the way you teach and explain is beyond amazing...because of you I got golden badge in hackerrank....
@gotamkartik21
@gotamkartik21 3 жыл бұрын
thanks buddy, now i can understand this concept better.
@aayush5474
@aayush5474 4 жыл бұрын
Take Away: Inorder to find Nth highest salary the salary should have N-1 salaries which are greater than given salary
@aashishgoyal1436
@aashishgoyal1436 2 жыл бұрын
quite helpful comment.
@MrAmmugadu
@MrAmmugadu 5 жыл бұрын
Thank you so much sir, before I watched your video I was totally frustrated mind, bcoz I unable to understand subqueries,but after watching your vedio really I got more analysis points on subqueries, thank you again sir
@ranjeetpatra9212
@ranjeetpatra9212 4 жыл бұрын
The way you elucidate this complex thing is really appreciable. Hats off ❤️
@OmitA25
@OmitA25 5 жыл бұрын
Wow sir....its a great thing to have you on youtube....very informative video....thanku so much....
@sushantsinha8216
@sushantsinha8216 3 жыл бұрын
best channel ever over youtube for understanding sql tutorial
@rahulmungali7810
@rahulmungali7810 2 жыл бұрын
One of the best video available in internet for correlated query👍👍
@hudachanna4918
@hudachanna4918 Жыл бұрын
You are amazing. Finally I understand how this works
@avtarchandra2407
@avtarchandra2407 2 жыл бұрын
abb samjh me aya sirr ki Nth salary ku famous question hai ...kuki isme pura basic database grind ho jata hai ...love your effort
@anitha6661
@anitha6661 4 жыл бұрын
Thank you so much for this video. I was struggling to understand the logic behind this and you just cleared all my doubts!!! : )
@rishabhsen9222
@rishabhsen9222 3 жыл бұрын
I have a doubt... Inner query me to condition ye hai ki ' e2.salary > e1.salary '... To pehle e2 ki salary 10,000 ka comparison e1 ki salary k sath hoga to first comparison me to answer 0 hi ayega kyoki 10,000 e2 ki kic bhi salary se bda nhi hai... Jbki sir ne ulta comparison krke pehle comparison me answer 4 nikal diya... Sir ne ' e1.salary
@LV-ni6tf
@LV-ni6tf 3 жыл бұрын
Urs explaining way really super....
@LV-ni6tf
@LV-ni6tf 3 жыл бұрын
@krishna9971
@krishna9971 2 жыл бұрын
Thank you sir, i was searching this concept from long ago, finally understood the working from your video only. Thank you for making sql easy.
@rounak3239
@rounak3239 5 жыл бұрын
Gurujee shandar jabardast zindabaad
@nishu2166
@nishu2166 3 жыл бұрын
Excellent sir.... Really logic is very imp and that is clear... 👌👌💐
@kanaksingh8542
@kanaksingh8542 3 жыл бұрын
This is the Query for to find nth Salary: SELECT DISTINCT Salary FROM tblemployee ORDER BY Salary DESC LIMIT 1 OFFSET (n-1) If you want to find 8th highest salary, query should be : SELECT DISTINCT Salary FROM tblemployee ORDER BY Salary DESC LIMIT 1 OFFSET 7 Note: OFFSET starts from 0th position, and hence use N-1 rule here
@drawingloverswithsohana6194
@drawingloverswithsohana6194 3 жыл бұрын
I like your all vedio and always watch your vedio when I fetch trouble to solve CSE DEPARTMENT related problem.
@bhavaniguniganti667
@bhavaniguniganti667 Ай бұрын
Really really superb I have seen soo many videos for this particular query ...but got clear idea through you video. Thank you sooo much
@shadabsiddiqui28
@shadabsiddiqui28 2 жыл бұрын
sir apki jinti tareef ki jaye kam hai you are great
@BEKKAMBHARATHASIMHAREDDY
@BEKKAMBHARATHASIMHAREDDY 2 жыл бұрын
BEST EXPLAINATION EVER AND EVER SIR THANK YOU SO MUCH 🥰🥰🥰🥰
@fatimaiqra2169
@fatimaiqra2169 2 жыл бұрын
Mny b try kiya bilkul thik ans aya ...best explanation sir
@kedandu4209
@kedandu4209 4 жыл бұрын
Well explained . I highly appreciate your talent and logic.
@ankitbaiskhiyar3106
@ankitbaiskhiyar3106 2 жыл бұрын
select max(salary) from Employee e1 where N-1 = (select count(distinct salary) from Employee e2 where e2.slaray > e1.salary (Leetcode)
@ravikumar-wj3rr
@ravikumar-wj3rr 3 жыл бұрын
you are great sir very best way to teach thank you sir
@nivi6414
@nivi6414 5 жыл бұрын
Thanks a lot sir!. Been looking for the perfect explanation for months. Thanks again!
@jayasreecarey7843
@jayasreecarey7843 2 жыл бұрын
Thanks ! Nice Explanation :)
@yuvrajoberoi7834
@yuvrajoberoi7834 4 жыл бұрын
No one has helped me more learning SQL queries than you sir.
@bharadwaj003mydreams
@bharadwaj003mydreams 4 жыл бұрын
It's true
@01kumarr
@01kumarr 2 жыл бұрын
Superb much better than a book
@chanchalarya983
@chanchalarya983 2 жыл бұрын
THIS IS CALL GENIOUS WAY TO RIGHT QUERY
@Ammuworld_himaja
@Ammuworld_himaja 3 жыл бұрын
Thankyou very much, this is much helpful. Now i understood why that N-1 concept works just with the COUNT.
@ravi6996
@ravi6996 3 жыл бұрын
We can use LIMIT, OFFSET for yielding same results in case of finding nth highest
@deekshakhan4506
@deekshakhan4506 2 жыл бұрын
such a nice concept i got from u sir🥰
@pavangsk8404
@pavangsk8404 Жыл бұрын
kutha bhi dhekega tho samaj lega sir thank you so much... wonderful explanation
@pradeepkumar-qu1gc
@pradeepkumar-qu1gc 2 жыл бұрын
Very nice explanation friend. thanks a lot
@jovitalobo1273
@jovitalobo1273 Жыл бұрын
you explained this complex theory in awesome way. hats off to your efforts
@avishgoswami2141
@avishgoswami2141 4 жыл бұрын
Man you nailed it...Hats off to you!!!
@shrikrushnakarkhele9122
@shrikrushnakarkhele9122 2 жыл бұрын
superb info sir
@lunatic792
@lunatic792 3 жыл бұрын
Bhai behre insaan ko bhi samjha sakte hein, thank u so much.
@narenderreddyvanga8908
@narenderreddyvanga8908 2 жыл бұрын
Excellent Explanation..👌
@Poorna10088
@Poorna10088 3 жыл бұрын
Your explanation is awesome bro
@ashvinimeshram5242
@ashvinimeshram5242 3 жыл бұрын
Thanks sir. This is very helpful. Now I am able to write quaries.🙏🙏🙏🙏
@md.anisurrahman1723
@md.anisurrahman1723 3 жыл бұрын
Nice explanation, to speak the truth.
@neelesh621
@neelesh621 3 жыл бұрын
Was seraching this..thnk u sir for this awesome level explanantion!!
@anujgrewal4456
@anujgrewal4456 4 жыл бұрын
Very nice way Sir .......today i cleared this way ........
@m.tayyab871
@m.tayyab871 3 жыл бұрын
really found quality content...
@VickySharma-rz7he
@VickySharma-rz7he 3 жыл бұрын
Great Explanation Sir thanks for such work
@kumarsaheb
@kumarsaheb Жыл бұрын
best explanation ever.. God Bless !!
@kunalsingh5794
@kunalsingh5794 5 жыл бұрын
Sir please also upload videos on digital electronic... ....... Please make video on sequential circuit....🙏🙏🙏🙏
@PythonisLove
@PythonisLove 3 жыл бұрын
you cant believe, I can solve most dbms questions already after taking notes from your videos...I have never read a book
@zabilmaooz7780
@zabilmaooz7780 3 жыл бұрын
same here
@deepa8177
@deepa8177 3 жыл бұрын
thanku for explaining each line got so much crystal clarity..
@sagarbhavsar7774
@sagarbhavsar7774 2 жыл бұрын
very useful
@santoshsomu
@santoshsomu Жыл бұрын
thank you bro, i was able to understand easily with your detailed and examples explanation, thank you !
@shekharsalunke226
@shekharsalunke226 3 жыл бұрын
Hi Sir, Thanksgiving your knowledge.. this method is too good.. 👍
@meetpatel3580
@meetpatel3580 Жыл бұрын
Good Explanation sir👀
@KUNDANKUMAR-vz4vl
@KUNDANKUMAR-vz4vl 3 жыл бұрын
Genius Sir !!!!!!👌👌
@surajkolekar7944
@surajkolekar7944 3 жыл бұрын
select a_id,salary from agg as a1 where 3 = (select count(distinct(salary)) from agg as a2 where a2.salary > a1.salary); agg is table name.. Thnk u for simplification.............
@amankaintura4715
@amankaintura4715 2 жыл бұрын
Thank you sir finally able to understand it 👌
@kritisk1
@kritisk1 4 жыл бұрын
Thanks a ton, one of the best video which clearly explains the concept and logic behind the query.Im from Tamil Nadu but I was able to follow the language without any trouble because of the explanation
@subhenduchsingh4981
@subhenduchsingh4981 4 жыл бұрын
Really Appreciate ... Have understood the concert 👍👍
@pradyutpanja5313
@pradyutpanja5313 3 жыл бұрын
Thanks sir , last day in my interview 2nd highest salary was asked to me .my answer was right like....SELECT MAX(salary) FROM employee WHERE salary < (SELECT MAX(salary) FROM employee).. but i had a huge confusion on like how to find out the other cases 4th ,5th etc. but all confusions are totally cleared now. Thanks a lot sir.. now i have decided to watch your all videos related to SQL. and also i will recomend this to others who are actually facing on sql. such a nice tutorials...
@smrutiranjanparida9766
@smrutiranjanparida9766 2 жыл бұрын
see no one answering while everyone busy praising channel,
@vivekgupta5041
@vivekgupta5041 3 жыл бұрын
No need of costly books !!! Much more matter than that provided by books !!!
@ShivamSharma-xk1yp
@ShivamSharma-xk1yp 2 жыл бұрын
Right
@nitin9042
@nitin9042 2 жыл бұрын
Average netpack at 200 can get you knowledge worth milli6
@ayushnegi5123
@ayushnegi5123 6 ай бұрын
😢​@@ShivamSharma-xk1yp
@arpitgarg4756
@arpitgarg4756 3 жыл бұрын
Nice. keep up the good work
@renukarani7392
@renukarani7392 4 жыл бұрын
Great explanation
@AyurshiK
@AyurshiK 2 жыл бұрын
great work sir beautifully explained difficult topics. it helped me a lot.
@Iamabhay_
@Iamabhay_ Жыл бұрын
This is very simple....... Select distinct salary from employee order by salary desc limit n-1, 1 Here n is the nth highest. salary.
@geetbawa990
@geetbawa990 3 жыл бұрын
Excellent.... God bless u sir
@AayushJain-mr6bx
@AayushJain-mr6bx 4 жыл бұрын
Great playlist for DBMS. Very well explained. Kudos.
@GateSmashers
@GateSmashers 4 жыл бұрын
Glad it was helpful!
@sumeetratnani980
@sumeetratnani980 2 жыл бұрын
Best Explanation Sir ❤
@harshjilka
@harshjilka 3 жыл бұрын
Compiler confuse ho jayega : ye kya bat bani 😎🔥😂 OP
@iCyrus
@iCyrus 3 жыл бұрын
😅🤣
@pruthvirajjadhav4049
@pruthvirajjadhav4049 5 жыл бұрын
This logic is such that how many kids are elder than this child if there two child greater than this one then he is third . how to find the the second last child ? Q . how to find the second minimum salary ? ANS : try to get this . select salary ,id from emp e1 where n-1 = (select salary count (distinct salary) from emp e2 where e2.salary
@namratanikam7566
@namratanikam7566 4 жыл бұрын
Amazing🤗🤗🤗🤗
@shashanksharma7747
@shashanksharma7747 3 жыл бұрын
very good explanation underrated channel deserve more subscribers
@shubhamsood1406
@shubhamsood1406 3 жыл бұрын
Another approach for MySQL users, also worked on duplicates salaries SELECT * from Employee WHERE salary= (SELECT DISTINCT salary from Employee ORDER BY salary DESC LIMIT N-1, 1);
@sanyogsalve6256
@sanyogsalve6256 3 жыл бұрын
Thanks buddy it's easily understood
@sayalikawle4273
@sayalikawle4273 2 жыл бұрын
your query is not firing giving errors
@nehadubey7192
@nehadubey7192 3 жыл бұрын
Nice..thanku for guidance
@krishanudutta2943
@krishanudutta2943 3 жыл бұрын
Excellent lecture sir
@suyash7450
@suyash7450 Жыл бұрын
yOU make it very easy to understand......
@abhinavmaheshwari9732
@abhinavmaheshwari9732 3 жыл бұрын
Very nice explanation.
@misunadiyan
@misunadiyan 5 жыл бұрын
Great personality
@sumenbhattacharyajee7091
@sumenbhattacharyajee7091 5 жыл бұрын
Very Nicely you explained. 🙏
@hireinnag2939
@hireinnag2939 3 жыл бұрын
Great video. Very much explanatory!
@ashupardhi5071
@ashupardhi5071 3 жыл бұрын
thank you so much bro.. 🥳🥳
@avaniagarwal8973
@avaniagarwal8973 4 жыл бұрын
Really amazing explanation!!!
@ankushjain4128
@ankushjain4128 3 жыл бұрын
I really liked way of explanation !
@jitendraverma3783
@jitendraverma3783 4 жыл бұрын
Great concept Learned something new Thanks 👍
@KamalYadav-lj9zu
@KamalYadav-lj9zu 4 жыл бұрын
Wonderful explanation.
@manishbolbanda4614
@manishbolbanda4614 2 жыл бұрын
very well explained
@RohitSingh-ITProfessional
@RohitSingh-ITProfessional 2 жыл бұрын
awesome 👏
Lec-71: 3 Imp Questions on SQL basic Concepts | DBMS
9:38
Gate Smashers
Рет қаралды 222 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН
Lec-72: Introduction to PL-SQL in DBMS
6:25
Gate Smashers
Рет қаралды 742 М.
Part 1   How to find nth highest salary in sql
11:45
kudvenkat
Рет қаралды 2 МЛН
Query To Find Nth Highest Salary In SQL | SQL Interview Question
5:07
Crack Concepts
Рет қаралды 288 М.