Advertisement
Artur123ff2

Untitled

Mar 25th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. select avg(N.number) as Average
  2. --just average from task 7
  3. from (
  4. select t.team_name, count(tt.team_id) as 'Number'
  5. from teams as t
  6. join (
  7. select t.team_id, t.team_name
  8. from teams as t
  9. join employees as e on e.team_id = t.team_id
  10. where e.gender = 'F'
  11. ) as tt on t.TEAM_ID = tt.team_id
  12. group by t.team_name
  13. UNION
  14. -- just solution from task 6:
  15. select distinct t.team_name, '0'
  16. from teams as t
  17. where t.team_name not in (
  18. select distinct t.team_name
  19. from teams as t
  20. join employees as e on t.team_id = e.TEAM_ID
  21. where e.gender = 'F'
  22. )
  23. ) as N
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement