Select rating_id, average_rating
From (Select rating_id, avg(rating_num) as average_rating
from ratings
group by rating_id
having count(*) > 50)
HAVING average_rating > 4 ;
After running the query, I get an error
Every derived table must have its own alias
I know that the section here works:
Select rating_id, avg(rating_num) as average_rating
from ratings
group by rating_id
having count(*) > 50
What am I doing wrong in this subquery? I searched and searched and searched but couldn’t find the mistake, no matter where I corrected, I still get errors
Put “as SomeAlias” after the subquery: