SQL very Important Questions :-
--->--Find the Dupilcates From Table
SELECT JOB,COUNT(JOB) FROM EMP
GROUP BY JOB
HAVING COUNT(JOB)>1;
---> Delete Duplicate From table
DELETE FROM EMP E
WHERE ROWID<> (SELECT MIN(ROWID) FROM EMP Y
WHERE E.EMPNO=E.EMPNO);
-->dISPALY nTH SALARIES
SELECT * FROM(SELECT DENSE_RANK() OVER(ORDER BY SAL DESC)AS
RNK,E.*FROM EMP E)
WHERE RNK=1;
Select * from emp where Rownum <= 5;
select rownum, e.* from emp e where rownum<=(select
count(*)/2 from emp);
--->
select distinct A.empno, A.ename,a.sal,b.sal, A.mgr,
B.empno, B.ename
from EMP A, EMP B where A.mgr = B.empno and A.sal > B.sal
;
No comments:
Post a Comment