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 in Others by nisha
• 2,180 points
14 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 by polo
• 1,500 points

Related Questions In Others

+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,210 points
278 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
172 views
0 votes
1 answer

What are the basic commands used for user management?

The basic commands used for user management ...READ MORE

answered Mar 8, 2019 in Others by Nabarupa
251 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,870 points
381 views
0 votes
1 answer

What is an index in SQL?

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

answered Feb 3 in Database by Vaani
• 7,020 points
51 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 in Database by Neha
• 8,560 points
603 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 in Others by polo
• 1,500 points
25 views
0 votes
1 answer

Android backgroud image slow the app

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

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