PSET 7 for 6.sql, Terminal just hangs when I execute it. Can anyone tell me why this wouldn't work? I've tried every variation I could think of (and several I found online) for this and none of them work, Terminal just shows a solid white block like it's processing but it never does anything.

SELECT AVG(rating) FROM ratings INNER JOIN movies WHERE year = 2012

I've tried regular JOIN, replacing WHERE with ON, specifying ratings.rating instead of just rating, literally everything I can think of. Where am I going wrong?


The JOIN clause is missing a "join constraint". The sql is generating a Cartesian product, ie every rating is being "joined" with every movie. The query should join each ratings records with the movie it rates.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .