select char(naziv,30) as "Naziv", oznaka_roka as "Oznaka roka",dec(avg(ocena*1.0),4,2) as "Prosek", grouping(naziv) as "Sadrzi naziv",grouping(oznaka_roka) as "Sadrzi oznaku roka"
from   ispit a, predmet b
where  ocena >5
and    a.id_predmeta=b.id_predmeta
group  by cube ((naziv), (oznaka_roka))
order by 1;
