SELECT * FROM emp WHERE 1=2
the output of the query is "No records found" i.e returns no records
Showing posts with label select. Show all posts
Showing posts with label select. Show all posts
Monday, June 16, 2008
Sunday, June 15, 2008
select second highest salary from emp table
1.select second highest salary from emp table
select max(sal ) from emp where sal<(select max
(sal)from emp)
select max(sal) from emp where level=2 connect by prior
sal>sal group by level;
2.select the employee details who is having the second highest salary from emp table
select A.* from emp A where 1=(select count(distinct
B.sal) from emp B where B.sal>A.sal)
3.select second highest salary of the employee along with first highest salary from emp table
select ename,sal from
(select ename,sal from emp
order by sal desc)
where rownum <=2;
select max(sal ) from emp where sal<(select max
(sal)from emp)
select max(sal) from emp where level=2 connect by prior
sal>sal group by level;
2.select the employee details who is having the second highest salary from emp table
select A.* from emp A where 1=(select count(distinct
B.sal) from emp B where B.sal>A.sal)
3.select second highest salary of the employee along with first highest salary from emp table
select ename,sal from
(select ename,sal from emp
order by sal desc)
where rownum <=2;
Subscribe to:
Posts (Atom)