Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 25.
- SELECT d.deptname, SUM(e.salary) AS suma_zarobkow_w_dziale, (SELECT AVG(salary) from employee) AS ogolna_srednia_zarobkow
- FROM department d
- JOIN employee e
- ON e.workdept = d.deptno
- GROUP BY d.deptname
- HAVING SUM(e.salary) > (SELECT AVG(salary) from employee);
- 25a.
- 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
- FROM department d
- JOIN employee e
- ON e.workdept = d.deptno
- GROUP BY d.deptname
- HAVING SUM(e.salary) > (SELECT AVG(salary) from employee);
- 25b.
- 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
- FROM department d
- JOIN employee e
- ON e.workdept = d.deptno
- GROUP BY d.deptname
- HAVING SUM(e.salary) > (SELECT AVG(salary) from employee);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement