Saturday, 18 January 2025

SQL very Important Questions :-

 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

Deep in Python list

  Most Important in Python(0-Z) 1.What is List. Explain in Detail          The  list  class is a fundamental  built-in data type  in Pyt...