Skip to main content
Code Review

Return to Revisions

3 of 3
Commonmark migration

Style Points

You use a mixture of both lowercase and UPPERCASE for your keywords, sticking to one or the other makes a query much easier to read at a glance.

Old-style Joins

It's generally agreed by the SQL community that old style joins are more difficult to read and use. They also have the nasty side effect of becoming Cross Joins (also known as the Cartesian Product) if you forget to add the correct code to the where clause

Your query would be much nicer to read with an explicit INNER JOIN.

Putting it all together

Note that I prefer my keywords in UPPERCASE, so that is what I used when rewriting your query.

SELECT Movie.title, MAX(Rate.stars) 
FROM Movie
INNER JOIN Rating
 ON Movie.Mid = Rating.Mid
GROUP BY Movie.title
ORDER BY Movie.title; 
PenutReaper
  • 1.3k
  • 10
  • 8
default

AltStyle によって変換されたページ (->オリジナル) /