Advertisement
hgr24

Untitled

Mar 30th, 2022
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.91 KB | None | 0 0
  1. SELECT DISTINCT PNo
  2.  FROM PROJECT
  3.  WHERE PNo IN(
  4.  (SELECT P.PNo
  5.  FROM PROJECT P,DEPARTMENT D ,EMPLOYEE E
  6.  WHERE P.DNo=D.DNo AND D.MgrSSN=E.SSN AND E.Name='Scott')
  7.  UNION
  8.  (SELECT W.PNo
  9.  FROM WORKS_ON W, EMPLOYEE E
  10.  WHERE E.SSN=W.SSN AND E.Name='Scott'));
  11.  
  12.  
  13.  
  14. SELECT E.Name,1.1* E.Salary AS Increased_salary
  15. FROM EMPLOYEE E, WORKS_ON W, PROJECT P
  16. WHERE E.SSN=W.SSN AND W.PNo=P.PNo AND P.PName='IoT';
  17.  
  18.  
  19.  
  20.  
  21. SELECT SUM (E. Salary) AS TOTAL_SALARY,MAX(E. Salary) AS
  22.  MAX_SALARY,MIN(E. Salary) AS MIN_SALARY,AVG(E. Salary) AS
  23.  AVG_SALARY
  24.  FROM EMPLOYEE E, DEPARTMENT D
  25.  WHERE E. DNo= D. DNo AND D.DName='Accounts';
  26.  
  27.  
  28.  
  29. SELECT E.Name
  30. FROM EMPLOYEE E
  31. WHERE NOT EXISTS((SELECT PNo FROM PROJECT WHERE DNo='D5')
  32. MINUS (SELECT W.PNo FROM WORKS_ON W WHERE E.SSN=W.SSN));
  33.  
  34.  
  35.  
  36. SELECT D.DNo,COUNT(*)
  37. FROM EMPLOYEE E, DEPARTMENT D
  38. WHERE E.DNo= D.DNo AND E.Salary>600000
  39. GROUP BY D.DNo
  40. HAVING COUNT(*)>=5;
  41.  
  42.  
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement