Skip to content
Advertisement

MySQL – Joins and Subqueries [closed]

I’m looking a question that asks ‘List for each year the name of the worst film(s) released that year. Films are rated by score: the lower the score, the worse the film. In the event of a tie, all tied films should be listed. The results should appear chronologically.’

The tables are:

So far I’ve gotten:

Advertisement

Answer

You are almost there. As it is, your query gives you the movie with the worst score overall all years. You need to correlate the subquery with the outer query:

You can get the same results with by joining the table with an aggregate subquery:

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement