--2 select id_os "Identyfikator", INITCAP(imie1)||' '|| INITCAP(nazwisko) "Imię i nazwisko", SUBSTR(imie1, 1, 1)||SUBSTR(nazwisko, 1, 1) || TO_CHAR(d_ur, 'YYYY') "Kod pracowniczy" from osoby where (nazwisko like '%A%' or nazwisko like '%M%') and to_char(d_ur, 'Q')=2 order by 1 asc; --3 select s.nazwa "Nazwa stanowiska", count(id_os) "Liczba aktualnych pracowników", min(pensja) "Minimalna aktualna pensja", max(pensja) "Maksymalna aktualna pensja" from zatrudnienia join stanowiska s using(id_s) join wydzialy w using(id_w) where w.nazwa in ('PRAWO', 'EKONOMIA', 'FILOLOGIA') and do is null group by w.nazwa, s.nazwa order by w.nazwa asc; --4 select w.nazwa from zatrudnienia join wydzialy w using (id_w) join osoby using(id_os) where do is null and plec='K' group by w.nazwa having avg(pensja) between 1200 and 2000 order by 1 asc; --5 select nazwisko, to_char(d_ur, 'dd month yyyy') "DATA URODZENIA" from osoby where d_ur=(select max(d_ur) from osoby where imie1='EWA') and imie1='EWA'; --6 select nazwisko, upper(s.nazwa) "Nazwa stanowiska" from zatrudnienia z join osoby using(id_os) join stanowiska s using (id_s) where do is null and pensja<(select avg(pensja) from zatrudnienia where do is null and id_w=z.id_w) order by nazwisko; --7 select to_char(d_ur, 'YYYY') "ROK" from osoby where plec='M' group by to_char(d_ur, 'YYYY') having count(id_os)=(select max(count(id_os)) from osoby where plec='M' group by to_char(d_ur, 'YYYY'));