how 2 find out nth salary.plz write sql qurires

Answers were Sorted based on User's Feedback



how 2 find out nth salary.plz write sql qurires ..

Answer / shankar

Hi...
here is the query to find out the n'th maximum salary

note: 1.'emp' is Table name & 'sal' is column name.
2.'distinct' is used for finding the unique value
3.'count' is for counting the values.

Query:
------

SELECT * from emp
where sal = (SELECT distinct(sal) from emp x
where &n = (SELECT count(distinct(sal)) from
emp where sal >= x.sal));

Is This Answer Correct ?    4 Yes 0 No

how 2 find out nth salary.plz write sql qurires ..

Answer / guest

select top 1 salary from(select Distinct top 2 salary from
employee order by salary desc)order by salary

Is This Answer Correct ?    1 Yes 1 No

how 2 find out nth salary.plz write sql qurires ..

Answer / a sameer

By using alias name too we can generate the query
A and B are two alias name for the employee table name

Query:-

select A.* from employee A where N=(selet count(Distinct
B.sal) from employees B where B.Sal > A.sal);


If any one want 2 or any other salary jut replace "the no."
required in place of N, to get the answer.


Hope might understand

Is This Answer Correct ?    1 Yes 1 No

how 2 find out nth salary.plz write sql qurires ..

Answer / rafi

Select * from (Select emp.*.dense_rank()over (order by sal
desc) a from emp) where a=&n;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Manual Testing Interview Questions

When a project was started in an organisation ,Testing team will get BRS & FRS documents and starts preparing the Test cases for the application.when the Build was released whether the Testing team will execute only the written Test cases (or) they may update further testcases

3 Answers   Siemens,


how to write test cases for epos/pos testing.

0 Answers   IBM,


Inwhat basis the time is allocated for testing the application?

0 Answers  


What is XML Testing? Do we have any tools to test the XML? Please let me know.

0 Answers  


What expected result should come when Enter any sql query like “Select * from hello;” without quotes and with quotes.

0 Answers  






Tell me some of the Possible test cases on ATM Machine?

10 Answers   IBM, MBT,


what is the difference between product and application?

6 Answers   Synergy,


what is cyclomatic complexity

1 Answers  


What is data flow diagram?

0 Answers  


What kind of testing to be done in client server application and web application? Explain

0 Answers  


Hi, My name is Dinesh.I want to prepare for ISTQB certification , So can anyone please email me the syllabus of it and what is criteria for giving exam.Please email me answers at: dinesh0323@live.com

2 Answers  


what is a buglist?

4 Answers  


Categories