find out first highest salary?
Answers were Sorted based on User's Feedback
Answer / surya
select * from emp where &n-1=(select count(distinct sal)
from emp e where emp.sal<e.sal);
For example:-
If you enter n=1,it will display first highest salary
if you enter n=2,it will display second highest salary
......
if you enter n=nth,it will display nth salary
Is This Answer Correct ? | 9 Yes | 0 No |
SELECT DISTINCT salary FROM (SELECT DISTINCT salary,ROWNUM
rn FROM employee ORDER BY salary desc) WHERE rn=1;
Is This Answer Correct ? | 6 Yes | 2 No |
Answer / ela tiku
select max(sal) from emp
<<<assuming emp is the table name and sal is the column
name>>>
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / tulasi
select * from emp x where 1=(select count(distinct sal)
from emp y where x.sal<=y.sal);
query to find nth sal
select * from emp x where &n=(select count(distinct sal)
from emp y where x.sal<=y.sal);
Is This Answer Correct ? | 5 Yes | 2 No |
Answer / vali
according to samir kumar sahoo we cant find ans i think
bcoz
if u enter rownum='x' u can not find the data
select * from emp where rownum=10
ans; no rows found
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / suren
hi Im SureRishi
SELECT *
FROM Employee E1
WHERE (4-1) = (
SELECT COUNT(DISTINCT(E2.Salary))
FROM Employee E2
WHERE E2.Salary > E1.Salary)
Is This Answer Correct ? | 1 Yes | 0 No |
What is integrity and what is constraint??Explain with example
How to assign values to data fields in record variables?
When system tablespace is created?
What is background process in Oracle?
What to do if the startbd.bat failed to start the xe instance?
Hi, I want table structure shown below. How can i create this ? Num Name Address Addr1 Addr2 I want Addr1 and Addr2 under Address column. How can i achive this ? Is it possible ?
Please send me Informatica 8.1 certification dumps, my mail id mona85gupta@gmail.com
Is there a function to split a string in plsql?
i can create a view with two columns from emp table,, later i need to add one more emp column to existing view.. what is query similarly add one more column to existing primary key constraint.. please give me the solutions
What is a relational database management system?
What is the purpose of init.ora. ? how many init.ora exist in oracle installation? suppose there are 3 database on one oracle server, how many init.ora do I have? what are various database objects? how will you identify memmory related performace issue in oralce? any idea about basic architure difference of oracle and db2? comment on which is better , with reasons? what is a fuction based index? is it recommended to use the same. ? what is global temporay table? what is teh signification of the parameter session_cached_cursor ?
How to start a new transaction in oracle?