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 |
Tab A A B ------ 1 A 2 B 3 C Tab B A B ----- 4 D 5 E 6 F Generate the value into B table from A table. Only table A has the value. Write the SQL query to get B table value.
1:-How to write to update command in a procedure in oracle which update two different table at a time 2:-How to write the select command in a procedure in oracle which give multiple records
How to display employee records who gets more salary than the average salary in the department?
I have a parent program and a child program. I want to write a statement in Exception Block of the parent program so that when the statement in the exception block is executed, the control goes to the next statement in the parent block bypassing the child block.How do i do that?
What is oracle datasource?
Why do we need integrity constraints in a database?
Give the advantages and disadvantages of clusters.
Where do we use decode and case statements?
What is recovery manager in Oracle?
T1: T2 A X--- this is updated record B B like this T1 table having no.of records updated. write a query"retrive updated record from T2"
What is the difference between postgresql and oracle?
What is a SNAPSHOT ?