Another approach (if there are several films with the same minimum rating, all of them will be displayed):
-- sample of data just for the sake of demonstration SQL> with movie as( 2 select 1 as movieid , 'Departed' as movietitle from dual union all 3 select 2, 'Shutter Island' from dual union all 4 select 3, 'Terminator' from dual 5 ), 6 rating as( 7 select 1 as movieid, 7 as rating from dual union all 8 select 1, 8 from dual union all 9 select 1, 9 from dual union all 10 select 1, 6 from dual union all 11 select 1, 7 from dual union all 12 select 2, 9 from dual union all 13 select 2, 5 from dual union all 14 select 2, 6 from dual union all 15 select 3, 6 from dual union all 16 select 3, 5 from dual union all 17 select 3, 6 from dual 18 ) -- the query 19 select w.movietitle as "Movie Title" 20 , round(w.mavr, 1) as "Lowest Average Rating" 21 from ( select movietitle 22 , min(avg(rating)) over() as mavr 23 , avg(rating) as avr 24 from movie 25 , rating 26 where movie.movieid = rating.movieid 27 group by movietitle 28 ) w 29 where w.mavr = w.avr 30 ;
Result:
Movie Title Lowest Average Rating -------------- --------------------- Terminator 5,7
source share