Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --7
- select w.id_wlasciciela, w.wlasciciel, w.adres,
- count(p.nr_rejestracyjny) as "Liczba_pojazdow",
- (select max(count(nr_rejestracyjny))
- from pojazdy where typ in ('SAM_OSOBOWY') and id_wlasciciela=id_wlasciciela
- group by id_wlasciciela) as "Osobowe",
- (select max(count(nr_rejestracyjny))
- from pojazdy where typ in ('MOTOCYKL') and id_wlasciciela=id_wlasciciela
- group by id_wlasciciela) as "Motocykle"
- from wlasciciele w, pojazdy p where w.id_wlasciciela=p.id_wlasciciela
- and p.typ in ('SAM_OSOBOWY', 'MOTOCYKL')
- group by w.id_wlasciciela, w.wlasciciel, w.adres
- having count(nr_rejestracyjny)=(select max(count(nr_rejestracyjny))
- from pojazdy where typ in ('SAM_OSOBOWY', 'MOTOCYKL')group by id_wlasciciela)
- order by 1;
- --8
- select * from oceny;
- select * from studenci;
- select s.nr_indeksu, s.nazwisko, s.imiona, s.kierunek, s.rok,
- (select max(count(nr_indeksu))from oceny where ocena = 5 group by nr_indeksu )as "Liczba ocen 5"
- from studenci s, oceny o;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement