Advertisement
Guest User

25-25b

a guest
Mar 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. 25.
  2. SELECT d.deptname, SUM(e.salary) AS suma_zarobkow_w_dziale, (SELECT AVG(salary) from employee) AS ogolna_srednia_zarobkow
  3. FROM department d
  4. JOIN employee e
  5. ON e.workdept = d.deptno
  6. GROUP BY d.deptname
  7. HAVING SUM(e.salary) > (SELECT AVG(salary) from employee);
  8.  
  9. 25a.
  10. SELECT d.deptname, SUM(Cast(e.salary as int)) AS suma_zarobkow_w_dziale, (SELECT AVG(Cast(salary as int)) from employee) AS ogolna_srednia_zarobkow
  11. FROM department d
  12. JOIN employee e
  13. ON e.workdept = d.deptno
  14. GROUP BY d.deptname
  15. HAVING SUM(e.salary) > (SELECT AVG(salary) from employee);
  16.  
  17. 25b.
  18. SELECT Cast(d.deptname as varchar(3)), SUM(Cast(e.salary as int)) AS suma_zarobkow_w_dziale, (SELECT AVG(Cast(salary as int)) from employee) AS ogolna_srednia_zarobkow
  19. FROM department d
  20. JOIN employee e
  21. ON e.workdept = d.deptno
  22. GROUP BY d.deptname
  23. HAVING SUM(e.salary) > (SELECT AVG(salary) from employee);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement