Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Zad 16
- select id_okregu, id_lowiska, nazwa, sum(waga) Laczna_waga, count(*) Liczba_Polowow, count(id_gatunku) Liczba_Ryb
- from rejestry re join lowiska lo using(id_lowiska)
- where id_okregu like 'PZW%'
- group by id_okregu, id_lowiska, nazwa
- order by 4 desc;
- --Zad 17
- select tryb, stopien, kierunek, rok, count(*) as liczb_studentow
- from studenci
- group by grouping sets((tryb, stopien, kierunek, rok), (tryb, stopien, kierunek), (tryb, stopien), (tryb))
- order by 1,2,3,4;
- --Zad 18
- 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,
- tryb, stopien, kierunek, rok, count(*)as liczb_studentow
- from studenci
- group by grouping sets((tryb, stopien, kierunek, rok), (tryb, stopien, kierunek), (tryb, stopien), (tryb), ())
- order by 2,3,4,5;
- --Zad 19
- select wlasciciel, id_wlasciciela, typ, marka, count(*)
- from pojazdy po join wlasciciele we using(id_wlasciciela)
- group by grouping sets((wlasciciel, id_wlasciciela, typ, marka), (wlasciciel, id_wlasciciela, typ), (wlasciciel, id_wlasciciela), typ, marka, ())
- having count(*) >=3
- order by 5 desc;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement