Querying for the second largest salary

0 votes
How would I go about querying for the second largest salary from all employees in my Employee table?
Jun 16, 2022 in Others by nisha
• 2,210 points
578 views

1 answer to this question.

0 votes

general SQL query should be as follows:

select
   sal 
from
   emp a 
where
   N = (
      select
         count(distinct sal) 
      from
         emp b 
      where
         a.sal <= b.sal
   )
where
   N = any value
answered Jun 16, 2022 by polo
• 1,480 points

Related Questions In Others

0 votes
1 answer

Find max and second max salary for a employee table MySQL

SELECT MAX(SALARY) FROM Employee WHERE SALARY < ...READ MORE

answered Nov 7, 2022 in Others by gaurav
• 23,260 points
4,476 views
+2 votes
2 answers
0 votes
1 answer

Where is the documentation to refer for coinbase api integration of Etherium coin currency in php?

Hey there! Please refer to the following ...READ MORE

answered Jan 25, 2019 in Others by Omkar
• 69,220 points
888 views
0 votes
0 answers

Wafcoin: Legalization is the cornerstone for long-term development

Wafcoin token trading platform has always insisted ...READ MORE

Jan 29, 2019 in Others by anonymous
683 views
0 votes
1 answer
0 votes
1 answer

How to change the default value and to alter a column in sql?

Hi, You can try this: ALTER TABLE foobar_data CHANGE ...READ MORE

answered Jun 24, 2019 in Big Data Hadoop by Gitika
• 65,770 points
1,532 views
0 votes
1 answer

What is an index in SQL?

An index is used to speed up ...READ MORE

answered Feb 3, 2022 in Database by Vaani
• 7,070 points
689 views
0 votes
1 answer

Ordering by the order of values in a SQL IN() clause

Use MySQL's FIELD() function: SELECT name, description, ... FROM ... WHERE id ...READ MORE

answered Feb 4, 2022 in Database by Neha
• 9,020 points
5,339 views
0 votes
1 answer

Android Studio automatically connect to Windows Subsystem for Android

Check Taskmanager for adb.exe processes and note ...READ MORE

answered Jun 16, 2022 in Others by polo
• 1,480 points
1,341 views
0 votes
1 answer

Android backgroud image slow the app

You should have diferentiate sizes for deferent ...READ MORE

answered Jun 16, 2022 in Others by polo
• 1,480 points
586 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP