find the second highest salary of the emp table
Answers were Sorted based on User's Feedback
Answer / guest
ANS:
select max(salary) from Employees
where salary not in
(select max(salary) from Employees )
Is This Answer Correct ? | 9 Yes | 3 No |
Answer / ramesh.ch
select max(salary) from emp
where salary< ( select max(salary) from emp)
explanation::
first sub query returns maximum salary of employee
than main query returns maximum salary lessthan the maximum
salary return by subquery
Is This Answer Correct ? | 6 Yes | 1 No |
Answer / ramesh mopuri
okay above queries are fine
but in a table there are 99 salaries, so i want to pick the
50th highest salary is it possible to wright the query same
above for the get 50th high salary. absolutely not. see my
query for the get Nth salary in a table.
Select ename,sal,deptno from emp a
where &n=
(select count(distinct(sal))from emp b
where a.sal<=b.sal)
order by deptno;
after enter this query the system ask N value and give 50
the result will be shown 50th highest salary. Please reply
me whether its working or not.
Is This Answer Correct ? | 5 Yes | 1 No |
Answer / gyana ranjan behera
sql>select ename,sal from(select ename,sal,rownum rn from
(select ename,sal from emp order by sal desc)
where rn=2;
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / naresh
Here it is the simple solution.
Select Salary from (Select Salary, Rownum from Employee
order by Salary desc) where rownum=2
Should Work
Cheers!
Naresh
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / chiru
select distinct sal
from Employee e1
where 3 = (select count(distinct sal) from Employee e2
where e2.sal >= e1.sal)
order by sal desc
Is This Answer Correct ? | 0 Yes | 0 No |
query optmization techniques and quwry analyser+projects+ppts
what is data abstraction
14. Display the item_cost and then round it to the nearest hundred, ten, unit, tenth and hundredth
What is a Redo Log ?
How to work with data objects interactively?
How to drop an existing table in oracle?
why pl sql doesn't support retrieving multiple records
Hi all, Can any one give answer for this question. Suppose im having employee table with fields, eno, ename, dept, address1, address2, address3. In address field employee can fill only address1 or address2 or address3... at a time he can fill three address fields. now i want all employee names who filled only one address field.. Plz its urjent can any one give querry.. Thanks in advance.
in account table account type amount ac1 credit 300 ac2 debit 5000 ac3 credit 3000 ac1 debit 4000 ac3 debit 2000 ac2 credit 4000 write a query how to get sum of credit & sum of debit
Suppose U install the oracle DB either enterprise edition or express edition in ur personal PC, Is there the Database has been created after ur installation if not then where the oracle's all objects with data be stored?
What is merge in oracle?
What is SQL access advisor in Oracle?