Pages

Imp queries




select level from dual connect by level<=10;


Delete emp where rowid not in (select min(rowid) from emp group by sal);


select * from emp where sal in (select  max(sal) from emp);


1. Select * from emp where sal=(select max(sal) from emp where sal <(select max(sal) from emp));
2. Select * from (select sal,rank() over (order by sal desc) as rnk from (select  distinct sal from emp)) where rnk=2;
3. Select level,max(sal) from emp where level=&levelno connect by prior sal> sal group by level;
4. Select max(sal) from (select distinct sal from emp where sal not in (select max(sal) from emp));
5. select sal from(select sal from  (select distinct sal from emp order by sal desc) where rownum<=2 order by sal asc) where rownum=1;
select max(sal) from emp
union
select min(sal) from emp;
select * from EMP where rownum=1
union
select * from EMP where rowid=(select max(rowid) from EMP);


Select ename, count (*) from emp group by ename having count(*) >= 1;


SELECT * FROM  EMP WHERE (SAL IN (SELECT sal FROM emp GROUP BY sal HAVING COUNT(sal) > 1));


select * from emp where ename like '%A_B%';
Explain set operators

No comments:

Post a Comment

Thanks