Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. --Zad 16
  2. select id_okregu, id_lowiska, nazwa, sum(waga) Laczna_waga, count(*) Liczba_Polowow, count(id_gatunku) Liczba_Ryb
  3. from rejestry re join lowiska lo using(id_lowiska)
  4. where id_okregu like 'PZW%'
  5. group by id_okregu, id_lowiska, nazwa
  6. order by 4 desc;
  7.  
  8. --Zad 17
  9. select tryb, stopien, kierunek, rok, count(*) as liczb_studentow
  10. from studenci
  11. group by grouping sets((tryb, stopien, kierunek, rok), (tryb, stopien, kierunek), (tryb, stopien), (tryb))
  12. order by 1,2,3,4;
  13.  
  14. --Zad 18
  15. select decode(grouping_id(tryb, stopien, kierunek, rok), 7, 'W danym trybie', 0, 'Na danym roku w TSK ', 1, 'Na danym Kierunku', 3, 'W ramach danego stopnia ', 15, 'Ogolem studiuje') as KOMENTARZ,
  16. tryb, stopien, kierunek, rok, count(*)as liczb_studentow
  17. from studenci
  18. group by grouping sets((tryb, stopien, kierunek, rok), (tryb, stopien, kierunek), (tryb, stopien), (tryb), ())
  19. order by 2,3,4,5;
  20.  
  21. --Zad 19
  22. select wlasciciel, id_wlasciciela, typ, marka, count(*)
  23. from pojazdy po join wlasciciele we using(id_wlasciciela)
  24. group by grouping sets((wlasciciel, id_wlasciciela, typ, marka), (wlasciciel, id_wlasciciela, typ), (wlasciciel, id_wlasciciela), typ, marka, ())
  25. having count(*) >=3
  26. order by 5 desc;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement